From f39ac7dc706544d1f36392c7def6da0b9b6bebcf Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 16 May 2012 13:47:26 -0700 Subject: [PATCH] RepoConfig: cleanup portage1_profiles code --- pym/portage/package/ebuild/_config/LocationsManager.py | 8 +++----- pym/portage/repository/config.py | 5 ++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py index 337edc4ce..1293c7556 100644 --- a/pym/portage/package/ebuild/_config/LocationsManager.py +++ b/pym/portage/package/ebuild/_config/LocationsManager.py @@ -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',) diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 872c18944..cb5beca7f 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -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',) -- 2.26.2