Fix commit c8a850685232b938cf0896fc2d80e72d57edad17 to re-use the keys
from _SUBMODULE_PATH_MAP for option choices.

Fixes: c8a850685232 ("Add --sync-submodule <glsa|news|profiles> (534070)")
Suggested-by: Brian Dolbec <dol...@gentoo.org>
---
 pym/_emerge/main.py                         | 3 ++-
 pym/portage/emaint/modules/sync/__init__.py | 4 +++-
 pym/portage/sync/__init__.py                | 7 +++++++
 pym/portage/sync/syncbase.py                | 7 +------
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 93c1a15..3fcfcbf 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -20,6 +20,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
 )
 from portage import os
 from portage.util._argparse import ArgumentParser
+from portage.sync import _SUBMODULE_PATH_MAP
 
 if sys.hexversion >= 0x3000000:
        long = int
@@ -636,7 +637,7 @@ def parse_opts(tmpcmdline, silent=False):
                "--sync-submodule": {
                        "help"    : ("Restrict sync to the specified 
submodule(s)."
                                " (--sync action only)"),
-                       "choices" : ("glsa", "news", "profiles"),
+                       "choices" : tuple(_SUBMODULE_PATH_MAP),
                        "action" : "append",
                },
 
diff --git a/pym/portage/emaint/modules/sync/__init__.py 
b/pym/portage/emaint/modules/sync/__init__.py
index 620861f..2fc8d34 100644
--- a/pym/portage/emaint/modules/sync/__init__.py
+++ b/pym/portage/emaint/modules/sync/__init__.py
@@ -1,6 +1,8 @@
 # Copyright 2014-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+from ....sync import _SUBMODULE_PATH_MAP
+
 doc = """Check repos.conf settings and sync repositories."""
 __doc__ = doc[:]
 
@@ -43,7 +45,7 @@ module_spec = {
                                        "long": "--sync-submodule",
                                        "help": ("(sync module only): Restrict 
sync "
                                                "to the specified 
submodule(s)"),
-                                       "choices": ("glsa", "news", "profiles"),
+                                       "choices": tuple(_SUBMODULE_PATH_MAP),
                                        "action": "append",
                                        "dest": "sync_submodule",
                                        },
diff --git a/pym/portage/sync/__init__.py b/pym/portage/sync/__init__.py
index 0f6c566..e01f993 100644
--- a/pym/portage/sync/__init__.py
+++ b/pym/portage/sync/__init__.py
@@ -3,10 +3,17 @@
 
 import os
 
+from portage import OrderedDict
 from portage.module import Modules
 from portage.sync.controller import SyncManager
 from portage.sync.config_checks import check_type
 
+_SUBMODULE_PATH_MAP = OrderedDict([
+       ('glsa', 'metadata/glsa'),
+       ('news', 'metadata/news'),
+       ('profiles', 'profiles'),
+])
+
 path = os.path.join(os.path.dirname(__file__), "modules")
 # initial development debug info
 #print("module path:", path)
diff --git a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py
index 9506616..04db2d0 100644
--- a/pym/portage/sync/syncbase.py
+++ b/pym/portage/sync/syncbase.py
@@ -11,12 +11,7 @@ import os
 
 import portage
 from portage.util import writemsg_level
-
-_SUBMODULE_PATH_MAP = {
-       'glsa': 'metadata/glsa',
-       'news': 'metadata/news',
-       'profiles': 'profiles',
-}
+from . import _SUBMODULE_PATH_MAP
 
 class SyncBase(object):
        '''Base Sync class for subclassing'''
-- 
2.0.5


Reply via email to