RepoConfig: cleanup portage1_profiles code v2.2.0_alpha106
authorZac Medico <zmedico@gentoo.org>
Wed, 16 May 2012 20:47:26 +0000 (13:47 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 16 May 2012 20:47:26 +0000 (13:47 -0700)
pym/portage/package/ebuild/_config/LocationsManager.py
pym/portage/repository/config.py

index 337edc4ce18120ae985ca06d4e86d0d79b989ad8..1293c7556c7953e8a3e610c639e7541eaae31582 100644 (file)
@@ -17,7 +17,8 @@ from portage.exception import DirectoryNotFound, ParseError
 from portage.localization import _
 from portage.util import ensure_dirs, grabfile, \
        normalize_path, shlex_split, writemsg
-from portage.repository.config import parse_layout_conf
+from portage.repository.config import parse_layout_conf, \
+       _portage1_profiles_allow_directories
 
 
 _PORTAGE1_DIRECTORIES = frozenset([
@@ -28,9 +29,6 @@ _PORTAGE1_DIRECTORIES = frozenset([
 _profile_node = collections.namedtuple('_profile_node',
        'location portage1_directories')
 
-_allow_directories = frozenset(
-       ["portage-1-compat", "portage-1"])
-
 class LocationsManager(object):
 
        def __init__(self, config_root=None, eprefix=None, config_profile_path=None, local_config=True, \
@@ -133,7 +131,7 @@ class LocationsManager(object):
                        # protect against nested repositories.  Insane configuration, but the longest
                        # path will be the correct one.
                        repo_loc, layout_data = max(intersecting_repos, key=lambda x:len(x[0]))
-                       allow_directories = any(x in _allow_directories
+                       allow_directories = any(x in _portage1_profiles_allow_directories
                                for x in layout_data['profile-formats'])
                        compat_mode = layout_data['profile-formats'] == ('portage-1-compat',)
 
index 872c189443d63a66036f26ed37829f72f948850d..cb5beca7f191422697d445667958eeabeaa6a879 100644 (file)
@@ -30,6 +30,9 @@ from portage import manifest
 _valid_profile_formats = frozenset(
        ['pms', 'portage-1'])
 
+_portage1_profiles_allow_directories = frozenset(
+       ["portage-1-compat", "portage-1"])
+
 _repo_name_sub_re = re.compile(r'[^\w-]')
 
 def _gen_valid_repo(name):
@@ -160,7 +163,7 @@ class RepoConfig(object):
                                'sign-commit', 'sign-manifest', 'thin-manifest', 'update-changelog'):
                                setattr(self, value.lower().replace("-", "_"), layout_data[value])
 
-                       self.portage1_profiles = any(x.startswith("portage-1") \
+                       self.portage1_profiles = any(x in _portage1_profiles_allow_directories
                                for x in layout_data['profile-formats'])
                        self.portage1_profiles_compat = layout_data['profile-formats'] == ('portage-1-compat',)