From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D53FC13838B for ; Fri, 19 Sep 2014 18:13:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 09E7BE083A; Fri, 19 Sep 2014 18:13:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7929CE083A for ; Fri, 19 Sep 2014 18:13:03 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7DA8234025D for ; Fri, 19 Sep 2014 18:13:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9F75FE8E for ; Fri, 19 Sep 2014 18:13:00 +0000 (UTC) From: "Devan Franchini" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Devan Franchini" Message-ID: <1411082637.6f8ff85d752f7cbadb9c41e21f43775c902fada7.twitch153@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/argsparser.py X-VCS-Directories: layman/ X-VCS-Committer: twitch153 X-VCS-Committer-Name: Devan Franchini X-VCS-Revision: 6f8ff85d752f7cbadb9c41e21f43775c902fada7 X-VCS-Branch: master Date: Fri, 19 Sep 2014 18:13:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: bfc06c63-21b8-4cc9-a235-9e94bf8d9182 X-Archives-Hash: a13d31b0f7264159e58650521abfa9be commit: 6f8ff85d752f7cbadb9c41e21f43775c902fada7 Author: Devan Franchini gentoo org> AuthorDate: Thu Sep 18 23:23:57 2014 +0000 Commit: Devan Franchini gentoo org> CommitDate: Thu Sep 18 23:23:57 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6f8ff85d argparser.py: Fixes override of overlay_defs config option --- layman/argsparser.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/layman/argsparser.py b/layman/argsparser.py index 9c29b47..6aeda44 100644 --- a/layman/argsparser.py +++ b/layman/argsparser.py @@ -277,7 +277,7 @@ class ArgsParser(BareConfig): self.options = self.parser.parse_args() self.options = vars(self.options) # Applying interpolation of values - for v in ['configdir', 'config', 'overlay_defs']: + for v in ['configdir', 'config']: self.options[v] = self.options[v] % self.options self.defaults[v] = self.options[v] @@ -302,11 +302,6 @@ class ArgsParser(BareConfig): self.defaults['config'] = self.defaults['config'] \ % {'configdir': self.defaults['configdir']} - if self.options['overlay_defs'] is not None: - self.defaults['overlay_defs'] = self.options['overlay_defs'] - self.output.debug('ARGSPARSER: Got overlay_defs location at ' + \ - self.defaults['overlay_defs'], 8) - self._options['setup_help'] = self.options['setup_help'] # Now parse the config file @@ -314,6 +309,21 @@ class ArgsParser(BareConfig): self.defaults['config'], 8) self.read_config(self.defaults) + + # Handle the overlay_defs option: + if ('%(configdir)s' in self.options['overlay_defs'] + and self.config.has_option('MAIN', 'overlay_defs')): + # If it hasn't been interpolated then it's not being set as a + # command line argument. So we first try to set it to the config + # value. + self.options['overlay_defs'] = self.config.get('MAIN', + 'overlay_defs') + elif self.defaults['overlay_defs'] == self.options['overlay_defs']: + # If it isn't a command line argument and no config option then + # set it to the default. + self.defaults['overlay_defs'] = self.defaults['overlay_defs'] % self.options + self.options['overlay_defs'] = self.defaults['overlay_defs'] + # handle quietness if self.options['quiet']: self.set_option('quiet', True)