File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 15
15
import numpy
16
16
from setuptools import Extension , setup
17
17
18
-
19
18
def get_boost_libraries ():
19
+ # Force the use of the conda-installed Boost.Python library.
20
+ conda_prefix = os .environ .get ("CONDA_PREFIX" )
21
+ if not conda_prefix :
22
+ raise EnvironmentError ("CONDA_PREFIX is not set. Please activate your conda environment." )
23
+ if os .name == "nt" :
24
+ lib_dir = Path (conda_prefix ) / "Library" / "lib"
25
+ else :
26
+ lib_dir = Path (conda_prefix ) / "lib"
20
27
base_lib = "boost_python"
21
28
major , minor = str (sys .version_info [0 ]), str (sys .version_info [1 ])
22
29
tags = [f"{ major } { minor } " , major , "" ]
23
30
mttags = ["" , "-mt" ]
24
- candidates = [base_lib + tag for tag in tags for mt in mttags ] + [base_lib ]
31
+ candidates = [base_lib + tag + mt for tag in tags for mt in mttags ] + [base_lib ]
25
32
for lib in candidates :
26
- if find_library (lib ):
33
+ # Check for common shared library extensions.
34
+ if any ((lib_dir / (lib + ext )).exists () for ext in [".so" , ".dylib" , ".dll" , ".lib" ]):
27
35
return [lib ]
28
- raise RuntimeError ("Cannot find a suitable Boost.Python library." )
36
+ raise RuntimeError ("Cannot find a suitable Boost.Python library in your conda environment ." )
29
37
30
38
31
39
def get_boost_config ():
You can’t perform that action at this time.
0 commit comments