-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
77 lines (69 loc) · 2.2 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
import os
def show_message(*lines):
print("=" * 74)
for line in lines:
print(line)
print("=" * 74)
with open('README.md', 'rt', encoding="utf8") as f:
readme = f.read()
setup_args = {
"name": "jarowinkler",
"version": "1.2.2",
"url": "https://github.com/maxbachmann/JaroWinkler",
"author": "Max Bachmann",
"author_email": "[email protected]",
"description": "library for fast approximate string matching using Jaro and Jaro-Winkler similarity",
"long_description": readme,
"long_description_content_type": "text/markdown",
"license": "MIT",
"classifiers": [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License"
],
"packages": ["jarowinkler"],
"package_dir": {'': 'src'},
"package_data": {"jarowinkler": ["*.pyi", "py.typed"]},
"python_requires": ">=3.6"
}
def run_setup(with_binary):
if with_binary:
from skbuild import setup
import rapidfuzz_capi
setup(
**setup_args,
cmake_args=[
f'-DRF_CAPI_PATH:STRING={rapidfuzz_capi.get_include()}'
]
)
else:
from setuptools import setup
setup(**setup_args)
# when packaging only build wheels which include the C extension
packaging = "1" in {
os.environ.get("CIBUILDWHEEL", "0"),
os.environ.get("CONDA_BUILD", "0"),
os.environ.get("JAROWINKLER_BUILD_EXTENSION", "0")
}
if packaging:
run_setup(True)
else:
try:
run_setup(True)
except:
show_message(
"WARNING: The C extension could not be compiled, speedups"
" are not enabled.",
"Failure information, if any, is above.",
"Retrying the build without the C extension now.",
)
run_setup(False)
show_message(
"WARNING: The C extension could not be compiled, speedups"
" are not enabled.",
"Plain-Python build succeeded.",
)