-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
38 lines (30 loc) · 1.05 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
from setuptools import setup, find_packages
from pathlib import Path
import re
# https://packaging.python.org/guides/single-sourcing-package-version/
root_dir = Path(__file__).parent
version_file = root_dir / 'VERSION'
package_name='a500'
def find_version(version_file):
# __file__ is the full path to setup.py
version_file = Path(__file__).parent / f'{package_name}/VERSION'
with open(version_file) as in_file:
version_string=in_file.read()
print(f"version string {version_string}")
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_string, re.M)
if version_match:
print(f"returning {version_match.group(1)}")
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
setup(
name = "a500",
version=find_version(version_file),
packages=find_packages(),
entry_points={
'console_scripts': [
'killprocs = a500.utils.killprocs:main',
'pyncdump = a500.utils.ncdump:main'
]
},
)