import shutil import sys import os from setuptools import setup NAME = 'Greenhouse' VERSION = '1' AUTHOR = 'Thomas Klaehn' EMAIL = 'tkl@blackfinn.de' PACKAGES = ['greenhouse'] REQUIRES = ['Flask', 'w1thermsensor', 'RPi.GPIO'] CONFIG_FOLDER = '/etc/greenhouse' CONFIG_FILE = 'greenhouse.json' setup(name=NAME, version=VERSION, long_description=__doc__, author=AUTHOR, author_email=EMAIL, packages=PACKAGES, include_package_data=True, 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