Add support for parsing EAPI labels in contained in 'eapi' files in the
authorZac Medico <zmedico@gentoo.org>
Mon, 24 Nov 2008 00:50:07 +0000 (00:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 24 Nov 2008 00:50:07 +0000 (00:50 -0000)
profiles, and bail out if the profile contains an unsupported EAPI value
in any one of it's directories. We don't necessarily have to use this but
at least it gives us some way to make emerge bail out early if a profile
contains unsupported EAPI features.

svn path=/main/trunk/; revision=12068

pym/portage/__init__.py

index c12f58056009e371b70714f3df4f6deccebab81f..471e74365703942ccaea3bc5b9b26bc71bc80e21 100644 (file)
@@ -1197,6 +1197,17 @@ class config(object):
                                self.profiles = []
                                def addProfile(currentPath):
                                        parentsFile = os.path.join(currentPath, "parent")
+                                       eapi_file = os.path.join(currentPath, "eapi")
+                                       try:
+                                               eapi = open(eapi_file).readline().strip()
+                                       except IOError:
+                                               pass
+                                       else:
+                                               if not eapi_is_supported(eapi):
+                                                       raise portage.exception.ParseError(
+                                                               "Profile contains unsupported " + \
+                                                               "EAPI '%s': '%s'" % \
+                                                               (eapi, os.path.realpath(eapi_file),))
                                        if os.path.exists(parentsFile):
                                                parents = grabfile(parentsFile)
                                                if not parents: