-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
50 lines (40 loc) · 1.19 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
import sys
from pathlib import Path
from setuptools import find_packages, setup
def err(msg):
sys.stderr.write(msg)
sys.exit(1)
def parse_requirements():
subgroup_offset = "#-# "
dependencies = {}
subgroup = "dummy-subgroup"
req_file = Path(__file__).parent / "requirements.txt"
for line in open(req_file):
line = line.strip()
if line.startswith(subgroup_offset):
subgroup = line.rsplit(maxsplit=1)[1]
dependencies[subgroup] = []
elif line != "":
dependencies[subgroup].append(line)
if "core" not in dependencies or "dummy-subgroup" in dependencies:
err("core should be in the requirements.txt as '#-# core'")
return dependencies
reqs = parse_requirements()
print(reqs)
setup(
name="PROJECTNAME",
version="VERSION",
packages=find_packages(
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]
),
package_dir={"": "."},
install_requires=reqs["core"],
package_data={"": ["*.yaml"]},
include_package_data=True,
extras_require={
extra: extra_reqs
for extra, extra_reqs in reqs.items()
if extra != "core"
},
python_requires=">=3.8",
)