134
129
# Call the requested operation's function
140
135
'listmake' : listmake,
141
136
'install' : install,
142
}[operation](argv[2:])
144
139
print >>sys.stderr, (
145
140
"""Invalid operation '%s'. Try python setup.py help."""
150
opts, args = getopt.getopt(argv[1:], "h", ["help"])
151
except getopt.error, msg:
153
# more code, unchanged
155
print >>sys.stderr, err.msg
156
print >>sys.stderr, "for help use --help"
142
return oper_func(argv[2:])
159
144
# Operation functions
188
173
print """python setup.py conf [args]
189
174
Configures IVLE with machine-specific details, most notably, various paths.
190
175
Either prompts the administrator for these details or accepts them as
176
command-line args. Will be interactive only if there are no arguments given.
177
Takes defaults from existing conf file if it exists.
192
178
Creates www/conf/conf.py and trampoline/conf.h.
184
As explained in the interactive prompt or conf.py.
195
186
elif operation == 'build':
196
187
print """python -O setup.py build [--dry|-n]
305
296
conf_hfile = os.path.join(cwd, "trampoline/conf.h")
307
298
# Fixed config options that we don't ask the admin
309
299
default_app = "dummy"
311
print """This tool will create the following files:
301
# Get command-line arguments to avoid asking questions.
303
(opts, args) = getopt.gnu_getopt(args, "", ['root_dir=',
304
'ivle_install_dir=', 'jail_base=', 'allowed_uids='])
307
print >>sys.stderr, "Invalid arguments:", string.join(args, ' ')
311
# Interactive mode. Prompt the user for all the values.
313
print """This tool will create the following files:
314
316
prompting you for details about your configuration. The file will be
317
319
Please hit Ctrl+C now if you do not wish to do this.
318
320
""" % (conffile, conf_hfile)
320
# Get information from the administrator
321
# If EOF is encountered at any time during the questioning, just exit
322
# Get information from the administrator
323
# If EOF is encountered at any time during the questioning, just exit
324
root_dir = query_user(root_dir,
325
"""Root directory where IVLE is located (in URL space):""")
326
ivle_install_dir = query_user(ivle_install_dir,
327
'Root directory where IVLE will be installed (on the local file '
329
jail_base = query_user(jail_base,
330
"""Root directory where the jails (containing user files) are stored
326
root_dir = query_user(root_dir,
327
"""Root directory where IVLE is located (in URL space):""")
328
ivle_install_dir = query_user(ivle_install_dir,
329
'Root directory where IVLE will be installed (on the local file '
331
jail_base = query_user(jail_base,
332
"""Root directory where the jails (containing user files) are stored
331
333
(on the local file system):""")
332
allowed_uids = query_user(allowed_uids,
333
"""UID of the web server process which will run IVLE.
334
allowed_uids = query_user(allowed_uids,
335
"""UID of the web server process which will run IVLE.
334
336
Only this user may execute the trampoline. May specify multiple users as
335
337
a comma-separated list.
336
338
(eg. "1002,78")""")
342
# Non-interactive mode. Parse the options.
343
if '--root_dir' in opts:
344
root_dir = opts['--root_dir']
345
if '--ivle_install_dir' in opts:
346
ivle_install_dir = opts['--ivle_install_dir']
347
if '--jail_base' in opts:
348
jail_base = opts['--jail_base']
349
if '--allowed_uids' in opts:
350
allowed_uids = opts['--allowed_uids']
338
352
# Error handling on input values
341
354
allowed_uids = map(int, allowed_uids.split(','))
342
355
except ValueError: