forked from avishayil/consoleme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
87 lines (75 loc) · 2.69 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
"""Docstring for public module."""
import distutils.cmd
import distutils.log
import os
from shutil import rmtree
import pip
from setuptools import find_packages, setup
if tuple(map(int, pip.__version__.split("."))) >= (19, 3, 0):
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements
elif tuple(map(int, pip.__version__.split("."))) >= (10, 0, 0):
from pip._internal.download import PipSession
from pip._internal.req import parse_requirements
else:
from pip.download import PipSession
from pip.req import parse_requirements
class CleanAllCommand(distutils.cmd.Command):
"""Docstring for public class."""
description = "remove extra build files"
user_options = []
dirname = os.path.dirname(os.path.realpath(__file__))
def initialize_options(self):
"""Docstring for public method."""
pass
def finalize_options(self):
"""Docstring for public method."""
pass
def run(self):
"""Docstring for public method."""
targets = [
".cache",
".coverage.py27",
".coverage.py36",
".tox",
"coverage-html.py27",
"coverage-html.py36",
"consoleme.egg-info",
"consoleme/__pycache__",
"test/__pycache__",
]
for t in targets:
path = os.path.join(self.dirname, t)
if os.path.isfile(path):
self.announce(f"removing file: {path}", level=distutils.log.INFO)
os.remove(path)
elif os.path.isdir(path):
self.announce(f"removing directory: {path}", level=distutils.log.INFO)
rmtree(path)
requirements = parse_requirements("requirements.txt", session=PipSession())
test_requirements = parse_requirements("requirements-test.txt", session=PipSession())
if tuple(map(int, pip.__version__.split("."))) >= (20, 1):
reqs = [str(ir.requirement) for ir in requirements]
test_reqs = [str(ir.requirement) for ir in test_requirements]
else:
reqs = [str(ir.req) for ir in requirements]
test_reqs = [str(ir.req) for ir in test_requirements]
setup(
name="consoleme",
author="Curtis Castrapel",
author_email="[email protected]",
description="Consoleme",
keywords="consoleme",
url="https://github.com/Netflix/ConsoleMe",
python_requires=">=3.8",
install_requires=reqs,
tests_require=test_reqs,
setup_requires=["setupmeta"],
extras_require={"test": ["tox"]},
packages=find_packages(exclude=("tests",)),
entry_points={},
cmdclass={"cleanall": CleanAllCommand},
include_package_data=True,
versioning="devcommit",
zip_safe=False,
)