forked from intel/e2eAIOK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
100 lines (96 loc) · 4.5 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.install import install
try:
# pip >=20
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements
except ImportError:
try:
# 10.0.0 <= pip <= 19.3.1
from pip._internal.download import PipSession
from pip._internal.req import parse_requirements
except ImportError:
# pip <= 9.0.3
from pip.download import PipSession
from pip.req import parse_requirements
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
e2eaiok_home = os.path.join(os.path.dirname(os.path.abspath(__file__)), "e2eAIOK")
VERSION = open(os.path.join(e2eaiok_home, "version"), 'r').read().strip()
def setup_package(args):
metadata = dict(
name=args["name"],
version=VERSION,
author="INTEL",
license='Apache License',
description="Intel® End-to-End AI Optimization Kit",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/intel/e2eAIOK",
project_urls={
"Bug Tracker": "https://github.com/intel/e2eAIOK/issues",
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
packages=args["packages"],
package_data = args["package_data"],
python_requires=">=3.6",
zip_safe=False,
cmdclass=args.get("cmdclass", {}),
install_requires=args["install_requires"]
)
setup(**metadata)
if __name__ == '__main__':
args = dict(
name = "e2eAIOK",
packages = find_packages(exclude=["RecDP", "RecDP.*", "modelzoo", "example"]),
install_requires = [],
package_data = {}
)
if "--denas" in sys.argv:
args["name"] = "e2eAIOK-denas"
args["packages"] = find_packages(exclude=["RecDP", "RecDP.*", "modelzoo", "example", \
"e2eAIOK.SDA", "e2eAIOK.SDA.*", "e2eAIOK.dataloader", "e2eAIOK.utils",\
"e2eAIOK.ModelAdapter", "e2eAIOK.ModelAdapter.*"])
args["package_data"] = {'e2eAIOK': ['version','common/default.conf']}
install_reqs = parse_requirements("e2eAIOK/DeNas/requirements.txt", session=False)
# handle pip version compatibility
try:
args["install_requires"] = [str(ir.req) for ir in install_reqs]
except AttributeError:
args["install_requires"] = [str(ir.requirement) for ir in install_reqs]
sys.argv.remove("--denas")
elif "--sda" in sys.argv:
args["name"] = "e2eAIOK-sda"
args["packages"] = find_packages(exclude=["RecDP", "RecDP.*", "modelzoo", "example", \
"e2eAIOK.DeNas", "e2eAIOK.DeNas.*",\
"e2eAIOK.ModelAdapter", "e2eAIOK.ModelAdapter.*"])
args["package_data"] = {'e2eAIOK': ['version','common/default.conf']}
install_reqs = parse_requirements("e2eAIOK/SDA/requirements.txt", session=False)
# handle pip version compatibility
try:
args["install_requires"] = [str(ir.req) for ir in install_reqs]
except AttributeError:
args["install_requires"] = [str(ir.requirement) for ir in install_reqs]
sys.argv.remove("--sda")
elif "--ma" in sys.argv:
args["name"] = "e2eAIOK-ModelAdapter"
args["packages"] = find_packages(exclude=["RecDP", "RecDP.*", "modelzoo", "example", \
"e2eAIOK.SDA", "e2eAIOK.SDA.*", "e2eAIOK.dataloader", "e2eAIOK.utils",\
"e2eAIOK.DeNas", "e2eAIOK.DeNas.*"])
args["package_data"] = {'e2eAIOK': ['version','common/default.conf','ModelAdapter/default_ma.conf']}
install_reqs = parse_requirements("e2eAIOK/ModelAdapter/requirements.txt", session=False)
# handle pip version compatibility
try:
args["install_requires"] = [str(ir.req) for ir in install_reqs]
except AttributeError:
args["install_requires"] = [str(ir.requirement) for ir in install_reqs]
sys.argv.remove("--ma")
else:
args["package_data"] = {'e2eAIOK': ['version','common/default.conf','ModelAdapter/default_ma.conf']}
setup_package(args)