-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py.in
75 lines (62 loc) · 2.04 KB
/
setup.py.in
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
71
72
73
74
75
from setuptools import setup
from setuptools.command.install import install
import subprocess
import os
import errno
# Create the module directory
config_directory = "${CMAKE_CURRENT_BINARY_DIR}/config"
try:
os.makedirs(config_directory)
except OSError as e:
if e.errno != errno.EEXIST:
raise RuntimeError("Could not create directory: %s" % (str(e)))
# The init script will contain the necessary variables
config_target = os.path.join(config_directory, "__init__.py")
with open(config_target, "w") as f:
f.write("""
etc_location = '{0}'
""".format(
"${ETC_FULL_LOCATION}"
))
def privileged_setup():
if subprocess.call(['${CMAKE_CURRENT_SOURCE_DIR}/create-unix.sh']):
raise RuntimeError("create-unix unsuccessful")
class DockerLaunchSetup(install):
def run(self):
try:
privileged_setup()
except:
print("Unable to set up dockerlaunch daemon user - check your permissions")
class WrappedInstall(install):
def run(self):
install.run(self)
try:
privileged_setup()
except:
print("\n**** WARNING: Remember to run 'make dockerlaunch_setup' with super-user permissions *****\n")
setup(
name='dockerlaunch',
version='0.1',
packages=['dockerlaunch', 'dockerlaunch.config'],
package_data={'dockerlaunch': [
'${CMAKE_CURRENT_SOURCE_DIR}/dockerlaunch/data/indocker.py'
]},
package_dir={
'dockerlaunch': '${CMAKE_CURRENT_SOURCE_DIR}/dockerlaunch',
'dockerlaunch.config': config_directory
},
description='Launcher for Docker containers to provide some measure of sandbox protection',
author='Phil Weir - NUMA Engineering Services Ltd.',
author_email='[email protected]',
url='http://gosmart-project.eu/',
scripts=[
'${CMAKE_CURRENT_SOURCE_DIR}/scripts/dockerlaunchd'
],
install_requires=[
'docker-py',
'lockfile',
'python-daemon',
'pyyaml'
],
cmdclass={'install': WrappedInstall, 'dockerlaunch_setup': DockerLaunchSetup}
)