when parsing make.conf, first try pkgcore's snakeoil.fileutils.read_bash_dict(),...
authorAndrew Gaffney <agaffney@gentoo.org>
Tue, 25 Sep 2007 22:28:21 +0000 (22:28 +0000)
committerAndrew Gaffney <agaffney@gentoo.org>
Tue, 25 Sep 2007 22:28:21 +0000 (22:28 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1245 d1e1f19c-881f-0410-ab34-b69fee027534

ChangeLog
modules/catalyst_support.py

index 15ff628eb5d3703d976d73ff5a121390c43fe382..c0416c18c9b8d7a9c18101143d883b10213d1c7c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
 # $Id: $
 
+  25 Sep 2007; Andrew Gaffney <agaffney@gentoo.org>
+  modules/catalyst_support.py:
+  when parsing make.conf, first try pkgcore's
+  snakeoil.fileutils.read_bash_dict(), then portage's
+  portage_util.getconfig(), then the internal parse_makeconf()
+
   06 Sep 2007; Andrew Gaffney <agaffney@gentoo.org>
   modules/catalyst_support.py:
   raise an exception in parse_spec() if there's a duplicate key in the spec
index 6943cfeddd2219a268a39e454a555a50089a7e15..da40a5ac1b2adfb6a0bc0b1ed4917e2403a81d59 100644 (file)
@@ -634,16 +634,24 @@ def read_spec(myspecfile):
 
 def read_makeconf(mymakeconffile):
        if os.path.exists(mymakeconffile):
-           try:
-                   myf=open(mymakeconffile,"r")
-                   mylines=myf.readlines()
-                   myf.close()
-                   return parse_makeconf(mylines)
-           except:
-                   raise CatalystError, "Could not open make.conf file "+mymakeconffile
+               try:
+                       try:
+                               import snakeoil.fileutils
+                               return snakeoil.fileutils.read_bash_dict(mymakeconffile, sourcing_command="source")
+                       except ImportError:
+                               try:
+                                       import portage_util
+                                       return portage_util.getconfig(mymakeconffile, tolerant=1, allow_sourcing=True)
+                               except ImportError:
+                                       myf=open(mymakeconffile,"r")
+                                       mylines=myf.readlines()
+                                       myf.close()
+                                       return parse_makeconf(mylines)
+               except:
+                       raise CatalystError, "Could not parse make.conf file "+mymakeconffile
        else:
-           makeconf={}
-           return makeconf
+               makeconf={}
+               return makeconf
        
 def msg(mymsg,verblevel=1):
        if verbosity>=verblevel: