Allow user to set a ~/.pungirc for some defaults
Merges: #64 Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
This commit is contained in:
parent
1a16d94dda
commit
10b93796bd
@ -21,7 +21,11 @@ import selinux
|
|||||||
def main():
|
def main():
|
||||||
|
|
||||||
config = pungi.config.Config()
|
config = pungi.config.Config()
|
||||||
|
(opts, args) = get_arguments(config)
|
||||||
|
|
||||||
|
# Read the config to create "new" defaults
|
||||||
|
# reparse command line options so they take precedence
|
||||||
|
config = pungi.config.Config(pungirc=opts.pungirc)
|
||||||
(opts, args) = get_arguments(config)
|
(opts, args) = get_arguments(config)
|
||||||
|
|
||||||
# You must be this high to ride if you're going to do root tasks
|
# You must be this high to ride if you're going to do root tasks
|
||||||
@ -297,7 +301,9 @@ if __name__ == '__main__':
|
|||||||
action="callback", callback=set_config, callback_args=(config, ),
|
action="callback", callback=set_config, callback_args=(config, ),
|
||||||
help='Which files are the release notes -- GPL EULA')
|
help='Which files are the release notes -- GPL EULA')
|
||||||
parser.add_option("--nomacboot", action="store_true", dest="nomacboot", help='disable setting up macboot as no hfs support ')
|
parser.add_option("--nomacboot", action="store_true", dest="nomacboot", help='disable setting up macboot as no hfs support ')
|
||||||
|
parser.add_option("--pungirc", dest="pungirc", default='~/.pungirc',
|
||||||
|
action="callback", callback=set_config, callback_args=(config, ),
|
||||||
|
help='Read pungi options from config file ')
|
||||||
|
|
||||||
(opts, args) = parser.parse_args()
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ MULTILIBCONF = (os.path.join(os.path.dirname(here), 'share', 'multilib')
|
|||||||
|
|
||||||
|
|
||||||
class Config(SafeConfigParser):
|
class Config(SafeConfigParser):
|
||||||
def __init__(self):
|
def __init__(self, pungirc=None):
|
||||||
SafeConfigParser.__init__(self)
|
SafeConfigParser.__init__(self)
|
||||||
|
|
||||||
self.add_section('pungi')
|
self.add_section('pungi')
|
||||||
@ -67,3 +67,7 @@ class Config(SafeConfigParser):
|
|||||||
self.set('pungi', 'resolve_deps', "True")
|
self.set('pungi', 'resolve_deps', "True")
|
||||||
self.set('pungi', 'no_dvd', "False")
|
self.set('pungi', 'no_dvd', "False")
|
||||||
self.set('pungi', 'nomacboot', "False")
|
self.set('pungi', 'nomacboot', "False")
|
||||||
|
|
||||||
|
# if missing, self.read() is a noop, else change 'defaults'
|
||||||
|
if pungirc:
|
||||||
|
self.read(os.path.expanduser(pungirc))
|
||||||
|
Loading…
Reference in New Issue
Block a user