-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
42 lines (36 loc) · 1.39 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
import os
import re
import ast
from setuptools import setup
def parse_requirements(filename):
""" load requirements from a pip requirements file """
lineiter = (line.strip() for line in open(filename))
packages, links = [], []
for line in lineiter:
if line and (line.startswith("#") or line.startswith("-")):
links.append(line)
else:
packages.append(line)
return packages, links
def get_version():
curr_dir = os.path.abspath(os.path.dirname(__file__))
main_file = os.path.join(curr_dir, "instance_augmentation", "__init__.py")
_version_re = re.compile(r"__version__\s+=\s+(?P<version>.*)")
with open(main_file, "r", encoding="utf8") as f:
match = _version_re.search(f.read())
version = match.group("version") if match is not None else '"unknown"'
return str(ast.literal_eval(version))
if __name__ == "__main__":
packages, links = parse_requirements("requirements.txt")
setup(
name="instance_augmentation",
version=get_version(),
author="Orest Kupyn",
description="Dataset Enhancement with Instance Augmentation Implementation",
package_dir={"": "."},
url="https://github.com/KupynOrest/InstanceAugmentation",
packages=["instance_augmentation"],
include_package_data=True,
install_requires=packages,
dependency_links=links,
)