forked from escherba/python-cityhash
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup.py
102 lines (88 loc) · 2.97 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
__author__ = "Alexander [Amper] Marshalov"
__email__ = "[email protected]"
__icq__ = "87-555-3"
__jabber__ = "[email protected]"
__twitter__ = "amper"
__url__ = "http://amper.github.com/cityhash"
from setuptools import setup
from setuptools.extension import Extension
from setuptools.dist import Distribution
import sys
try:
from Cython.Distutils import build_ext
except ImportError:
USE_CYTHON = False
else:
USE_CYTHON = True
class BinaryDistribution(Distribution):
"""
Subclass the setuptools Distribution to flip the purity flag to false.
See http://lucumr.pocoo.org/2014/1/27/python-on-wheels/
"""
def is_pure(self):
# TODO: check if this is still necessary with Python v2.7
return False
CXXFLAGS = None
# We need only CityHash128 from this package.
# Therefore -msse4.2 removed alongside with CityHashCrc256Long.
if sys.platform != 'win32':
CXXFLAGS = """
-O3
-Wno-unused-value
-Wno-unused-function
""".split()
INCLUDE_DIRS = ['include']
CMDCLASS = {}
EXT_MODULES = []
if USE_CYTHON:
EXT_MODULES.append(
Extension("clickhouse_cityhash.cityhash", ["src/city.cc", "src/cityhash.pyx"],
language="c++",
extra_compile_args=CXXFLAGS,
include_dirs=INCLUDE_DIRS)
)
CMDCLASS['build_ext'] = build_ext
else:
EXT_MODULES.append(
Extension("clickhouse_cityhash.cityhash", ["src/city.cc", "src/cityhash.cpp"],
language="c++",
extra_compile_args=CXXFLAGS,
include_dirs=INCLUDE_DIRS)
)
VERSION = '1.0.2.4'
URL = "https://github.com/xzkostyan/clickhouse-cityhash"
with open('README.rst', encoding='utf-8') as f:
LONG_DESCRIPTION = f.read()
setup(
version=VERSION,
description="Python-bindings for CityHash, a fast non-cryptographic hash algorithm",
author="Alexander [Amper] Marshalov",
author_email="[email protected]",
url=URL,
download_url=URL + "/tarball/master/" + VERSION,
name='clickhouse-cityhash',
license='MIT',
cmdclass=CMDCLASS,
ext_modules=EXT_MODULES,
keywords=['hash', 'hashing', 'cityhash'],
packages=['clickhouse_cityhash'],
classifiers=[
'Development Status :: 4 - Beta',
'Operating System :: OS Independent',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Programming Language :: C++',
'Programming Language :: Cython',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Topic :: Internet',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Utilities'
],
long_description=LONG_DESCRIPTION,
distclass=BinaryDistribution,
)