99
1010try :
1111 from cpuinfo import get_cpu_info
12- cpu_info = get_cpu_info ()
13- HAVE_SSE42 = 'sse4_2' in cpu_info ['flags' ]
12+ CPU_FLAGS = get_cpu_info ()['flags' ]
1413except Exception as exc :
15- HAVE_SSE42 = False
14+ CPU_FLAGS = {}
1615
1716try :
1817 from Cython .Distutils import build_ext
18+ USE_CYTHON = True
1919except ImportError :
20- build_ext = None
20+ USE_CYTHON = False
2121
2222
2323class BinaryDistribution (Distribution ):
@@ -30,16 +30,19 @@ def is_pure(self):
3030 return False
3131
3232
33- CXXFLAGS = ["-O3" ]
33+ CXXFLAGS = []
3434
35- if os .name != "nt" :
35+ if os .name == "nt" :
36+ CXXFLAGS .extend (["/O3" ])
37+ else :
3638 CXXFLAGS .extend ([
39+ "-O3" ,
3740 "-Wno-unused-value" ,
3841 "-Wno-unused-function" ,
3942 ])
4043
4144
42- if HAVE_SSE42 :
45+ if 'sse4_2' in CPU_FLAGS :
4346 warnings .warn ("Compiling with SSE4.2 enabled" )
4447 CXXFLAGS .append ('-msse4.2' )
4548else :
@@ -63,7 +66,7 @@ def is_pure(self):
6366CMDCLASS = {}
6467EXT_MODULES = []
6568
66- if build_ext is not None :
69+ if USE_CYTHON :
6770 CMDCLASS ['build_ext' ] = build_ext
6871 EXT_MODULES .append (
6972 Extension (
@@ -72,8 +75,9 @@ def is_pure(self):
7275 depends = CXXHEADERS ,
7376 language = "c++" ,
7477 extra_compile_args = CXXFLAGS ,
75- include_dirs = INCLUDE_DIRS )
78+ include_dirs = INCLUDE_DIRS ,
7679 )
80+ )
7781else :
7882 EXT_MODULES .append (
7983 Extension (
@@ -82,11 +86,12 @@ def is_pure(self):
8286 depends = CXXHEADERS ,
8387 language = "c++" ,
8488 extra_compile_args = CXXFLAGS ,
85- include_dirs = INCLUDE_DIRS )
89+ include_dirs = INCLUDE_DIRS ,
8690 )
91+ )
8792
8893
89- VERSION = '0.1.1.post0 '
94+ VERSION = '0.1.1.post1 '
9095URL = "https://github.com/escherba/python-metrohash"
9196
9297
@@ -116,7 +121,7 @@ def get_long_description():
116121 zip_safe = False ,
117122 cmdclass = CMDCLASS ,
118123 ext_modules = EXT_MODULES ,
119- keywords = ['hash' , 'hashing' , 'metrohash' , 'cityhash' ],
124+ keywords = ['hash' , 'hashing' , 'metrohash' ],
120125 classifiers = [
121126 'Development Status :: 5 - Production/Stable' ,
122127 'Intended Audience :: Developers' ,
0 commit comments