From: antarus Date: Tue, 28 Aug 2007 09:52:53 +0000 (-0000) Subject: Fix up bug found by phreak, (thanks). Fix has_key usage. Delete global x var. ... X-Git-Tag: gentoolkit-0.2.4.3~81 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=321eff7695cb2438de003ab4173130da64fe97c3;p=gentoolkit.git Fix up bug found by phreak, (thanks). Fix has_key usage. Delete global x var. Rename vars -> variables (vars is a python builtin). Remove exception handling where it didn't look needed. svn path=/; revision=432 --- diff --git a/trunk/src/genpkgindex/genpkgindex b/trunk/src/genpkgindex/genpkgindex index 581b87d..c079b83 100644 --- a/trunk/src/genpkgindex/genpkgindex +++ b/trunk/src/genpkgindex/genpkgindex @@ -15,6 +15,7 @@ if getattr(__builtins__, "set", None) is None: for x in ['CFLAGS','CXXFLAGS', 'LDFLAGS','USE']: os.environ[x] = '' +del x os.environ["USE_EXPAND"] = "-*" @@ -214,21 +215,14 @@ def getallpkgs(): return packages def genpkgindex_header(fp, packages): - try: - import re - profilever = os.path.normpath("///"+os.readlink("/etc/make.profile")) - basepath = os.path.normpath("///"+portage.settings["PORTDIR"]+"/profiles") - if re.match(basepath,profilever): - profilever = profilever[len(basepath)+1:] - else: - profilever = "!"+profilever - - del basepath - - except SystemExit, e: - raise # Needed else can't exit - except: - profilever="unavailable" + import re + profilever = os.path.normpath("///"+os.readlink("/etc/make.profile")) + basepath = os.path.normpath("///"+portage.settings["PORTDIR"]+"/profiles") + if re.match(basepath,profilever): + profilever = profilever[len(basepath)+1:] + else: + profilever = "!"+profilever + del basepath timestamp = str(time.time()).split(".")[0] fp.write("# This file was auto generated by " + os.path.basename(sys.argv[0]) + "\n") @@ -238,16 +232,14 @@ def genpkgindex_header(fp, packages): fp.write("TIMESTAMP: "+timestamp+"\n") vmask = [ "AUTOCLEAN", "DISTDIR", "PKGDIR", "PORTDIR" , "PORTAGE_TMPDIR" , "PORTAGE_RSYNC_OPTS" ] - vars = portage_util.grabfile(portage.settings["PORTDIR"]+"/profiles/info_vars") - for x in vmask: - vars.remove(x) - - vars.sort() - - for x in vars: - if portage.settings.has_key(x): - if (len(portage.settings[x])): - fp.write(x+": "+portage.settings[x]+"\n") + variables = portage_util.grabfile(portage.settings["PORTDIR"]+"/profiles/info_vars") + variables = [v for v in variables if v not in vmask] + variables.sort() + + for var in variables: + if var in portage.settings: + if (len(portage.settings[var])): + fp.write(var+": "+portage.settings[var]+"\n") else: fp.write("PACKAGES: "+str(len(packages)) +"\n") fp.write("TIMESTAMP: "+timestamp+"\n") @@ -322,7 +314,6 @@ def genpkgindex(packages): os.rename(".Packages", "Packages") - def main(): update_pkgdir()