Skip to content

Commit 7764061

Browse files
committed
support conda python
1 parent 88fc77a commit 7764061

2 files changed

Lines changed: 49 additions & 21 deletions

File tree

build/config-mac.def

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# set PY_DEFAULT=0 if you manually installed Python on your system
2-
# (overriding the one that came with OS X by default)
3-
PY_DEFAULT=1
1+
# which kind of Python installation to use
2+
# system - macOS system default
3+
# local - local installation
4+
# conda - conda environment; specify the environment root dir using the
5+
# PY_CONDA_ROOT environment variable
6+
PY_KIND=conda
47

58
#########################################################################
69

@@ -11,15 +14,15 @@ PY_DEFAULT=1
1114
# Mac OSX 10.6 -> default Python version (major.minor) = 2.6
1215

1316
PY_MAJOR_VERSION=2
14-
PY_MINOR_VERSION=6
17+
PY_MINOR_VERSION=7
1518

1619
#########################################################################
1720

1821
# uncomment if numpy/numarray/numeric support should be compiled in
1922
# for info see http://numeric.scipy.org
2023
# numarray and numeric are outdated
2124

22-
# PY_NUMPY=1
25+
PY_NUMPY=1
2326
# PY_NUMARRAY=1
2427
# PY_NUMERIC=1
2528

build/gnumake-mac-gcc.inc

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,67 @@
1+
DEFS += -DPY_EXPORTS
2+
3+
ifdef PY_NUMPY
4+
DEFS += -DPY_NUMPY
5+
endif
6+
7+
ifdef PY_NUMARRAY
8+
DEFS += -DPY_NUMARRAY
9+
endif
10+
11+
ifdef PY_NUMERIC
12+
DEFS += -DPY_NUMERIC
13+
endif
14+
15+
ifdef PY_USE_GIL
16+
DEFS += -DPY_USE_GIL
17+
endif
18+
19+
ifdef PY_USE_INOFFICIAL
20+
DEFS += -DPY_USE_INOFFICIAL
21+
endif
22+
23+
ifeq ($(PY_KIND),conda)
24+
25+
ifndef PY_CONDA_ROOT
26+
$(error PY_CONDA_ROOT is undefined)
27+
endif
28+
29+
LIBS += $(PY_CONDA_ROOT)/lib/libpython$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION).dylib
30+
INCPATH += -I$(PY_CONDA_ROOT)/include
31+
INCPATH += -I$(PY_CONDA_ROOT)/include/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
32+
33+
ifdef PY_NUMPY
34+
INCPATH += -I$(PY_CONDA_ROOT)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
35+
endif
36+
37+
else
38+
139
# don't use -framework Python, since this will stick to the default system version
240
341
_LOCAL_FRAMEWORK := /Library/Frameworks/Python.framework/Versions/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
442
_SYSTEM_FRAMEWORK := /System/Library/Frameworks/Python.framework/Versions/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
543
_LOCAL_LIBRARY := /Library/Python/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
644
_SYSTEM_LIBRARY := /System/Library/Python/$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)
745
8-
DEFS += -DPY_EXPORTS
946
INCPATH += -F/Library/Frameworks -framework Python
1047
11-
ifeq ($(PY_DEFAULT),1)
48+
ifeq ($(PY_KIND),system)
1249
LIBS += $(_SYSTEM_FRAMEWORK)/Python
1350
INCPATH += -I$(_SYSTEM_FRAMEWORK)/Headers
1451
else
1552
LIBS += $(_LOCAL_FRAMEWORK)/Python
1653
INCPATH += -I$(_LOCAL_FRAMEWORK)/Headers
1754
endif
1855
19-
ifdef PY_NUMARRAY
20-
DEFS += -DPY_NUMARRAY
21-
endif
2256
ifdef PY_NUMPY
23-
DEFS += -DPY_NUMPY
2457
INCPATH += -I$(_LOCAL_LIBRARY)/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
25-
ifeq ($(PY_DEFAULT),1)
58+
59+
ifeq ($(PY_KIND),system)
2660
INCPATH += -I$(_SYSTEM_FRAMEWORK)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
2761
INCPATH += -I$(_SYSTEM_FRAMEWORK)/Extras/lib/python/numpy/core/include
2862
else
2963
INCPATH += -I$(_LOCAL_FRAMEWORK)/lib/python$(PY_MAJOR_VERSION).$(PY_MINOR_VERSION)/site-packages/numpy/core/include
3064
endif
3165
endif
32-
ifdef PY_NUMERIC
33-
DEFS += -DPY_NUMERIC
34-
endif
3566
36-
ifdef PY_USE_GIL
37-
DEFS += -DPY_USE_GIL
38-
endif
39-
40-
ifdef PY_USE_INOFFICIAL
41-
DEFS += -DPY_USE_INOFFICIAL
4267
endif

0 commit comments

Comments
 (0)