diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-11-07 14:45:59 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-11-23 18:00:41 -0800 |
commit | f767b79d535793c6f35e922cc17aa1b5df9f8586 (patch) | |
tree | d28ecabeae3a480cbbbcf3265e67ab6e797d92b6 /pym | |
parent | 2feb616c51299ec486555a1fe86789724dfbbe54 (diff) | |
download | portage-f767b79d535793c6f35e922cc17aa1b5df9f8586.tar.gz portage-f767b79d535793c6f35e922cc17aa1b5df9f8586.tar.bz2 portage-f767b79d535793c6f35e922cc17aa1b5df9f8586.zip |
Move _get_use* calls out of loops.
Diffstat (limited to 'pym')
-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") |