mqtt_logger/setup.py

37 lines
1.2 KiB
Python
Raw Permalink Normal View History

2017-02-16 07:44:56 +00:00
#!/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
PKG_NAME = 'mqtt_logger'
PKG_VERSION = '0.1.0'
DAEMON_START_SCRIPT_SRC = PKG_NAME + '.service'
DAEMON_START_SCRIPT_DST = '/lib/systemd/system/' + DAEMON_START_SCRIPT_SRC
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)