~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to setup/configure.py

setup.configure: Replaced all uses of config-variable global variables with
    explicit notation globals()['VARNAME']. This should not change the
    behaviour at all.

    Reason: These should not be in the global variables. Preparing to move to
    a different dict -- so we need to treat globals() as a dictionary to make
    this easier.

Show diffs side-by-side

added added

removed removed

Lines of Context:
255
255
    return __configure(args)
256
256
 
257
257
def __configure(args):
258
 
    global db_port, usrmgt_port
259
 
 
260
258
    # Try importing existing conf, but if we can't just set up defaults
261
259
    # The reason for this is that these settings are used by other phases
262
260
    # of setup besides conf, so we need to know them.
323
321
 
324
322
    # Error handling on input values
325
323
    try:
326
 
        allowed_uids_list = map(int, allowed_uids.split(','))
 
324
        allowed_uids_list = map(int, globals()['allowed_uids'].split(','))
327
325
    except ValueError:
328
326
        print >>sys.stderr, (
329
327
        "Invalid UID list (%s).\n"
330
 
        "Must be a comma-separated list of integers." % allowed_uids)
 
328
        "Must be a comma-separated list of integers." %
 
329
            globals()['allowed_uids'])
331
330
        return 1
332
331
    try:
333
 
        db_port = int(db_port)
334
 
        if db_port < 0 or db_port >= 65536: raise ValueError()
 
332
        globals()['db_port'] = int(globals()['db_port'])
 
333
        if globals()['db_port'] < 0 or globals()['db_port'] >= 65536:
 
334
            raise ValueError()
335
335
    except ValueError:
336
336
        print >>sys.stderr, (
337
337
        "Invalid DB port (%s).\n"
338
338
        "Must be an integer between 0 and 65535." % repr(db_port))
339
339
        return 1
340
340
    try:
341
 
        usrmgt_port = int(usrmgt_port)
342
 
        if usrmgt_port < 0 or usrmgt_port >= 65536: raise ValueError()
 
341
        globals()['usrmgt_port'] = int(globals()['usrmgt_port'])
 
342
        if globals()['usrmgt_port'] < 0 or globals()['usrmgt_port'] >= 65536:
 
343
            raise ValueError()
343
344
    except ValueError:
344
345
        print >>sys.stderr, (
345
346
        "Invalid user management port (%s).\n"
392
393
    # XXX Compute jail_base, jail_src_base and jail_system. These will
393
394
    # ALSO be done by the boilerplate code, but we need them here in order
394
395
    # to write to the C file.
395
 
    jail_base = os.path.join(data_path, 'jailmounts')
396
 
    jail_src_base = os.path.join(data_path, 'jails')
 
396
    jail_base = os.path.join(globals()['data_path'], 'jailmounts')
 
397
    jail_src_base = os.path.join(globals()['data_path'], 'jails')
397
398
    jail_system = os.path.join(jail_src_base, '__base__')
398
399
 
399
400
    conf.write("""/* IVLE Configuration File
433
434
    conf = open(phpBBconffile, "w")
434
435
    
435
436
    # php-pg work around
436
 
    if db_host == 'localhost':
 
437
    if globals()['db_host'] == 'localhost':
437
438
        forumdb_host = '127.0.0.1'
438
439
    else:
439
 
        forumdb_host = db_host
 
440
        forumdb_host = globals()['db_host']
440
441
 
441
442
    conf.write( """<?php
442
443
// phpBB 3.0.x auto-generated configuration file
443
444
// Do not change anything in this file!
444
445
$dbms = 'postgres';
445
446
$dbhost = '""" + forumdb_host + """';
446
 
$dbport = '""" + str(db_port) + """';
447
 
$dbname = '""" + db_forumdbname + """';
448
 
$dbuser = '""" + db_user + """';
449
 
$dbpasswd = '""" + db_password + """';
 
447
$dbport = '""" + str(globals()['db_port']) + """';
 
448
$dbname = '""" + globals()['db_forumdbname'] + """';
 
449
$dbuser = '""" + globals()['db_user'] + """';
 
450
$dbpasswd = '""" + globals()['db_password'] + """';
450
451
 
451
452
$table_prefix = 'phpbb_';
452
453
$acm_type = 'file';