Make config optional
For some methods the config is not needed at all, so requiring it is quite obnoxious. For runtime and devel methods we also sometimes don't want to pass in any config, so it should be optional. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
627e642f41
commit
34523a104f
1 changed files with 17 additions and 10 deletions
|
|
@ -56,7 +56,7 @@ class MultilibMethod(object):
|
|||
|
||||
class NoMultilibMethod(object):
|
||||
|
||||
def __init__(self, config):
|
||||
def __init__(self, config=None):
|
||||
self.name = 'none'
|
||||
|
||||
def select(self, po):
|
||||
|
|
@ -65,7 +65,7 @@ class NoMultilibMethod(object):
|
|||
|
||||
class AllMultilibMethod(MultilibMethod):
|
||||
|
||||
def __init__(self, config):
|
||||
def __init__(self, config=None):
|
||||
self.name = 'all'
|
||||
|
||||
def select(self, po):
|
||||
|
|
@ -89,7 +89,7 @@ class FileMultilibMethod(MultilibMethod):
|
|||
|
||||
class KernelMultilibMethod(object):
|
||||
|
||||
def __init__(self, config):
|
||||
def __init__(self, config=None):
|
||||
self.name = 'base'
|
||||
|
||||
def select(self, po):
|
||||
|
|
@ -104,7 +104,7 @@ class KernelMultilibMethod(object):
|
|||
|
||||
class YabootMultilibMethod(object):
|
||||
|
||||
def __init__(self, config):
|
||||
def __init__(self, config=None):
|
||||
self.name = 'base'
|
||||
|
||||
def select(self, po):
|
||||
|
|
@ -140,10 +140,14 @@ class RuntimeMultilibMethod(MultilibMethod):
|
|||
|
||||
def __init__(self, config='/etc/multilib.conf'):
|
||||
self.name = 'runtime'
|
||||
self.cp = configparser.ConfigParser()
|
||||
self.cp.readfp(open(config, 'r'))
|
||||
self.runtime_whitelist = self.cp.get(self.name, 'white')
|
||||
self.runtime_blacklist = self.cp.get(self.name, 'black')
|
||||
self.cp = None
|
||||
self.runtime_whitelist = []
|
||||
self.runtime_blacklist = []
|
||||
if config:
|
||||
self.cp = configparser.ConfigParser()
|
||||
self.cp.readfp(open(config, 'r'))
|
||||
self.runtime_whitelist = self.cp.get(self.name, 'white')
|
||||
self.runtime_blacklist = self.cp.get(self.name, 'black')
|
||||
|
||||
def select(self, po):
|
||||
if po.name in self.runtime_blacklist:
|
||||
|
|
@ -234,8 +238,11 @@ class DevelMultilibMethod(RuntimeMultilibMethod):
|
|||
def __init__(self, config='/etc/multilib.conf'):
|
||||
super(DevelMultilibMethod, self).__init__(config)
|
||||
self.name = 'devel'
|
||||
self.devel_whitelist = self.cp.get(self.name, 'white')
|
||||
self.devel_blacklist = self.cp.get(self.name, 'black')
|
||||
self.devel_whitelist = []
|
||||
self.devel_blacklist = []
|
||||
if self.cp:
|
||||
self.devel_whitelist = self.cp.get(self.name, 'white')
|
||||
self.devel_blacklist = self.cp.get(self.name, 'black')
|
||||
|
||||
def select(self, po):
|
||||
if po.name in self.devel_blacklist:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue