-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
61 lines (49 loc) · 1.24 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
import os
import subprocess
import sys
from distutils.command.install import install
from setuptools import setup, find_packages
deps = [
'APScheduler==3.9.1',
'pyzmq==23.2.1',
'pigpio==1.78',
'paho-mqtt==1.6.1'
]
def is_raspberry():
(sysname, nodename, release, version, machine) = os.uname()
return sysname == 'Linux' and machine == 'armv6l'
MODULE = "tank-client"
class InstallWrapper(install):
@staticmethod
def pip_install(package_name):
subprocess.call(
[sys.executable, '-m', 'pip', 'install', package_name]
)
def run(self):
# install all deps
for dep in deps:
self.pip_install(dep)
if is_raspberry():
self.pip_install('RPi.GPIO==0.7.0')
# now run install :)
install.run(self)
setup(
name=f'{MODULE}',
author="Christoph Spörk",
author_email="[email protected]",
platforms="any",
version='2.0.1',
packages=find_packages(
include=[
f'{MODULE}', f'{MODULE}.*'
]
),
package_data={"tank-client": [
"data/tank-client.service",
"data/tank-client.conf"
]},
cmdclass={
'install': InstallWrapper,
},
install_requires=deps
)