Skip to content

Commit 1d6d1de

Browse files
authored
update setup.py (#14)
1 parent 3111bd1 commit 1d6d1de

5 files changed

Lines changed: 28 additions & 23 deletions

File tree

pip-freeze.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ipdb==0.13.9
1010
ipython==7.30.1
1111
jedi==0.18.1
1212
matplotlib-inline==0.1.3
13-
-e git+https://github.com/escherba/python-metrohash@35159617ba4106c99b82701267441c73aca4b951#egg=metrohash
13+
-e git+https://github.com/escherba/python-metrohash@c0d6ef1dac61d9cfb3cba5bb8533f69df3c445e6#egg=metrohash
1414
numpy==1.21.5
1515
packaging==21.3
1616
parso==0.8.3

python.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ env/bin/activate: setup.py requirements.txt
8282
test -f $@ || virtualenv $(VENV_OPTS) env
8383
export SETUPTOOLS_USE_DISTUTILS=stdlib; $(PYENV) curl https://bootstrap.pypa.io/ez_setup.py | $(INTERPRETER)
8484
$(PIP) install -U pip wheel
85-
$(PIP) install -r requirements.txt
85+
export SETUPTOOLS_USE_DISTUTILS=stdlib; $(PIP) install -r requirements.txt
8686
$(PIP) install -e .
8787
$(PIP) freeze > pip-freeze.txt
8888
touch $@

setup.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
try:
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']
1413
except Exception as exc:
15-
HAVE_SSE42 = False
14+
CPU_FLAGS = {}
1615

1716
try:
1817
from Cython.Distutils import build_ext
18+
USE_CYTHON = True
1919
except ImportError:
20-
build_ext = None
20+
USE_CYTHON = False
2121

2222

2323
class 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')
4548
else:
@@ -63,7 +66,7 @@ def is_pure(self):
6366
CMDCLASS = {}
6467
EXT_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+
)
7781
else:
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'
9095
URL = "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',

src/metrohash.cpp

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/metrohash.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Python wrapper for MetroHash, a fast non-cryptographic hashing algorithm
1010

1111
__author__ = "Eugene Scherba"
1212
__email__ = "escherba+metrohash@gmail.com"
13-
__version__ = "0.1.1.post0"
13+
__version__ = "0.1.1.post1"
1414
__all__ = [
1515
"metrohash64",
1616
"metrohash128",

0 commit comments

Comments
 (0)