Skip to content

Commit 32c84c0

Browse files
committed
handle conda build
1 parent 176c1fe commit 32c84c0

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

setup.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,24 @@
3333

3434
import versioneer
3535

36-
try:
37-
import Cython
38-
except ImportError:
39-
raise Exception("Install Cython before zipline.")
4036

41-
try:
42-
import numpy as np
43-
except ImportError:
44-
raise Exception("Install numpy before zipline.")
37+
conda_build = os.path.basename(sys.argv[0]) in ('conda-build', # unix
38+
'conda-build-script.py') # win
39+
40+
if conda_build:
41+
NumpyExtension = Extension
42+
else:
43+
try:
44+
import Cython
45+
except ImportError:
46+
raise Exception("Install Cython before zipline.")
4547

48+
try:
49+
import numpy as np
50+
except ImportError:
51+
raise Exception("Install numpy before zipline.")
4652

47-
NumpyExtension = partial(Extension, include_dirs=[np.get_include()])
53+
NumpyExtension = partial(Extension, include_dirs=[np.get_include()])
4854

4955

5056
def window_specialization(typename):
@@ -240,9 +246,6 @@ def setup_requirements(requirements_path, module_names, strict_bounds,
240246
return module_lines
241247

242248

243-
conda_build = os.path.basename(sys.argv[0]) in ('conda-build', # unix
244-
'conda-build-script.py') # win
245-
246249
setup_requires = setup_requirements(
247250
'etc/requirements.txt',
248251
('Cython', 'numpy'),

0 commit comments

Comments
 (0)