Original commit:
authorFabian Groffen <grobian@gentoo.org>
Mon, 28 Jul 2008 17:52:55 +0000 (17:52 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 28 Jul 2008 17:52:55 +0000 (17:52 -0000)
   | 11233   | Add support for an new EAPI="2_pre0" value so that people    |
   | zmedico | who want to test USE deps can set the EAPI to something      |
   |         | other than 0 or 1. We can support as many different          |
   |         | experimental EAPI values as we need, and drop support for    |
   |         | them when the final EAPI 2 is defined.                       |

Changed into a Prefix enabled version, which is more generic.  It build
further on the idea that multiple properties are being present in EAPI.
I split it up in "should have" properties ("prefix" for now) that must
be present, and "can have" properties, that may be present.  This
patch is not perfect (can have EAPI="prefix 2_pre0 1 0") but fixing that
requires more thinking (successing properties, conflicting
properties...)

svn path=/main/branches/prefix/; revision=11240

pym/portage/__init__.py

index 461a60301aea23c8be6e7399fbff453aab12de0e..f75c28ce60655a4c2819b42d060110a0e4e762dc 100644 (file)
@@ -4496,9 +4496,6 @@ def _spawn_misc_sh(mysettings, commands, **kwargs):
                        eerror(l, phase=mydo, key=mysettings.mycpv)
        return rval
 
-_eapi_prefix_re = re.compile("(^|\s*)%s($|\s*)" % portage.const.EAPIPREFIX)
-_eapi_num_re    = re.compile("(^|\s*)[0-9]+($|\s*)")
-
 def eapi_is_supported(eapi):
        # PREFIX HACK/EXTENSION: in prefix we have "incompatible" ebuilds in
        # an consistent manner; regardless what the EAPI of the main tree
@@ -4514,22 +4511,27 @@ def eapi_is_supported(eapi):
        # However, back to reality, we just look for all <desc> we require,
        # and don't do version tricks other than the main tree does.
 
-       eapi = str(eapi)
+       eapi = str(eapi).split() # note Python's contact for this special case
+
+       # these are the properties that MUST be present (should)
+       properties = []
        if portage.const.EAPIPREFIX:
-               if not _eapi_prefix_re.search(eapi):
+               properties.append(portage.const.EAPIPREFIX) # clumpsy temporary solution
+
+       for prop in properties:
+               if prop not in eapi:
                        return False
+               else:
+                       eapi.remove(prop)
+       
+       # now check if what's left is supported (can)
+       properties = [ "2_pre0" ] # another clumpsy solution
+       for i in range(portage.const.EAPI):
+               propeties.append(str(i))
 
-       m = _eapi_num_re.search(eapi)
-       if not m:
-               eapi = 0
-       else:
-               try:
-                       eapi = int(m.string[m.start():m.end()].strip())
-               except ValueError:
-                       eapi = -1
-       if eapi < 0:
-               return False
-       return eapi <= portage.const.EAPI
+       for v in eapi:
+               if v not in properties
+                       return False
 
 def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, mydbapi):