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

« back to all changes in this revision

Viewing changes to setup/configure.py

setup.configure: Now handles the case of a missing config file.
    (Creates a blank one and it gets initialised with all the defaults).

Show diffs side-by-side

added added

removed removed

Lines of Context:
234
234
    # The reason for this is that these settings are used by other phases
235
235
    # of setup besides conf, so we need to know them.
236
236
    # Also this allows you to hit Return to accept the existing value.
237
 
    conf = ivle.config.Config()
 
237
    try:
 
238
        conf = ivle.config.Config()
 
239
    except ivle.config.ConfigError:
 
240
        # Couldn't find a config file anywhere.
 
241
        # Create a new blank config object (not yet bound to a file)
 
242
        # All lookups (below) will fail, so it will be initialised with all
 
243
        # the default values.
 
244
        conf = ivle.config.Config(blank=True)
 
245
 
238
246
    for opt in config_options:
239
247
        try:
240
248
            conf_options[opt.option_name] = conf.get_by_path(opt.option_name)
329
337
    # Generate the forum secret
330
338
    forum_secret = hashlib.md5(uuid.uuid4().bytes).hexdigest()
331
339
 
332
 
    # Write ./etc/ivle.conf
333
 
 
334
 
    conf = ivle.config.Config(blank=True)
 
340
    # Write ./etc/ivle.conf (even if we loaded from a different filename)
335
341
    conf.filename = conffile
336
342
 
337
343
    conf.initial_comment = ["# IVLE Configuration File"]