@@ -33,6 +33,10 @@ def write_config(file_name, config):
33
33
val = '"' + val + '"'
34
34
config .write ('DEF ' + key + ' = ' + str (val ) + '\n ' )
35
35
36
+ base_include_dirs = [mod_dir ] + [numpy .get_include ()]
37
+ if os .name == 'nt' and sys .version_info < (3 , 5 ):
38
+ base_include_dirs += [join (mod_dir , 'src' , 'common' )]
39
+
36
40
37
41
for rng in rngs :
38
42
if rng not in compile_rngs :
@@ -43,9 +47,7 @@ def write_config(file_name, config):
43
47
sources = [join (mod_dir , file_name + '.pyx' ),
44
48
join (mod_dir , 'src' , 'common' , 'entropy.c' ),
45
49
join (mod_dir , 'distributions.c' )]
46
- include_dirs = [mod_dir ] + [numpy .get_include ()]
47
- if os .name == 'nt' and sys .version_info < (3 , 5 ):
48
- include_dirs += [join (mod_dir , 'src' , 'common' )]
50
+ include_dirs = base_include_dirs [:]
49
51
50
52
if rng == 'RNG_PCG32' :
51
53
sources += [join (mod_dir , 'src' , 'pcg' , 'pcg32.c' )]
@@ -120,13 +122,13 @@ def write_config(file_name, config):
120
122
configs .append (config )
121
123
122
124
# Generate files and extensions
123
- extensions = cythonize ( [Extension ('randomstate.entropy' ,
124
- sources = [join (mod_dir , 'entropy.pyx' ),
125
- join (mod_dir , 'src' , 'common' , 'entropy.c' )],
126
- include_dirs = config [ 'include_dirs' ] ,
127
- define_macros = extra_defs ,
128
- extra_compile_args = extra_compile_args ,
129
- extra_link_args = extra_link_args )])
125
+ extensions = [Extension ('randomstate.entropy' ,
126
+ sources = [join (mod_dir , 'entropy.pyx' ),
127
+ join (mod_dir , 'src' , 'common' , 'entropy.c' )],
128
+ include_dirs = base_include_dirs ,
129
+ define_macros = extra_defs ,
130
+ extra_compile_args = extra_compile_args ,
131
+ extra_link_args = extra_link_args )]
130
132
131
133
for config in configs :
132
134
config_file_name = mod_dir + '/' + config ['file_name' ] + '-config.pxi'
@@ -142,15 +144,16 @@ def write_config(file_name, config):
142
144
write_config (config_file_name , config )
143
145
shutil .copystat (join (mod_dir , 'interface.pyx' ), config_file_name )
144
146
145
- ext = \
146
- cythonize ([Extension ('randomstate.prng.' + config ['file_name' ] + '.' + config ['file_name' ],
147
- sources = config ['sources' ],
148
- include_dirs = config ['include_dirs' ],
149
- define_macros = config ['defs' ] + extra_defs ,
150
- extra_compile_args = extra_compile_args ,
151
- extra_link_args = extra_link_args )])[0 ]
147
+ ext = Extension ('randomstate.prng.' + config ['file_name' ] + '.' + config ['file_name' ],
148
+ sources = config ['sources' ],
149
+ include_dirs = config ['include_dirs' ],
150
+ define_macros = config ['defs' ] + extra_defs ,
151
+ extra_compile_args = extra_compile_args ,
152
+ extra_link_args = extra_link_args )
152
153
extensions .append (ext )
153
154
155
+ ext_modules = cythonize (extensions )
156
+
154
157
setup (name = 'randomstate' ,
155
158
version = '0.1' ,
156
159
packages = find_packages (),
@@ -162,7 +165,7 @@ def write_config(file_name, config):
162
165
description = 'Next-gen RandomState supporting multiple PRNGs' ,
163
166
url = 'https://github.com/bashtage/ng-numpy-randomstate' ,
164
167
long_description = open ('README.md' ).read (),
165
- ext_modules = extensions ,
168
+ ext_modules = ext_modules ,
166
169
zip_safe = False )
167
170
168
171
# Clean up generated files
0 commit comments