43
43
parser.add_option("--no-compile",
44
44
action="store_true", dest="nocompile",
45
45
help="Don't byte-compile .py files.")
46
parser.add_option("-t", "--trampoline-uids",
47
action="store", dest="tuids", default="33",
48
help="Comma-separated list of UIDs allowed to use trampoline. "
50
46
(options, args) = parser.parse_args(args)
52
48
# Call the real function
53
return __build(options.dry, options.nocompile, options.tuids)
49
return __build(options.dry, options.nocompile)
55
def __build(dry=False, no_compile=None, tuids=None):
51
def __build(dry=False, no_compile=None):
52
# We need to import the one in the working copy, not in the system path.
53
confmodule = __import__("ivle/conf/conf")
56
54
install_list = util.InstallList()
59
57
print "Dry run (no actions will be executed)\n"
61
# Create trampoline configuration.
62
conf_hfile = os.path.join(os.getcwd(), "bin/trampoline/conf.h")
63
conf_h = open(conf_hfile, "w")
65
conf_h.write("""/* IVLE Configuration File
67
* Administrator settings required by trampoline.
68
* Note: trampoline will have to be rebuilt in order for changes to this file
72
#define IVLE_AUFS_JAILS
74
/* Which user IDs are allowed to run the trampoline.
75
* This list should be limited to the web server user.
76
* (Note that root is an implicit member of this list).
78
static const int allowed_uids[] = { %s };
82
59
# Compile the trampoline
83
60
curdir = os.getcwd()
84
61
os.chdir('bin/trampoline')
94
71
# Compile .py files into .pyc or .pyo files
73
compileall.compile_dir('www', quiet=True)
96
74
compileall.compile_dir('ivle', quiet=True)
97
75
compileall.compile_dir('services', quiet=True)