14
14
15
15
URL = "https://github.com/hungpham2511/toppra"
16
16
17
-
18
17
# setup requirements
19
18
if sys .version [0 ] == '2' :
20
19
with open ("requirements.txt" , "r" ) as f :
21
- REQUIRES = ["scipy==0.18.0" , "numpy" , "matplotlib" ,
22
- # only required on python2.7
23
- "pathlib2" , "enum34" , "strip_hints" , "typing" ]
20
+ REQUIRES = [
21
+ "scipy==0.18.0" ,
22
+ "numpy" ,
23
+ "matplotlib" ,
24
+ # only required on python2.7
25
+ "pathlib2" ,
26
+ "enum34" ,
27
+ "strip_hints" ,
28
+ "typing"
29
+ ]
24
30
DEV_REQUIRES = [line .strip () for line in f if line .strip ()]
25
31
else :
26
32
with open ("requirements3.txt" , "r" ) as f :
33
39
LICENSE = "MIT"
34
40
35
41
SRC_DIR = "toppra"
36
- PACKAGES = ["toppra" ,
37
- "toppra.constraint" ,
38
- "toppra.algorithm" ,
39
- "toppra.algorithm.reachabilitybased" ,
40
- "toppra.solverwrapper" ,
41
- "toppra.cpp" ]
42
-
43
- ext_1 = Extension (SRC_DIR + "._CythonUtils" ,
44
- [SRC_DIR + "/_CythonUtils.pyx" ],
45
- extra_compile_args = ['-O1' ],
42
+ PACKAGES = [
43
+ "toppra" , "toppra.constraint" , "toppra.algorithm" ,
44
+ "toppra.algorithm.reachabilitybased" , "toppra.solverwrapper" , "toppra.cpp"
45
+ ]
46
+
47
+ ext_1 = Extension (SRC_DIR + "._CythonUtils" , [SRC_DIR + "/_CythonUtils.pyx" ],
48
+ extra_compile_args = ['-O2' ],
46
49
libraries = [],
47
50
include_dirs = [np .get_include ()])
48
51
60
63
# custom install command: strip type-hints before installing toppra
61
64
# for python2.7 and pthon3.5
62
65
class install2 (install ):
66
+
63
67
def run (self , * args , ** kwargs ):
64
68
# stripping
65
69
if sys .version [0 ] == '2' or sys .version [:3 ] == '3.5' :
66
70
from strip_hints import strip_file_to_string
67
71
import glob
68
72
import os .path
73
+
69
74
def process_file (f ):
70
75
print (os .path .abspath (f ))
71
76
out = strip_file_to_string (f )
72
77
with open (f , 'w' ) as fh :
73
78
fh .write (out )
79
+
74
80
for f in glob .glob ("%s/*/toppra/*/*.py" % self .build_base ):
75
81
process_file (f )
76
82
for f in glob .glob ("%s/*/toppra/*.py" % self .build_base ):
@@ -89,11 +95,11 @@ def process_file(f):
89
95
setup_requires = ["numpy" , "cython" ],
90
96
extras_require = {
91
97
# Dependencies installed when running `pip install -e .[dev]`
92
-
98
+
93
99
# NOTE: This is deprecated in favour of the simpler workflow
94
100
# of installing from requirements3.txt before installing
95
101
# this pkg.
96
- 'dev' : DEV_REQUIRES
102
+ 'dev' : DEV_REQUIRES
97
103
},
98
104
packages = PACKAGES ,
99
105
zip_safe = False ,
@@ -107,12 +113,14 @@ def process_file(f):
107
113
url = URL ,
108
114
license = LICENSE ,
109
115
110
- # This is used to build the Cython modules. Will be run
116
+ # This is used to build the Cython modules. Will be run
111
117
# automatically if not found by pip. Otherwise run
112
118
#
113
119
# python setup.py build
114
120
#
115
121
# to trigger manually.
116
- cmdclass = {"build_ext" : build_ext , "install" : install2 },
117
- ext_modules = cythonize (EXTENSIONS )
118
- )
122
+ cmdclass = {
123
+ "build_ext" : build_ext ,
124
+ "install" : install2
125
+ },
126
+ ext_modules = cythonize (EXTENSIONS ))
0 commit comments