#!/usr/bin/python3 ''' @author: Thomas Klaehn ''' from setuptools import setup import os import shutil import stat import sys NAME = 'greenhouse' VERSION = '1.0.0' AUTHOR = 'Thomas Klaehn' EMAIL = 'tkl@blackfinn.de' SYSTEMD_SCRIPTS = ['greenhouse.service'] PACKAGES = ['greenhouse'] PACKAGE_DIRS = {'greenhouse':'greenhouse'} REQUIRES = ['RPi.GPIO', 'Adafruit_DHT', 'paho-mqtt'] SYSTEMD_PATH = '/lib/systemd/system/' if sys.argv[1] == 'install': for script in SYSTEMD_SCRIPTS: shutil.copyfile(script, os.path.join(SYSTEMD_PATH, script)) os.chmod(os.path.join(SYSTEMD_PATH, script), stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH) setup(name=NAME, version=VERSION, author=AUTHOR, author_email=EMAIL, package_dir=PACKAGE_DIRS, packages=PACKAGES, install_requires=REQUIRES) elif sys.argv[1] == 'sdist': setup(name=NAME, version=VERSION, author=AUTHOR, author_email=EMAIL, package_dir=PACKAGE_DIRS, packages=PACKAGES, install_requires=REQUIRES, scripts=SYSTEMD_SCRIPTS)