1111from setuptools .dist import Distribution
1212
1313FORCE_EMULATION = False
14+ USE_SSE2 = True if not '--no-sse2' in sys .argv else False
1415
1516mod_dir = './randomstate'
1617configs = []
2324extra_defs = []
2425extra_link_args = ['Advapi32.lib' , 'Kernel32.lib' ] if os .name == 'nt' else []
2526base_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' ]
2632
2733
2834def write_config (file_name , config ):
@@ -35,10 +41,10 @@ def write_config(file_name, config):
3541 val = '"' + val + '"'
3642 config .write ('DEF ' + key + ' = ' + str (val ) + '\n ' )
3743
44+
3845base_include_dirs = [mod_dir ] + [numpy .get_include ()]
3946if 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' )]
4248
4349for rng in rngs :
4450 if rng not in compile_rngs :
@@ -120,13 +126,10 @@ def write_config(file_name, config):
120126 sources += [join (mod_dir , 'src' , 'dSFMT' , 'dSFMT.c' )]
121127 sources += [join (mod_dir , 'shims' , 'dSFMT' , 'dSFMT-shim.c' )]
122128 # 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' )]
130133
131134 include_dirs += [join (mod_dir , 'src' , 'dSFMT' )]
132135
@@ -140,12 +143,14 @@ def write_config(file_name, config):
140143
141144 configs .append (config )
142145
146+
143147class BinaryDistribution (Distribution ):
144- def is_pure (self ):
145- return False
148+ def is_pure (self ):
149+ return False
150+
146151
147152try :
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' ])
149154except :
150155 pass
151156# Generate files and extensions
@@ -181,11 +186,36 @@ def is_pure(self):
181186
182187ext_modules = cythonize (extensions )
183188
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+
184213setup (name = 'randomstate' ,
185214 version = '1.10' ,
215+ classifiers = classifiers ,
186216 packages = find_packages (),
187217 package_dir = {'randomstate' : './randomstate' },
188- package_data = {'' : ['*.c' ,'*.h' ,'*.pxi' ,'*.pyx' ,'*.pxd' ],
218+ package_data = {'' : ['*.c' , '*.h' , '*.pxi' , '*.pyx' , '*.pxd' ],
189219 'randomstate.tests.data' : ['*.csv' ]},
190220 include_package_data = True ,
191221 license = 'NSCA' ,
@@ -196,6 +226,8 @@ def is_pure(self):
196226 url = 'https://github.com/bashtage/ng-numpy-randomstate' ,
197227 long_description = open ('README.rst' ).read (),
198228 ext_modules = ext_modules ,
229+ keywords = ['pseudo random numbers' , 'PRNG' , 'RNG' , 'RandomState' , 'random' , 'random numbers' ,
230+ 'parallel random numbers' , 'PCG' , 'XorShift' , 'dSFMT' , 'MT19937' ],
199231 zip_safe = False )
200232
201233# Clean up generated files
0 commit comments