X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dak%2Ftransitions.py;h=a5eb6b6cd1e5338861b27cfb61e15a7644ca9d2d;hb=f7e8ab5cc1ef088763a6e0f2b0cdba9ec2b63c87;hp=e2461ad2ef56b82ee0cb19bc7fdb7e14f106dcce;hpb=92929b13c99cd7f0533167a5cf4cf1ea679cd56e;p=dak.git diff --git a/dak/transitions.py b/dak/transitions.py index e2461ad2..a5eb6b6c 100755 --- a/dak/transitions.py +++ b/dak/transitions.py @@ -135,7 +135,7 @@ def load_transitions(trans_file): failure = False try: trans = yaml.load(sourcecontent) - except yaml.YAMLError, exc: + except yaml.YAMLError as exc: # Someone fucked it up print "ERROR: %s" % (exc) return None @@ -225,7 +225,7 @@ def lock_file(f): try: fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB) return lock_fd - except OSError, e: + except OSError as e: if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EEXIST': print "Unable to get lock for %s (try %d of 10)" % \ (file, retry+1) @@ -297,7 +297,7 @@ def write_transitions_from_file(from_file): else: trans = load_transitions(from_file) if trans is None: - raise TransitionsError, "Unparsable transitions file %s" % (file) + raise TransitionsError("Unparsable transitions file %s" % (file)) write_transitions(trans) ################################################################################ @@ -319,7 +319,7 @@ def temp_transitions_file(transitions): """ (fd, path) = tempfile.mkstemp("", "transitions", Cnf["Dir::TempPath"]) - os.chmod(path, 0644) + os.chmod(path, 0o644) f = open(path, "w") yaml.dump(transitions, f, default_flow_style=False) return path @@ -589,7 +589,7 @@ def main(): if Options["import"]: try: write_transitions_from_file(Options["import"]) - except TransitionsError, m: + except TransitionsError as m: print m sys.exit(2) sys.exit(0)