[yum-git] Branch 'yum-3_2_X' - yum/config.py

James Antill james at linux.duke.edu
Fri Jul 25 14:25:07 UTC 2008


 yum/config.py |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 40400da05c504e4411625eeebbd1bdc87b6114c1
Author: James Antill <james at and.org>
Date:   Fri Jul 25 10:25:00 2008 -0400

    Use repo instead of repository as the canonical option name for gpgcheck

diff --git a/yum/config.py b/yum/config.py
index 1708d50..e5fe0c3 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -331,11 +331,14 @@ class FloatOption(Option):
 class SelectionOption(Option):
     '''Handles string values where only specific values are allowed
     '''
-    def __init__(self, default=None, allowed=()):
+    def __init__(self, default=None, allowed=(), mapper={}):
         super(SelectionOption, self).__init__(default)
         self._allowed = allowed
+        self._mapper  = mapper
         
     def parse(self, s):
+        if s in self._mapper:
+            s = self._mapper[s]
         if s not in self._allowed:
             raise ValueError('"%s" is not an allowed value' % s)
         return s
@@ -623,7 +626,9 @@ class YumConf(StartupConf):
     keepalive = BoolOption(True)
     gpgcheck = CaselessSelectionOption('false', ('0', 'no', 'false',
                                                  '1', 'yes', 'true',
-                                                 'packages', 'repository'))
+                                                 'packages', 'repo'),
+                                       {'pkgs'       : 'packages',
+                                        'repository' : 'repo'})
     obsoletes = BoolOption(False)
     showdupesfromrepos = BoolOption(False)
     enabled = BoolOption(True)



More information about the Yum-cvs-commits mailing list