-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
75 lines (64 loc) · 2.09 KB
/
setup.py
File metadata and controls
75 lines (64 loc) · 2.09 KB
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
#!/usr/bin/env python
#! coding: utf-8
import os
import sys
import io
import platform
import subprocess
from setuptools import setup, Extension
# avoid building universal binary (ppc) on osx non-ppc platforms
if sys.platform == 'darwin':
arch = platform.machine()
if arch in ('i386', 'x86_64'):
os.environ['ARCHFLAGS'] = '-arch x86_64'
extra_compile_args = ['-g', '-fPIC', '-Wall', '-O2']
VERSION = '0.2.5'
if not os.path.exists('smhasher'):
sys.stderr.write('run command:\ngit submodule update --init\n')
p = subprocess.Popen(args=['git', 'submodule', 'update', '--init'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
outs, errs = p.communicate()
p.wait()
sys.stderr.write(str(outs))
sys.stderr.write(str(errs))
here = os.path.abspath(os.path.dirname(__file__))
readme = os.path.join(here, 'README.rst')
try:
long_description = io.open(readme, mode='r', encoding='utf-8').read()
except (IOError, ImportError):
long_description = '' # never got here
cpp_files = [
'smhasher/MurmurHash2.cpp',
'smhasher/MurmurHash3.cpp',
'smhasher/City.cpp',
'pysmhasher.cpp'
]
pysmhasher_ext = Extension(
'pysmhasher',
sources=cpp_files,
include_dirs=['smhasher'],
define_macros=[('MODULE_VERSION', '"{}"'.format(VERSION))],
extra_compile_args=extra_compile_args
)
setup(
name='pysmhasher',
version=VERSION,
author='Yong Li',
author_email='hungrybirder@gmail.com',
url='https://github.com/hungrybirder/pysmhasher.git',
description='Python Extensions for SMHasher',
long_description=long_description,
keywords='hash hashing smhasher',
license='MIT',
ext_modules=[pysmhasher_ext],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
)