-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsetup.py
88 lines (65 loc) · 2.36 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
""" Setup for core main app
"""
from os import chdir, pardir
from os.path import join, exists, dirname, normpath, abspath
from re import sub
from setuptools import find_packages, setup
def req_link(external_url):
"""Build required link
Args:
external_url:
Returns:
"""
egg_link = sub(r"https://[^=]+=", "", external_url)
return "==".join(egg_link.rsplit("-", 1))
def read_requirements_file(requirements_filepath):
"""Read packages from a pip requirements file
Args:
requirements_filepath:
Returns:
"""
requirements = []
if not exists(requirements_filepath):
return requirements
with open(requirements_filepath, encoding="utf-8") as requirements_fp:
requirements += requirements_fp.read().splitlines()
return requirements
reqs_dev = join(dirname(__file__), "requirements.dev.txt")
reqs_default = join(dirname(__file__), "requirements.txt")
reqs_core = join(dirname(__file__), "requirements.core.txt")
reqs_mongo = join(dirname(__file__), "requirements.mongo.txt")
reqs_auth = join(dirname(__file__), "requirements.auth.txt")
reqs_allauth = join(dirname(__file__), "requirements.allauth.txt")
required = []
required += read_requirements_file(reqs_default)
required += read_requirements_file(reqs_core)
dev_extra = read_requirements_file(reqs_dev)
mongo_extra = read_requirements_file(reqs_mongo)
auth_extra = read_requirements_file(reqs_auth)
allauth_extra = read_requirements_file(reqs_allauth)
dep_links = [r for r in required if r.startswith("https://")]
required = [req_link(r) if r.startswith("https://") else r for r in required]
with open(join(dirname(__file__), "README.rst"), encoding="utf-8") as f:
long_desc = f.read()
# Allow setup.py to be run from any path
chdir(normpath(join(abspath(__file__), pardir)))
setup(
name="core_main_app",
version="2.13.0",
description="Main functionalities for the curator core project",
long_description=long_desc,
author="NIST IT Lab",
author_email="[email protected]",
url="https://github.com/usnistgov/core_main_app",
packages=find_packages(),
include_package_data=True,
python_requires=">=3.9",
install_requires=required,
dependency_links=dep_links,
extras_require={
"develop": dev_extra,
"mongodb": mongo_extra,
"auth": auth_extra,
"allauth": allauth_extra,
},
)