File tree 2 files changed +17
-13
lines changed
2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ build-pkg:
34
34
35
35
build-ext :
36
36
@echo " \033[1m>> Building extension... <<\033[0m"
37
- @STOCK_PANDAS_BUILDING =1 python setup.py build_ext --inplace
37
+ @STOCK_PANDAS_BUILDING_EXT =1 python setup.py build_ext --inplace
38
38
39
39
build-doc :
40
40
sphinx-build -b html docs build_docs
Original file line number Diff line number Diff line change 9
9
10
10
import numpy as np
11
11
12
- BUILDING = os .environ .get ('STOCK_PANDAS_BUILDING ' )
12
+ BUILDING_EXT = os .environ .get ('STOCK_PANDAS_BUILDING_EXT ' )
13
13
14
14
ext_kwargs = dict (
15
15
# Ignore warning caused by cpython for using deprecated apis
19
19
20
20
# Distribution ref
21
21
# https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#distributing-cython-modules
22
- if BUILDING :
22
+ if BUILDING_EXT :
23
23
from Cython .Build import cythonize
24
24
extensions = cythonize (
25
25
Extension (
33
33
'language_level' : 3
34
34
}
35
35
)
36
+
37
+ # When packaging the package, use the pre-compiled c++ file
36
38
else :
37
39
extensions = [
38
40
Extension (
42
44
)
43
45
]
44
46
45
- setup (
46
- ext_modules = extensions ,
47
- packages = [
48
- 'stock_pandas' ,
49
- 'stock_pandas.commands' ,
50
- 'stock_pandas.directive' ,
51
- 'stock_pandas.math' ,
52
- 'stock_pandas.meta'
53
- ]
54
- )
47
+ # Only run setup when building the package
48
+ if __name__ == '__main__' :
49
+ setup (
50
+ ext_modules = extensions ,
51
+ packages = [
52
+ 'stock_pandas' ,
53
+ 'stock_pandas.commands' ,
54
+ 'stock_pandas.directive' ,
55
+ 'stock_pandas.math' ,
56
+ 'stock_pandas.meta'
57
+ ]
58
+ )
You can’t perform that action at this time.
0 commit comments