-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathsetup.py
77 lines (60 loc) · 2.28 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
import glob
import os
import re
import sys
from setuptools import setup
from setuptools.command.install import install
from setuptools.command.test import test as TestCommand
with open("consul/__init__.py", encoding="utf-8") as f:
metadata = dict(re.findall('__([a-z]+)__ = "([^"]+)"', f.read()))
def _read_reqs(relpath: str):
fullpath = os.path.join(os.path.dirname(__file__), relpath)
with open(fullpath, encoding="utf-8") as f:
return [s.strip() for s in f.readlines() if (s.strip() and not s.startswith("#"))]
description = "Python client for Consul (http://www.consul.io/)"
py_modules = [os.path.splitext(x)[0] for x in glob.glob("consul/*.py")]
class Install(install):
def run(self):
install.run(self)
class PyTest(TestCommand):
# pylint: disable=attribute-defined-outside-init
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest # pylint: disable=import-outside-toplevel
errno = pytest.main(self.test_args)
sys.exit(errno)
with open("README.rst", encoding="utf-8") as f1, open("CHANGELOG.rst", encoding="utf-8") as f2:
long_description = f"{f1.read()}\n\n{f2.read()}"
setup(
name="py-consul",
version=metadata["version"],
author="Criteo",
author_email="github@criteo.com",
url="https://github.com/criteo-forks/py-consul",
license="MIT",
description=description,
long_description=long_description,
py_modules=py_modules,
install_requires=_read_reqs("requirements.txt"),
extras_require={
"tornado": ["tornado"],
"asyncio": ["aiohttp"],
"twisted": ["twisted", "treq"],
},
data_files=[(".", ["requirements.txt", "tests-requirements.txt"])],
tests_require=_read_reqs("tests-requirements.txt"),
cmdclass={"test": PyTest, "install": Install},
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
)