forked from K4CZP3R/tapo-p100-python
-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
setup.py
78 lines (61 loc) · 2.18 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
import codecs
import os
from distutils.dist import Distribution
from setuptools import setup, find_packages
with open("README.md") as readme_file:
README = readme_file.read()
with open("requirements.txt") as requirements_file:
REQUIREMENTS = requirements_file.read().split("\n")
FORCE_BINARY = "FORCE_BINARY" in os.environ
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), "r") as fp:
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
class bdist_wheel(_bdist_wheel):
def __init__(self, dist: Distribution):
super().__init__(dist)
def finalize_options(self):
_bdist_wheel.finalize_options(self)
# Mark us as not a pure python package
self.root_is_pure = False
def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
print(f"Tag: {python} {abi} {plat}")
return python, abi, plat
except ImportError:
bdist_wheel = None
if FORCE_BINARY:
print("Binary forced")
setup_args = dict(
name="plugp100",
version=get_version("plugp100/__init__.py"),
install_requires=REQUIREMENTS,
description="Controller for TP-Link Tapo P100 and other devices",
long_description_content_type="text/markdown",
long_description=README,
license="GPL3",
packages=find_packages(exclude=("tests",)),
author="@petretiandrea",
author_email="[email protected]",
keywords=["Tapo", "P100"],
url="https://github.com/petretiandrea/plugp100",
download_url="https://github.com/petretiandrea/plugp100",
classifiers=[
# 'Development Status :: 4 - Beta',
"Development Status :: 5 - Production/Stable"
],
cmdclass={
**({"bdist_wheel": bdist_wheel} if FORCE_BINARY else {}),
},
)
if __name__ == "__main__":
setup(**setup_args)