-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
executable file
·57 lines (42 loc) · 1.37 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from setuptools import setup
try:
from pkg_resources import VersionConflict, require
require("setuptools>=38.3")
except VersionConflict:
print("Error: version of setuptools is too old (<38.3)!")
sys.exit(1)
def get_extra_requires(add_all=True, add_all_dev=True):
from distutils.dist import Distribution
dist = Distribution()
dist.parse_config_files()
dist.parse_command_line()
extras = {}
extra_deps = dist.get_option_dict("options.extras_require")
for extra_name, data in extra_deps.items():
_, dep_string = data
deps = []
d = dep_string.split("\n")
for line in d:
if not line:
continue
deps.append(line)
extras[extra_name] = deps
if add_all:
all = set()
for e_n, deps in extras.items():
if not e_n.startswith("dev_"):
all.update(deps)
extras["all"] = all
# add tag `all` at the end
if add_all_dev:
extras["all_dev"] = set(vv for v in extras.values() for vv in v)
extras["dev_all"] = extras["all_dev"]
return extras
if __name__ in ["__main__", "builtins", "__builtin__"]:
setup(
use_scm_version={"write_to": "src/kiara_plugin/documentation/version.txt"},
extras_require=get_extra_requires(),
)