Kaydet (Commit) ed4332a6 authored tarafından Fatih Aşıcı's avatar Fatih Aşıcı

config: Add a method for setting options

This fixes a regression appeared after Config class became a singleton.
Different parts of pisi tries to create an instance of Config class with
different options. Since it is a singleton, later contructions won't
get the new options. Fix this by implementing a new method for setting
options instance.
üst 90bdbf40
......@@ -76,5 +76,5 @@ sys.setdefaultencoding('utf-8')
atexit.register(_cleanup)
ctx.config = pisi.config.Config(pisi.config.Options())
ctx.config = pisi.config.Config()
init_logging()
......@@ -150,7 +150,7 @@ def set_options(options):
options.verbose # flag controlling verbosity of the output messages
options.output_dir # build and delta operations package output directory
"""
ctx.config = pisi.config.Config(options)
ctx.config.set_options(options)
def list_needs_restart():
"""
......
......@@ -46,7 +46,7 @@ class Config(object):
__metaclass__ = pisi.util.Singleton
def __init__(self, options = Options()):
self.options = options
self.set_options(options)
self.values = pisi.configfile.ConfigurationFile("/etc/pisi/pisi.conf")
destdir = self.get_option('destdir')
......@@ -66,6 +66,9 @@ class Config(object):
# build process.
self.environ = copy.deepcopy(os.environ)
def set_options(self, options):
self.options = options
def set_option(self, opt, val):
setattr(self.options, opt, val)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment