# 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
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: