X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=daklib%2Futils.py;h=276ca2428fbfbf1e225785e99947418ce9469535;hb=34c082916bb247ab93b6932fea95cf324c427b7e;hp=6a0e5321545a943ea285f8e52b728335591cb5e7;hpb=e6ff9b65bc4a3db801db6ef7dd6932866c0f13ae;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py index 6a0e5321..276ca242 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -62,9 +62,9 @@ key_uid_email_cache = {} #: Cache for email addresses from gpg key uids known_hashes = [("sha1", apt_pkg.sha1sum, (1, 8)), ("sha256", apt_pkg.sha256sum, (1, 8))] #: hashes we accept for entries in .changes/.dsc -# Monkeypatch commands.getstatusoutput as it returns a "0" exit code in -# all situations under lenny's Python. -import commands +# Monkeypatch commands.getstatusoutput as it may not return the correct exit +# code in lenny's Python. This also affects commands.getoutput and +# commands.getstatus. def dak_getstatusoutput(cmd): pipe = subprocess.Popen(cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) @@ -755,12 +755,12 @@ def which_alias_file(): ################################################################################ -def TemplateSubst(map, filename): +def TemplateSubst(subst_map, filename): """ Perform a substition of template """ templatefile = open_file(filename) template = templatefile.read() - for x in map.keys(): - template = template.replace(x, str(map[x])) + for k, v in subst_map.iteritems(): + template = template.replace(k, str(v)) templatefile.close() return template