diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-09-09 16:41:01 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-09 16:41:01 -0700 |
commit | 09376d04b34066987d4b5b243b215ca6b1c14aed (patch) | |
tree | fd2cde818464af40b5fdbfae63d791981e12c643 | |
parent | 33f0c0b3a1fc817e44a770c5eb1d3b0f36a94da4 (diff) | |
download | portage-09376d04b34066987d4b5b243b215ca6b1c14aed.tar.gz portage-09376d04b34066987d4b5b243b215ca6b1c14aed.tar.bz2 portage-09376d04b34066987d4b5b243b215ca6b1c14aed.zip |
Make Package.metadata.defined_phases return all possible phases when
DEFINED_PHASES is undefined. This makes it easy to do containment
checks to see if it's safe to skip execution of a given phase.
-rw-r--r-- | pym/_emerge/Package.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 0a4f2ab7a..d0b0e4918 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -5,6 +5,7 @@ import sys from itertools import chain import portage from portage.cache.mappings import slot_dict_class +from portage.const import EBUILD_PHASES from portage.dep import Atom, check_required_use, use_reduce, \ paren_enclose, _slot_re from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use @@ -490,4 +491,13 @@ class _PackageMetadataWrapper(_PackageMetadataWrapperBase): @property def defined_phases(self): - return self['DEFINED_PHASES'].split() + """ + Returns tokens from DEFINED_PHASES metadata if it is defined, + otherwise returns a tuple containing all possible phases. This + makes it easy to do containment checks to see if it's safe to + skip execution of a given phase. + """ + s = self['DEFINED_PHASES'] + if s: + return s.split() + return EBUILD_PHASES |