From: Andrew Gaffney Date: Tue, 25 Sep 2007 22:28:21 +0000 (+0000) Subject: when parsing make.conf, first try pkgcore's snakeoil.fileutils.read_bash_dict(),... X-Git-Tag: CATALYST_2_0_6_916~249 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3572c669c5412bccb71d75cc10e3c9b30199dbeb;p=catalyst.git when parsing make.conf, first try pkgcore's snakeoil.fileutils.read_bash_dict(), then portage's portage_util.getconfig(), then the internal parse_makeconf() git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1245 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index 15ff628e..c0416c18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 # $Id: $ + 25 Sep 2007; Andrew Gaffney + 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 modules/catalyst_support.py: raise an exception in parse_spec() if there's a duplicate key in the spec diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py index 6943cfed..da40a5ac 100644 --- a/modules/catalyst_support.py +++ b/modules/catalyst_support.py @@ -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: