-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
46 lines (41 loc) · 1.3 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
from distutils.core import setup
from setuptools import find_packages
import json
from pathlib import Path
from typing import Optional
def get_version_info():
""" Retrieve version info from setup.json.
"""
base_path = Path(__file__).parent.absolute()
base_path /= 'setup.json'
with open(base_path.as_posix(), 'r') as rf:
release_data = json.load(rf)
return release_data
def write_version_py():
""" Writes attlib/version.py.
"""
base_path = Path(__file__).parent.absolute()
filename = base_path / 'attlib' / 'version.py'
release_data = get_version_info()
version_info_string = "# THIS FILE IS GENERATED FROM ATT SETUP.PY."
for key in release_data:
version_info_string += f"\n{key} = '{release_data[key]}'"
with open(filename.as_posix(), 'w') as wf:
wf.write(version_info_string)
return release_data
data = write_version_py()
setup(
name=data["name"],
version=data["version"],
description=data["description"],
author=data["author"],
author_email=data["email"],
url=data["url"],
download_url=data["download_url"],
license="LICENSE",
install_requires=[],
data_files=[("", ["LICENSE"])],
package_data={"": ["setup.json", '*.ini',]},
scripts=[],
packages=find_packages(exclude=["scripts"]),
)