Use eapi_has_required_use for REQUIRED_USE eapi checks
authorSebastian Luther <SebastianLuther@gmx.de>
Wed, 11 Aug 2010 08:35:07 +0000 (10:35 +0200)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Aug 2010 08:54:39 +0000 (01:54 -0700)
bin/repoman
pym/_emerge/depgraph.py
pym/portage/eapi.py

index e6c281eac8cd7e75e7427125c1e6ca10b1fc7c29..09e7f02f15e3cdccbafe0fae3fd34edb2abeeb8a 100755 (executable)
@@ -73,7 +73,8 @@ from portage.output import ConsoleStyleFile, StyleWriter
 from portage.util import cmp_sort_key, writemsg_level
 from portage.package.ebuild.digestgen import digestgen
 from portage.eapi import eapi_has_src_uri_arrows, eapi_has_slot_deps, \
-       eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_iuse_defaults
+       eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_iuse_defaults, \
+       eapi_has_required_use
 
 if sys.hexversion >= 0x3000000:
        basestring = str
@@ -1774,7 +1775,7 @@ for x in scanlist:
                #REQUIRED_USE check
                required_use = myaux["REQUIRED_USE"]
                if required_use:
-                       if eapi in ("0", "1", "2", "3"):
+                       if not eapi_has_required_use(eapi):
                                stats['EAPI.incompatible'] += 1
                                fails['EAPI.incompatible'].append(
                                        relative_path + ": REQUIRED_USE" + \
index 7a717df032bedbb765c2a611b4243b3575f790ef..c66072835d17547bc447b64802e0ebe1029374f5 100644 (file)
@@ -17,7 +17,7 @@ from portage.const import PORTAGE_PACKAGE_ATOM
 from portage.dbapi import dbapi
 from portage.dbapi.dep_expand import dep_expand
 from portage.dep import Atom
-from portage.eapi import eapi_has_strong_blocks
+from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use
 from portage.output import bold, blue, colorize, create_color_func, darkblue, \
        darkgreen, green, nc_len, red, teal, turquoise, yellow
 bad = create_color_func("BAD")
@@ -2826,7 +2826,7 @@ class depgraph(object):
 
                                        #check REQUIRED_USE constraints
                                        if not pkg.built and pkg.metadata["REQUIRED_USE"] and \
-                                               pkg.metadata["EAPI"] not in ("0", "1", "2", "3"):
+                                               eapi_has_required_use(pkg.metadata["EAPI"]):
                                                required_use = pkg.metadata["REQUIRED_USE"]
                                                use = pkg.use.enabled
                                                iuse = self._frozen_config.settings._get_implicit_iuse()
@@ -6184,7 +6184,7 @@ def _get_masking_status(pkg, pkgsettings, root_config):
                                                _MaskReason("invalid", "invalid: %s" % (msg,)))
 
                if pkg.metadata["REQUIRED_USE"] and \
-                       pkg.metadata["EAPI"] not in ("0", "1", "2", "3"):
+                       eapi_has_required_use(pkg.metadata["EAPI"]):
                        required_use = pkg.metadata["REQUIRED_USE"]
                        use = pkg.use.enabled
                        iuse = pkgsettings._get_implicit_iuse()
index 9f33943796094a73c68a9ceb64e487cda273c471..a288b1964299266da70d9e9a0039afdd058c7cb4 100644 (file)
@@ -39,3 +39,6 @@ def eapi_has_implicit_rdepend(eapi):
 
 def eapi_has_dosed_dohard(eapi):
        return eapi in ("0", "1", "2", "3")
+
+def eapi_has_required_use(eapi):
+       return eapi not in ("0", "1", "2", "3")