Read profile EAPI earlier.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Fri, 21 Sep 2012 04:30:12 +0000 (06:30 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Fri, 21 Sep 2012 04:30:12 +0000 (06:30 +0200)
pym/portage/package/ebuild/_config/LocationsManager.py

index 365d507f71f9f86f100e9a06c3b7b9fe49fe5cf2..2200be694f2458c87505bb9a3c8cf6722679cbcb 100644 (file)
@@ -130,6 +130,26 @@ class LocationsManager(object):
                allow_parent_colon = True
                repo_loc = None
                compat_mode = False
+
+               eapi_file = os.path.join(currentPath, "eapi")
+               f = None
+               try:
+                       f = io.open(_unicode_encode(eapi_file,
+                               encoding=_encodings['fs'], errors='strict'),
+                               mode='r', encoding=_encodings['content'], errors='replace')
+                       eapi = f.readline().strip()
+               except IOError:
+                       pass
+               else:
+                       if not eapi_is_supported(eapi):
+                               raise ParseError(_(
+                                       "Profile contains unsupported "
+                                       "EAPI '%s': '%s'") % \
+                                       (eapi, os.path.realpath(eapi_file),))
+               finally:
+                       if f is not None:
+                               f.close()
+
                intersecting_repos = [x for x in known_repos if current_abs_path.startswith(x[0])]
                if intersecting_repos:
                        # protect against nested repositories.  Insane configuration, but the longest
@@ -156,24 +176,6 @@ class LocationsManager(object):
                                                files=', '.join(offenders)))
 
                parentsFile = os.path.join(currentPath, "parent")
-               eapi_file = os.path.join(currentPath, "eapi")
-               f = None
-               try:
-                       f = io.open(_unicode_encode(eapi_file,
-                               encoding=_encodings['fs'], errors='strict'),
-                               mode='r', encoding=_encodings['content'], errors='replace')
-                       eapi = f.readline().strip()
-               except IOError:
-                       pass
-               else:
-                       if not eapi_is_supported(eapi):
-                               raise ParseError(_(
-                                       "Profile contains unsupported "
-                                       "EAPI '%s': '%s'") % \
-                                       (eapi, os.path.realpath(eapi_file),))
-               finally:
-                       if f is not None:
-                               f.close()
                if os.path.exists(parentsFile):
                        parents = grabfile(parentsFile)
                        if not parents: