Skip to content

Commit 9bbd36d

Browse files
committed
v0.2.1
1 parent 87edc58 commit 9bbd36d

4 files changed

Lines changed: 39 additions & 25 deletions

File tree

pip-freeze.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ attrs==21.4.0
22
backcall==0.2.0
33
Cython==0.29.26
44
decorator==5.1.0
5-
importlib-metadata==4.10.0
65
iniconfig==1.1.1
76
ipdb==0.13.9
87
ipython==7.30.1
98
jedi==0.18.1
109
matplotlib-inline==0.1.3
11-
-e git+https://github.com/escherba/python-metrohash@c5c37595134dcb929a5fa8fcaf3fb64d4d987ef4#egg=metrohash
12-
numpy==1.21.5
10+
-e git+https://github.com/escherba/python-metrohash@87edc58d0a222d0b7a94f9497c3cc035296be72b#egg=metrohash
11+
numpy==1.22.0
1312
packaging==21.3
1413
parso==0.8.3
1514
pexpect==4.8.0
@@ -24,6 +23,4 @@ pyparsing==3.0.6
2423
pytest==6.2.5
2524
toml==0.10.2
2625
traitlets==5.1.1
27-
typing_extensions==4.0.1
2826
wcwidth==0.2.5
29-
zipp==3.7.0

setup.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import os
4+
import struct
45
from os.path import join, dirname
56

67
from setuptools import setup
@@ -34,13 +35,23 @@ def is_pure(self):
3435
return False
3536

3637

38+
def get_system_bits():
39+
"""Return 32 for 32-bit systems and 64 for 64-bit"""
40+
return struct.calcsize("P") * 8
41+
42+
43+
SYSTEM = os.name
44+
BITS = get_system_bits()
45+
HAVE_SSE42 = "sse4_2" in CPU_FLAGS
46+
HAVE_AES = "aes" in CPU_FLAGS
47+
3748
CXXFLAGS = []
3849

39-
print("building on platform:", os.name)
50+
print("system: %s-%d" % (SYSTEM, BITS))
4051
print("available CPU flags:", CPU_FLAGS)
4152
print("environment:", ", ".join(["%s=%s" % (k, v) for k, v in os.environ.items()]))
4253

43-
if os.name == "nt":
54+
if SYSTEM == "nt":
4455
CXXFLAGS.extend(["/O2"])
4556
else:
4657
CXXFLAGS.extend(
@@ -53,18 +64,23 @@ def is_pure(self):
5364

5465
# The "cibuildwheel" tool sets the variable below to
5566
# something like x86_64, aarch64, i686, and so on.
56-
ARCH = os.environ.get("AUDITWHEEL_ARCH")
67+
TARGET_ARCH = os.environ.get("AUDITWHEEL_ARCH")
5768

58-
# Note: Only -msse4.2 has significant effect on performance;
59-
# so not using other flags such as -maes and -mavx
60-
if "sse4_2" in CPU_FLAGS:
61-
if (ARCH in [None, "x86_64"]) and (os.name != "nt"):
62-
print("enabling SSE4.2 on compile")
69+
if HAVE_SSE42 and (TARGET_ARCH in [None, "x86_64"]) and (BITS == 64):
70+
print("enabling SSE4.2 on compile")
71+
if SYSTEM == "nt":
72+
CXXFLAGS.append("/D__SSE4_2__")
73+
else:
6374
CXXFLAGS.append("-msse4.2")
64-
else:
65-
print("the CPU does not appear to support SSE4.2")
6675

6776

77+
if HAVE_AES and (TARGET_ARCH in [None, "x86_64"]) and (BITS == 64):
78+
print("enabling AES on compile")
79+
if SYSTEM == "nt":
80+
CXXFLAGS.append("/D__AES__")
81+
else:
82+
CXXFLAGS.append("-maes")
83+
6884
CXXHEADERS = [
6985
"src/metro.h",
7086
"src/metrohash.h",
@@ -78,6 +94,7 @@ def is_pure(self):
7894
"src/metrohash128.cc",
7995
]
8096

97+
8198
if USE_CYTHON:
8299
print("building extension using Cython")
83100
CMDCLASS = {"build_ext": build_ext}
@@ -99,7 +116,7 @@ def is_pure(self):
99116
),
100117
]
101118

102-
VERSION = "0.2.0.post1"
119+
VERSION = "0.2.1"
103120
URL = "https://github.com/escherba/python-metrohash"
104121

105122

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.2.0"
13+
__version__ = "0.2.1"
1414
__all__ = [
1515
"MetroHash64",
1616
"MetroHash128",

0 commit comments

Comments
 (0)