def __init__(self, fpath=None):
self.cfgparser = BrainConfigParser()
+ self.reset_from_conf(fpath)
+ def reset_from_conf(self, fpath):
if fpath:
if not os.path.exists(fpath):
- if not self._new_conf(fpath):
- msger.error('No config file available')
-
+ raise errors.ConfigError('Configuration file %s does not exist' % fpath)
fpaths = [fpath]
else:
# use the default path
optparser.add_option('-v', '--verbose', action='store_true',
dest='verbose',
help='verbose information')
+ optparser.add_option('-c', '--conf', dest='conf',
+ help='specify config file for gbs')
return optparser
def postoptparse(self):
+ from gitbuildsys.conf import configmgr
if self.options.verbose:
msger.set_loglevel('verbose')
if self.options.debug:
msger.set_loglevel('debug')
+ if self.options.conf:
+ configmgr.reset_from_conf(self.options.conf)
'''
@cmdln.alias('sr')
@cmdln.option('--changelog',
if __name__ == '__main__':
try:
- from gitbuildsys.conf import configmgr
sys.exit(Gbs().main())
except KeyboardInterrupt: