Refactor setup.

This commit is contained in:
Thomas Klaehn 2019-08-14 12:48:37 +02:00
parent ddbb5f159f
commit 2cd36b5e52

View File

@ -1,10 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
from distutils.core import setup
import sys import sys
import os import os
import shutil import shutil
import stat import stat
from setuptools import setup
NAME = 'bicycle-statistics' NAME = 'bicycle-statistics'
VERSION = '0.2.0' VERSION = '0.2.0'
@ -12,11 +12,16 @@ AUTHOR = 'Thomas Klaehn'
EMAIL = 'tkl@blackfinn.de' EMAIL = 'tkl@blackfinn.de'
PACKAGES = ['bicycle_statistics', 'gpx_parser', 'gpx2html'] PACKAGES = ['bicycle_statistics', 'gpx_parser', 'gpx2html']
SCRIPTS = ['example-gpx-parser', 'bicycle-stat'] SCRIPTS = ['example-gpx-parser', 'bicycle-stat']
REQUIRES = ['geopy', 'gpxpy', 'matplotlib', 'numpy', 'pandas']
DAEMON_START_SCRIPT = os.path.join("/lib/systemd/system", "bicycle-stat.service") SERVICEDIR = "/lib/systemd/system"
DAEMON_START_SCRIPT = os.path.join(SERVICEDIR, "bicycle-stat.service")
if sys.argv[1] == 'install': if sys.argv[1] == 'install':
os.makedirs(SERVICEDIR)
shutil.copyfile("bicycle-stat.service", DAEMON_START_SCRIPT) shutil.copyfile("bicycle-stat.service", DAEMON_START_SCRIPT)
os.chmod(DAEMON_START_SCRIPT, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH) os.chmod(DAEMON_START_SCRIPT, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)
setup(name=NAME, version=VERSION, author=AUTHOR, author_email=EMAIL, packages=PACKAGES, scripts=SCRIPTS) setup(name=NAME, version=VERSION, author=AUTHOR, author_email=EMAIL,
packages=PACKAGES, scripts=SCRIPTS, install_requires=REQUIRES)