forked from KyleBenson/scale_client
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
executable file
·70 lines (61 loc) · 2.19 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
import os, errno
from setuptools import setup, find_packages
print "WARNING: the latest version uses a customized fork of CoAPthon that you'll need to separately install manually! see README.md..."
# Generic info about package
NAME = "scale_client"
VERSION = "0.2"
DESC = "Safe Community Awareness and Alerting Network (SCALE) client"
AUTHOR = "Kyle Benson"
AUTHOR_EMAIL = "[email protected]"
URL = "https://github.com/KyleBenson/scale_client"
# Specific information about package contents
# PACKAGES = ["scale_client", "scale_client.core",
# "scale_client.sensors", "scale_client.event_sinks",
# "scale_client.applications"]
PACKAGE_DATA = {"scale_client": ["config/*"],
"scale_client.event_sinks": ["sigfox_event_types.json"]}
DAEMON_LOCATION = "/etc/init.d"
CONFIG_LOCATION = "/etc/scale/client"
data_files = []
# Gather requires info from requirements.txt
with open('requirements.txt') as F:
requirements = [l.strip() for l in F.readlines() if not l.startswith("#")]
# Make config location
# http://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else: raise
try:
mkdir_p(CONFIG_LOCATION)
except OSError:
pass
try:
with open(CONFIG_LOCATION + "/example_config.yml", "a") as F:
pass
data_files.append((CONFIG_LOCATION, ["scale_client/config/example_config.yml"]))
except IOError:
print "Can't access config location. Skipping config example installation..."
# Check whether we will be able to install the daemon or not
try:
with open(DAEMON_LOCATION + "/scale_daemon", 'a') as F:
pass
data_files.append((DAEMON_LOCATION, ["scripts/scale_daemon"]))
except IOError:
print "Can't access daemon location. Skipping daemon installation..."
setup(name=NAME,
version=VERSION,
description=DESC,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
# packages=PACKAGES,
packages=find_packages(),
package_data=PACKAGE_DATA,
data_files=data_files,
install_requires=requirements,
)