Skip to content

Commit

Permalink
Boost.python requires numpy. Fix function _run_python_script(), was b…
Browse files Browse the repository at this point in the history
…roken when script returns empty output.
  • Loading branch information
Winfried Dobbe committed May 26, 2021
1 parent d7facae commit e2a3e2d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions recipes/boost/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import shlex
import shutil
import yaml
import re

try:
from cStringIO import StringIO
Expand Down Expand Up @@ -385,6 +386,13 @@ def validate(self):
if min_compiler_version is not None:
if tools.Version(self.settings.compiler.version) < min_compiler_version:
raise ConanInvalidConfiguration("Boost.Math requires a C++11 capable compiler")

if not self.options.without_python:
#Boost python library build will fail if python package numpy is not installed
try:
import numpy
except ImportError as e:
raise ConanInvalidConfiguration("Boost.python library requires numpy but this is not installed in your python environment")

def build_requirements(self):
if not self.options.header_only:
Expand Down Expand Up @@ -478,6 +486,8 @@ def _run_python_script(self, script):
# Conan is broken when run_to_output = True
if "\n-----------------\n" in output:
output = output.split("\n-----------------\n", 1)[1]
elif re.search('\n----+$', output) != None:
output = ''
return output if output != "None" else None

def _get_python_path(self, name):
Expand Down

0 comments on commit e2a3e2d

Please sign in to comment.