-
Notifications
You must be signed in to change notification settings - Fork 79
/
setup.py
68 lines (62 loc) · 2.42 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
import os.path
from setuptools import setup, Extension
import platform
try:
import numpy
except ImportError as e:
print("=" * 80)
print("You need to install numpy *separately* and *before* installing this package(s).")
print("=" * 80)
raise e from None
with open(os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf-8") as f:
long_description = f.read()
PACKAGE = "wmd"
CXX_FLAGS = {
"Darwin": ["-std=c++11", "-march=native", "-ftree-vectorize", "-DNDEBUG",
"-Wno-sign-compare", "-fPIC", "-flto"],
"Linux": ["-fopenmp", "-std=c++11", "-march=native", "-ftree-vectorize",
"-DNDEBUG", "-Wno-sign-compare", "-fPIC", "-flto"],
"Windows": ["/openmp", "/std:c++latest", "/arch:AVX2", "/DNDEBUG", "/LTCG",
"/GL"]
}
LD_FLAGS = {
"Darwin": ["-fPIC", "-flto"],
"Linux": ["-fPIC", "-flto"],
"Windows": ["/LTCG", "/GL"]
}
setup(
name=PACKAGE,
description="Accelerated functions to calculate Word Mover's Distance",
long_description=long_description,
long_description_content_type="text/markdown",
version="1.3.2",
license="Apache Software License",
author="source{d}",
author_email="[email protected]",
url="https://github.com/src-d/wmd-relax",
download_url="https://github.com/src-d/wmd-relax",
ext_modules=[Extension("libwmdrelax", sources=[
"python.cc", "or-tools/src/graph/min_cost_flow.cc",
"or-tools/src/graph/max_flow.cc", "or-tools/src/base/stringprintf.cc",
"or-tools/src/base/logging.cc", "or-tools/src/base/sysinfo.cc",
"or-tools/src/util/stats.cc"],
extra_compile_args=CXX_FLAGS[platform.system()],
extra_link_args=LD_FLAGS[platform.system()],
include_dirs=[numpy.get_include(), "or-tools/src"])],
packages=[PACKAGE],
setup_requires=["numpy"], # does not really help - we need it to get_include()
install_requires=["numpy"],
classifiers=[
"Development Status :: 5 - Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Topic :: Scientific/Engineering :: Information Analysis",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6"
]
)
# python3 setup.py bdist_wheel
# auditwheel repair -w dist dist/*
# twine upload dist/*manylinux*