X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fprocess_new.py;h=11950f14429e41a654167b110822de96fd70e6e7;hb=4d8b174b33c1816762251a27dc9325138c8d8f6b;hp=1a25369789518406cfdd0fd293b4e73c74e03e02;hpb=e9db98a6b9c072bfd2cbcf34777219b8364f3a02;p=dak.git diff --git a/dak/process_new.py b/dak/process_new.py index 1a253697..11950f14 100755 --- a/dak/process_new.py +++ b/dak/process_new.py @@ -42,8 +42,6 @@ ################################################################################ -from __future__ import with_statement - import copy import errno import os @@ -351,7 +349,7 @@ def check_pkg (upload): elif ftype == "dsc": print examine_package.check_dsc(changes['distribution'], f) print examine_package.output_package_relations() - except IOError, e: + except IOError as e: if e.errno == errno.EPIPE: utils.warn("[examine_package] Caught EPIPE; skipping.") else: @@ -370,10 +368,10 @@ def do_bxa_notification(upload): summary = "" for f in files.keys(): if files[f]["type"] == "deb": - control = apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(f))) + control = apt_pkg.TagSection(utils.deb_extract_control(utils.open_file(f))) summary += "\n" - summary += "Package: %s\n" % (control.Find("Package")) - summary += "Description: %s\n" % (control.Find("Description")) + summary += "Package: %s\n" % (control.find("Package")) + summary += "Description: %s\n" % (control.find("Description")) upload.Subst["__BINARY_DESCRIPTIONS__"] = summary bxa_mail = utils.TemplateSubst(upload.Subst,Config()["Dir::Templates"]+"/process-new.bxa_notification") utils.send_mail(bxa_mail) @@ -402,7 +400,7 @@ def add_overrides (new, upload, session): session.commit() - if Config().FindB("Dinstall::BXANotify"): + if Config().find_b("Dinstall::BXANotify"): do_bxa_notification(upload) ################################################################################ @@ -616,7 +614,7 @@ def check_daily_lock(): os.open(lockfile, os.O_RDONLY | os.O_CREAT | os.O_EXCL) - except OSError, e: + except OSError as e: if e.errno == errno.EEXIST or e.errno == errno.EACCES: raise CantGetLockError @@ -638,10 +636,10 @@ def lock_package(package): try: fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDONLY) - except OSError, e: + except OSError as e: if e.errno == errno.EEXIST or e.errno == errno.EACCES: user = pwd.getpwuid(os.stat(path)[stat.ST_UID])[4].split(',')[0].replace('.', '') - raise AlreadyLockedError, user + raise AlreadyLockedError(user) try: yield fd @@ -720,7 +718,7 @@ def do_pkg(changes_full_path, session): print "Hello? Operator! Give me the number for 911!" print "Dinstall in the locked area, cant process packages, come back later" - except AlreadyLockedError, e: + except AlreadyLockedError as e: print "Seems to be locked by %s already, skipping..." % (e) def show_new_comments(changes_files, session): @@ -776,14 +774,14 @@ def main(): if not cnf.has_key("Process-New::Options::%s" % (i)): cnf["Process-New::Options::%s" % (i)] = "" - changes_files = apt_pkg.ParseCommandLine(cnf.Cnf,Arguments,sys.argv) + changes_files = apt_pkg.parse_commandline(cnf.Cnf,Arguments,sys.argv) if len(changes_files) == 0: new_queue = get_policy_queue('new', session ); changes_paths = [ os.path.join(new_queue.path, j) for j in utils.get_changes_files(new_queue.path) ] else: changes_paths = [ os.path.abspath(j) for j in changes_files ] - Options = cnf.SubTree("Process-New::Options") + Options = cnf.subtree("Process-New::Options") if Options["Help"]: usage() @@ -791,7 +789,7 @@ def main(): if not Options["No-Action"]: try: Logger = daklog.Logger("process-new") - except CantOpenError, e: + except CantOpenError as e: Options["Trainee"] = "True" Sections = Section_Completer(session)