-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·91 lines (73 loc) · 2.54 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
89
90
91
#!/usr/bin/env python
import io
import re
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
# Code from here: https://pytest.org/latest/goodpractises.html
def finalize_options(self):
TestCommand.finalize_options(self)
# We don't run integration tests which need an actual Sonos device
self.test_args = ["-m", "not integration"]
self.test_suite = True
def run_tests(self):
# Import here, because outside the eggs aren't loaded
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
src = open("soco/__init__.py", encoding="utf-8").read()
metadata = dict(re.findall('__([a-z]+)__ = "([^"]+)"', src))
docstrings = re.findall('"""(.*?)"""', src, re.MULTILINE | re.DOTALL)
NAME = "soco"
PACKAGES = (
"soco",
"soco.plugins",
"soco.music_services",
)
TEST_REQUIREMENTS = list(open("requirements-dev.txt"))
AUTHOR_EMAIL = metadata["author"]
VERSION = metadata["version"]
WEBSITE = metadata["website"]
LICENSE = metadata["license"]
DESCRIPTION = docstrings[0]
CLASSIFIERS = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Home Automation",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Sound/Audio :: Players",
"Topic :: Software Development :: Libraries :: Python Modules",
]
PYTHON_REQUIRES = ">=3.5"
with open("README.rst", encoding="utf-8") as file:
LONG_DESCRIPTION = file.read()
# Extract name and e-mail ("Firstname Lastname <[email protected]>")
AUTHOR, EMAIL = re.match(r"(.*) <(.*)>", AUTHOR_EMAIL).groups()
REQUIREMENTS = list(open("requirements.txt"))
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
author=AUTHOR,
author_email=EMAIL,
license=LICENSE,
url=WEBSITE,
packages=PACKAGES,
install_requires=REQUIREMENTS,
tests_require=TEST_REQUIREMENTS,
long_description=LONG_DESCRIPTION,
cmdclass={"test": PyTest},
classifiers=CLASSIFIERS,
python_requires=PYTHON_REQUIRES,
)