11
11
from setuptools .dist import Distribution
12
12
13
13
FORCE_EMULATION = False
14
+ USE_SSE2 = True if not '--no-sse2' in sys .argv else False
14
15
15
16
mod_dir = './randomstate'
16
17
configs = []
23
24
extra_defs = []
24
25
extra_link_args = ['Advapi32.lib' , 'Kernel32.lib' ] if os .name == 'nt' else []
25
26
base_extra_compile_args = [] if os .name == 'nt' else ['-std=c99' ]
27
+ if USE_SSE2 :
28
+ if os .name == 'nt' :
29
+ base_extra_compile_args += ['/arch:SSE2' ]
30
+ else :
31
+ base_extra_compile_args += ['-msse2' ]
26
32
27
33
28
34
def write_config (file_name , config ):
@@ -35,10 +41,10 @@ def write_config(file_name, config):
35
41
val = '"' + val + '"'
36
42
config .write ('DEF ' + key + ' = ' + str (val ) + '\n ' )
37
43
44
+
38
45
base_include_dirs = [mod_dir ] + [numpy .get_include ()]
39
46
if os .name == 'nt' and sys .version_info < (3 , 5 ):
40
- base_include_dirs += [join (mod_dir , 'src' , 'common' )]
41
-
47
+ base_include_dirs += [join (mod_dir , 'src' , 'common' )]
42
48
43
49
for rng in rngs :
44
50
if rng not in compile_rngs :
@@ -120,13 +126,10 @@ def write_config(file_name, config):
120
126
sources += [join (mod_dir , 'src' , 'dSFMT' , 'dSFMT.c' )]
121
127
sources += [join (mod_dir , 'shims' , 'dSFMT' , 'dSFMT-shim.c' )]
122
128
# TODO: HAVE_SSE2 should only be for platforms that have SSE2
123
- # TODO: But how to reliable detect?
124
- defs = [('DSFMT_RNG' , '1' ),('DSFMT_MEXP' ,'19937' )]
125
- defs += [('HAVE_SSE2' , '1' )]
126
- if os .name == 'nt' :
127
- extra_compile_args = base_extra_compile_args + ['/arch:SSE2' ]
128
- else :
129
- extra_compile_args = base_extra_compile_args + ['-msse2' ]
129
+ # TODO: But how to reliably detect?
130
+ defs = [('DSFMT_RNG' , '1' ), ('DSFMT_MEXP' , '19937' )]
131
+ if USE_SSE2 :
132
+ defs += [('HAVE_SSE2' , '1' )]
130
133
131
134
include_dirs += [join (mod_dir , 'src' , 'dSFMT' )]
132
135
@@ -140,12 +143,14 @@ def write_config(file_name, config):
140
143
141
144
configs .append (config )
142
145
146
+
143
147
class BinaryDistribution (Distribution ):
144
- def is_pure (self ):
145
- return False
148
+ def is_pure (self ):
149
+ return False
150
+
146
151
147
152
try :
148
- subprocess .call (['pandoc' ,'--from=markdown' ,'--to=rst' ,'--output=README.rst' ,'README.md' ])
153
+ subprocess .call (['pandoc' , '--from=markdown' , '--to=rst' , '--output=README.rst' , 'README.md' ])
149
154
except :
150
155
pass
151
156
# Generate files and extensions
@@ -181,11 +186,36 @@ def is_pure(self):
181
186
182
187
ext_modules = cythonize (extensions )
183
188
189
+ classifiers = ['Development Status :: 5 - Production/Stable' ,
190
+ 'Environment :: Console' ,
191
+ 'Intended Audience :: End Users/Desktop' ,
192
+ 'Intended Audience :: Financial and Insurance Industry' ,
193
+ 'Intended Audience :: Information Technology' ,
194
+ 'Intended Audience :: Science/Research' ,
195
+ 'License :: OSI Approved' ,
196
+ 'Operating System :: MacOS :: MacOS X' ,
197
+ 'Operating System :: Microsoft :: Windows' ,
198
+ 'Operating System :: POSIX :: Linux' ,
199
+ 'Operating System :: Unix' ,
200
+ 'Programming Language :: C' ,
201
+ 'Programming Language :: Cython' ,
202
+ 'Programming Language :: Python :: 2.6' ,
203
+ 'Programming Language :: Python :: 2.7' ,
204
+ 'Programming Language :: Python :: 3.3' ,
205
+ 'Programming Language :: Python :: 3.4' ,
206
+ 'Programming Language :: Python :: 3.5' ,
207
+ 'Topic :: Adaptive Technologies' ,
208
+ 'Topic :: Artistic Software' ,
209
+ 'Topic :: Office/Business :: Financial' ,
210
+ 'Topic :: Scientific/Engineering' ,
211
+ 'Topic :: Security :: Cryptography' ]
212
+
184
213
setup (name = 'randomstate' ,
185
214
version = '1.10' ,
215
+ classifiers = classifiers ,
186
216
packages = find_packages (),
187
217
package_dir = {'randomstate' : './randomstate' },
188
- package_data = {'' : ['*.c' ,'*.h' ,'*.pxi' ,'*.pyx' ,'*.pxd' ],
218
+ package_data = {'' : ['*.c' , '*.h' , '*.pxi' , '*.pyx' , '*.pxd' ],
189
219
'randomstate.tests.data' : ['*.csv' ]},
190
220
include_package_data = True ,
191
221
license = 'NSCA' ,
@@ -196,6 +226,8 @@ def is_pure(self):
196
226
url = 'https://github.com/bashtage/ng-numpy-randomstate' ,
197
227
long_description = open ('README.rst' ).read (),
198
228
ext_modules = ext_modules ,
229
+ keywords = ['pseudo random numbers' , 'PRNG' , 'RNG' , 'RandomState' , 'random' , 'random numbers' ,
230
+ 'parallel random numbers' , 'PCG' , 'XorShift' , 'dSFMT' , 'MT19937' ],
199
231
zip_safe = False )
200
232
201
233
# Clean up generated files
0 commit comments