-
Notifications
You must be signed in to change notification settings - Fork 37
/
setup.py
executable file
·85 lines (74 loc) · 2.76 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
from setuptools import setup
import os
version = "1.9.4"
user = os.getlogin()
homedir = "/home/" + user + "/raspi-sump/"
systemd_configdir = "/home/" + user + "/.config/systemd/user/"
if os.path.isfile(homedir + "raspisump.conf"):
cmd = "cp -u " + homedir + "raspisump.conf " + homedir + "raspisump.conf.save"
os.system(cmd)
raspi_sump_files = [
"bin/rsump.py",
"bin/rsumpchart.py",
"bin/rsumpmonitor.py",
"bin/rsumpwebchart.py",
"bin/emailtest",
"bin/rsumpsupport",
]
add_files = [
(homedir + "sample_config", ["conf/raspisump.conf"]),
(homedir + "csv", ["conf/csv/README.md"]),
(homedir + "logs", ["conf/logs/README.md"]),
(homedir + "charts", ["conf/charts/README.md"]),
(homedir + "docs", ["docs/README.md"]),
(homedir + "docs", ["docs/install.md"]),
(homedir + "cron", ["cron/README.md"]),
(homedir + "cron", ["cron/picrontab"]),
(homedir + "web", ["conf/web/index.html"]),
(homedir + "web/images", ["conf/web/images/logo.png"]),
(homedir + "web/css", ["conf/web/css/index.html"]),
(homedir + "web/css", ["conf/web/css/raspi.css"]),
(homedir + "web/css", ["conf/web/css/includes.js"]),
(homedir, ["VERSION"]),
(homedir + "web/css/inc", ["VERSION"]),
(systemd_configdir, ["conf/systemd/rsumpwebchart.service"]),
(systemd_configdir, ["conf/systemd/raspisump.service"]),
(systemd_configdir, ["conf/systemd/rsumpwebchart.timer"]),
]
setup(
name="raspisump",
version=version,
description="A sump pit monitoring system for Raspberry Pi",
long_description_content_type="text/markdown",
long_description=open("./README.md", "r").read(),
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: End Users/Desktop",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.9",
"Topic :: Home Automation",
"License :: OSI Approved :: MIT License",
],
author="Al Audet",
author_email="alaudet@linuxnorth.org",
url="https://www.linuxnorth.org/raspi-sump/",
download_url="https://github.com/alaudet/raspi-sump/releases",
license="MIT License",
packages=["raspisump"],
scripts=raspi_sump_files,
data_files=add_files,
install_requires=["hcsr04sensor>=1.7"],
)
if os.path.isdir(homedir):
cmd = "chown -R " + user + " " + homedir
os.system(cmd)
cmd = "chmod 600 " + homedir + "raspisump.conf"
os.system(cmd)
cmd = "chmod 600 " + homedir + "sample_config/raspisump.conf"
os.system(cmd)
if os.path.isdir("/home/" + user + "/.config/systemd"):
cmd = "chown -R " + user + " " + "/home/" + user + "/.config"
os.system(cmd)