-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
66 lines (51 loc) · 1.76 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
from setuptools import setup, find_packages
from pathlib import Path
import sys
import warnings
def read_file(filename: str) -> str:
with open(Path(__file__).parent / filename, mode='r', encoding='utf-8') as f:
return f.read()
def get_package_info(package_name: str) -> dict:
package_info_dict = {}
with open(str(Path(__file__).parent / 'src' / package_name / 'package_info.py'), 'r') as f:
exec(f.read(), {}, package_info_dict)
return package_info_dict
PACKAGE_NAME = 'mlgixd'
package_info = get_package_info(PACKAGE_NAME)
__version__ = package_info['__version__']
__license__ = package_info['__license__']
__author__ = package_info['__author__']
__email__ = package_info['__email__']
classifiers = package_info['classifiers']
description = package_info['description']
long_description = read_file('README.md')
long_description_content_type = 'text/markdown'
entry_points = {
'console_scripts': [
'mlgixd = mlgixd:run',
],
}
python_requires = '>=3.6'
install_requires = read_file('requirements.txt').splitlines()
if sys.version_info.minor < 7:
install_requires.append('dataclasses')
python_version = ".".join(map(str, sys.version_info[:3]))
warnings.warn(
f'The package dataclasses is added to requirements for python version {python_version} < 3.7.x'
)
setup(
name=PACKAGE_NAME,
packages=find_packages('src'),
package_dir={'': 'src'},
version=__version__,
author=__author__,
author_email=__email__,
license=__license__,
description=description,
long_description=long_description,
long_description_content_type=long_description_content_type,
entry_points=entry_points,
python_requires=python_requires,
classifiers=classifiers,
install_requires=install_requires
)