mqtt_logger/setup.py
Thomas Klaehn b802b9cadb mqtt_logger: administrative stuff
* add systemctl service
 * add installation procedure

Signed-off-by: Thomas Klaehn <tkl@blackfinn.de>
2017-02-15 17:36:03 +01:00

37 lines
1.2 KiB
Python

#!/usr/bin/env python
'''
Created on Feb 15, 2017
Type 'python setup.py sdist' to create the distribution,
type 'python setup.py install' to install the distribution.
@author: tkl
'''
from distutils.core import setup
import shutil
import os
import stat
import sys
DAEMON_START_SCRIPT_SRC = 'mqtt_logger.service'
DAEMON_START_SCRIPT_DST = '/lib/systemd/system/mqtt_logger.service'
PKG_NAME = 'mqtt_logger'
PKG_VERSION = '0.1.0'
PKG_AUTHOR = 'tkl'
PKG_AUTHOR_EMAIL = 'tkl@blackfinn.de'
PKG_URL = 'files.blackfinn.de/python/' + PKG_NAME + '.py/' + PKG_NAME + '-' + \
PKG_VERSION + '.tar.gz'
PKG_PACKAGES = [PKG_NAME]
PKG_SCRIPTS = [DAEMON_START_SCRIPT_SRC]
if sys.argv[1] == 'install':
shutil.copyfile(DAEMON_START_SCRIPT_SRC, DAEMON_START_SCRIPT_DST)
os.chmod(DAEMON_START_SCRIPT_DST, stat.S_IRUSR | stat.S_IWUSR | \
stat.S_IRGRP | stat.S_IROTH)
setup(name=PKG_NAME, version=PKG_VERSION, author=PKG_AUTHOR,
author_email=PKG_AUTHOR_EMAIL, url=PKG_URL, packages=PKG_PACKAGES)
elif sys.argv[1] == 'sdist':
setup(name=PKG_NAME, version=PKG_VERSION, author=PKG_AUTHOR,
author_email=PKG_AUTHOR_EMAIL, url=PKG_URL, packages=PKG_PACKAGES,
scripts=PKG_SCRIPTS)