Use immutable object attrubutes instead of tuples, for extensibility.
global_accept_keywords=""):
self._pkeywords_list = []
rawpkeywords = [grabdict_package(
- os.path.join(x[0], "package.keywords"), recursive=x[1],
+ os.path.join(x.location, "package.keywords"),
+ recursive=x.portage1_directories,
verify_eapi=True) \
for x in profiles]
for pkeyworddict in rawpkeywords:
self._p_accept_keywords = []
raw_p_accept_keywords = [grabdict_package(
- os.path.join(x[0], "package.accept_keywords"), recursive=x[1],
+ os.path.join(x.location, "package.accept_keywords"),
+ recursive=x.portage1_directories,
verify_eapi=True) \
for x in profiles]
for d in raw_p_accept_keywords:
'package.use', 'package.use.mask', 'package.use.force',
'use.mask', 'use.force'])
+class _profile_node(object):
+
+ __slots__ = ('location', 'portage1_directories')
+
+ def __init__(self, location, portage1_directories):
+ object.__setattr__(self, 'location', location)
+ object.__setattr__(self, 'portage1_directories', portage1_directories)
+
+ def __setattr__(self, name, value):
+ raise AttributeError("_profile_node instances are immutable",
+ self.__class__, name, value)
+
class LocationsManager(object):
def __init__(self, config_root=None, eprefix=None, config_profile_path=None, local_config=True, \
if os.path.exists(custom_prof):
self.user_profile_dir = custom_prof
self.profiles.append(custom_prof)
- self.profiles_complex.append((custom_prof, True))
+ self.profiles_complex.append(_profile_node(custom_prof, True))
del custom_prof
self.profiles = tuple(self.profiles)
(parentPath, parentsFile))
self.profiles.append(currentPath)
- self.profiles_complex.append((currentPath, allow_directories))
+ self.profiles_complex.append(
+ _profile_node(currentPath, allow_directories))
def set_root_override(self, root_overwrite=None):
# Allow ROOT setting to come from make.conf if it's not overridden
#to allow profiles to override masks from their parent profiles.
profile_pkgmasklines = []
profile_pkgunmasklines = []
- for x, portage1_mode in profiles:
+ for x in profiles:
profile_pkgmasklines.append(grabfile_package(
- os.path.join(x, "package.mask"), recursive=portage1_mode, remember_source_file=True, verify_eapi=True))
- if portage1_mode:
+ os.path.join(x.location, "package.mask"),
+ recursive=x.portage1_directories,
+ remember_source_file=True, verify_eapi=True))
+ if x.portage1_directories:
profile_pkgunmasklines.append(grabfile_package(
- os.path.join(x, "package.unmask"), recursive=1, remember_source_file=True, verify_eapi=True))
+ os.path.join(x.location, "package.unmask"),
+ recursive=x.portage1_directories,
+ remember_source_file=True, verify_eapi=True))
profile_pkgmasklines = stack_lists(profile_pkgmasklines, incremental=1, \
remember_source_file=True, warn_for_unmatched_removal=True,
strict_warn_for_unmatched_removal=strict_umatched_removal)
return ret
def _parse_profile_files_to_tuple_of_tuples(self, file_name, locations):
- return tuple(self._parse_file_to_tuple(os.path.join(profile[0], file_name), recursive=profile[1])
+ return tuple(self._parse_file_to_tuple(
+ os.path.join(profile.location, file_name),
+ recursive=profile.portage1_directories)
for profile in locations)
def _parse_profile_files_to_tuple_of_dicts(self, file_name, locations, juststrings=False):
- return tuple(self._parse_file_to_dict(os.path.join(profile[0], file_name), juststrings, recursive=profile[1])
+ return tuple(self._parse_file_to_dict(
+ os.path.join(profile.location, file_name), juststrings,
+ recursive=profile.portage1_directories)
for profile in locations)
def getUseMask(self, pkg=None):
archlist = stack_lists(archlist, incremental=1)
self.configdict["conf"]["PORTAGE_ARCHLIST"] = " ".join(archlist)
- pkgprovidedlines = [grabfile(os.path.join(loc, "package.provided"), recursive=recursive)
- for loc, recursive in self.profiles_complex]
+ pkgprovidedlines = [grabfile(
+ os.path.join(x.location, "package.provided"),
+ recursive=x.portage1_directories)
+ for x in self.profiles_complex]
pkgprovidedlines = stack_lists(pkgprovidedlines, incremental=1)
has_invalid_data = False
for x in range(len(pkgprovidedlines)-1, -1, -1):