forked from seomoz/simhash-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·55 lines (46 loc) · 1.46 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
#! /usr/bin/env python
from __future__ import print_function
from distutils.core import setup
from distutils.extension import Extension
# Complain on 32-bit systems. See README for more details
import struct
if struct.calcsize("P") < 8:
raise RuntimeError("Simhash-py does not work on 32-bit systems. See README.md")
ext_files = ["simhash/simhash-cpp/src/permutation.cpp", "simhash/simhash-cpp/src/simhash.cpp"]
kwargs = {}
try:
from Cython.Distutils import build_ext
print("Building from Cython")
ext_files.append("simhash/simhash.pyx")
kwargs["cmdclass"] = {"build_ext": build_ext}
except ImportError:
print("Buidling from C++")
ext_files.append("simhash/simhash.cpp")
ext_modules = [
Extension(
"simhash.simhash",
ext_files,
language="c++",
extra_compile_args=["-std=c++11"],
include_dirs=["simhash/simhash-cpp/include"],
)
]
setup(
name="simhash-py",
version="0.4.2",
description="Near-Duplicate Detection with Simhash",
url="http://github.com/seomoz/simhash-py",
author="Moz, Inc.",
author_email="turbo@moz.com",
classifiers=[
"Programming Language :: Python",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Topic :: Internet :: WWW/HTTP",
],
ext_modules=ext_modules,
packages=["simhash"],
package_dir={"simhash": "simhash"},
tests_require=["coverage", "nose", "nose-timer", "rednose"],
**kwargs
)