diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-11-07 14:45:59 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-11-07 14:45:59 -0800 |
commit | ac5f9017bb621d1deaab932204362bf918ffd088 (patch) | |
tree | 59ae6bffe12b46bf0c5d22b4852f809f34a3e3ef /pym/portage | |
parent | c889e072b72774beaaf8783017e3674df0895d0d (diff) | |
download | portage-ac5f9017bb621d1deaab932204362bf918ffd088.tar.gz portage-ac5f9017bb621d1deaab932204362bf918ffd088.tar.bz2 portage-ac5f9017bb621d1deaab932204362bf918ffd088.zip |
Move _get_use* calls out of loops.
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/dep/__init__.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 7ff54f6f7..ab7c2a22f 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -301,6 +301,8 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i if matchall and matchnone: raise ValueError("portage.dep.use_reduce: 'matchall' and 'matchnone' are mutually exclusive") + useflag_re = _get_useflag_re(eapi) + def is_active(conditional): """ Decides if a given use conditional is active. @@ -320,7 +322,7 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i e = InvalidData(msg, category='IUSE.missing') raise InvalidDependString(msg, errors=(e,)) else: - if _get_useflag_re(eapi).match(flag) is None: + if useflag_re.match(flag) is None: raise InvalidDependString( _("invalid use flag '%s' in conditional '%s'") % (flag, conditional)) @@ -705,9 +707,10 @@ class _use_dep(object): no_default = set() conditional = {} + usedep_re = _get_usedep_re(self.eapi) for x in use: - m = _get_usedep_re(self.eapi).match(x) + m = usedep_re.match(x) if m is None: raise InvalidAtom(_("Invalid use dep: '%s'") % (x,)) @@ -807,9 +810,10 @@ class _use_dep(object): disabled_flags = set(self.disabled) tokens = [] + usedep_re = _get_usedep_re(self.eapi) for x in self.tokens: - m = _get_usedep_re(self.eapi).match(x) + m = usedep_re.match(x) operator = m.group("prefix") + m.group("suffix") flag = m.group("flag") @@ -864,9 +868,10 @@ class _use_dep(object): def validate_flag(flag): return is_valid_flag(flag) or flag in all_defaults + usedep_re = _get_usedep_re(self.eapi) for x in self.tokens: - m = _get_usedep_re(self.eapi).match(x) + m = usedep_re.match(x) operator = m.group("prefix") + m.group("suffix") flag = m.group("flag") @@ -975,9 +980,10 @@ class _use_dep(object): missing_disabled = self.missing_disabled tokens = [] + usedep_re = _get_usedep_re(self.eapi) for x in self.tokens: - m = _get_usedep_re(self.eapi).match(x) + m = usedep_re.match(x) operator = m.group("prefix") + m.group("suffix") flag = m.group("flag") |