config: Move config file

This commit is contained in:
Thomas Klaehn 2021-04-06 07:50:18 +02:00
parent d0f11e3398
commit ef9cc23744
3 changed files with 2 additions and 13 deletions

View File

@ -18,7 +18,7 @@ heat_pin = 26
heat_state = False
CONFIG_FILE = "/etc/greenhouse/greenhouse.json"
CONFIG_FILE = "config/greenhouse.json"
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)

View File

@ -1,6 +1,3 @@
import shutil
import sys
import os
from setuptools import setup
NAME = 'Greenhouse'
@ -11,16 +8,8 @@ PACKAGES = ['greenhouse']
REQUIRES = ['Flask', 'w1thermsensor', 'RPi.GPIO']
CONFIG_FOLDER = '/etc/greenhouse'
CONFIG_FILE = 'greenhouse.json'
PACKAGE_DATA = {'greenhouse': ['templates/*', 'static/css/*', 'static/scripts/*']}
PACKAGE_DATA = {'greenhouse': ['templates/*', 'static/css/*', 'static/scripts/*', 'config/*']}
setup(name=NAME, version=VERSION, long_description=__doc__, author=AUTHOR, author_email=EMAIL,
packages=PACKAGES, include_package_data=True, package_data=PACKAGE_DATA, zip_safe=False,
install_requires=REQUIRES)
if sys.argv[1] == 'install':
try:
os.makedirs(CONFIG_FOLDER)
shutil.copyfile(CONFIG_FILE, os.path.join(CONFIG_FOLDER, CONFIG_FILE))
except FileExistsError:
#FIXME: handle overwriting the config file
pass