-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
65 lines (55 loc) · 1.81 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
from __future__ import annotations
import pathlib
import re
import sys
try:
from skbuild import setup
except ImportError:
print(
'Please update pip, you need pip 10 or greater,\n'
' or you need to install the PEP 518 requirements in pyproject.toml yourself',
file=sys.stderr,
)
raise
from setuptools import find_packages
BASE_DIR = pathlib.Path(__file__).resolve().parent
DESCRIPTION = 'A fast TSP solver with Python bindings'
def parse_version() -> str:
"""Returns the version specified in CMakeLists.txt"""
pattern = re.compile(r'project\(fast_tsp VERSION "([\d\.]+)"\)')
cmake_file = BASE_DIR / 'CMakeLists.txt'
lines = cmake_file.read_text(encoding='utf-8').splitlines()
for line in lines:
line_match = pattern.match(line)
if line_match:
return line_match.group(1)
raise RuntimeError('Could not parse version')
# Import the README and use it as the long-description.
try:
readme = BASE_DIR / 'README.md'
long_description = readme.read_text(encoding='utf-8')
except FileNotFoundError:
long_description = DESCRIPTION
VERSION = parse_version()
setup(
name='fast_tsp',
version=VERSION,
description=DESCRIPTION,
long_description=long_description,
long_description_content_type='text/markdown',
author='Soeren Mulvad',
author_email='shmulvad@gmail.com',
url='http://github.com/shmulvad/fast-tsp',
license='MIT',
packages=find_packages(where='src'),
package_dir={'': 'src'},
cmake_install_dir='src/fast_tsp',
package_data={'src': ['py.typed']},
include_package_data=True,
python_requires='>=3.8',
install_requires=['numpy>=1.0.0'],
extras_require={
'test': ['pytest', 'numpy'],
'docs': ['sphinx', 'sphinx-rtd-theme', 'sphinx-autodoc-typehints'],
},
)