From 66afe7c6fcdb3d43d6fcc8164889ce4a3ccfe275 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Wed, 4 Sep 2019 18:27:03 -0300 Subject: [PATCH] Port import-bug-from-debian to Python 3 Use python3-debianbts for BTS wrangling, rather than SOAPPy, which wasn't ported to Python 3. --- debian/control | 4 ++-- import-bug-from-debian | 22 +++++++--------------- setup.py | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/debian/control b/debian/control index 208a5bd..a61ed0f 100644 --- a/debian/control +++ b/debian/control @@ -24,11 +24,11 @@ Build-Depends: python-launchpadlib (>= 1.5.7), python-mock, python-setuptools, - python-soappy, python-unittest2, python3-all, python3-apt, python3-debian, + python3-debianbts, python3-distro-info, python3-flake8, python3-httplib2, @@ -87,8 +87,8 @@ Recommends: lintian, patch, pbuilder | cowbuilder | sbuild, + python3-debianbts, python3-dns, - python-soappy, quilt, reportbug (>= 3.39ubuntu1), ubuntu-keyring | ubuntu-archive-keyring, diff --git a/import-bug-from-debian b/import-bug-from-debian index 8a78e18..e498c11 100755 --- a/import-bug-from-debian +++ b/import-bug-from-debian @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # -*- coding: UTF-8 -*- # Copyright © 2009 James Westby , @@ -33,23 +33,15 @@ from ubuntutools.config import UDTConfig from ubuntutools.logger import Logger try: - import SOAPpy + import debianbts except ImportError: - Logger.error("Please install 'python-soappy' in order to use this utility.") + Logger.error("Please install 'python3-debianbts' in order to use this utility.") sys.exit(1) def main(): bug_re = re.compile(r"bug=(\d+)") - url = 'http://bugs.debian.org/cgi-bin/soap.cgi' - namespace = 'Debbugs/SOAP' - debbugs = SOAPpy.SOAPProxy(url, namespace) - - # debug - # debbugs.config.dumpSOAPOut = 1 - # debbugs.config.dumpSOAPIn = 1 - parser = OptionParser(usage="%prog [option] bug ...") parser.add_option("-b", "--browserless", help="Don't open the bug in the browser at the end", @@ -94,7 +86,7 @@ def main(): bug_num = int(bug_num) bug_nums.append(bug_num) - bugs = debbugs.get_status(*bug_nums) + bugs = debianbts.get_status(*bug_nums) if len(bug_nums) > 1: bugs = bugs[0] @@ -104,14 +96,14 @@ def main(): sys.exit(1) for bug in bugs: - bug = bug.value ubupackage = package = bug.source if options.package: ubupackage = options.package bug_num = bug.bug_num subject = bug.subject - log = debbugs.get_bug_log(bug_num) - summary = log[0][0] + summary = bug.summary + log = debianbts.get_bug_log(bug_num) + summary = log[0]['body'] target = ubuntu.getSourcePackage(name=ubupackage) if target is None: Logger.error("Source package '%s' is not in Ubuntu. Please specify " diff --git a/setup.py b/setup.py index ab83dd1..1c55f06 100755 --- a/setup.py +++ b/setup.py @@ -25,6 +25,7 @@ if sys.version_info[0] >= 3: 'grab-merge', 'grep-merges', 'hugdaylist', + 'import-bug-from-debian', 'mk-sbuild', 'pbuilder-dist', 'pbuilder-dist-simple', @@ -55,7 +56,6 @@ if sys.version_info[0] >= 3: ] else: scripts = [ - 'import-bug-from-debian', 'merge-changelog', ] data_files = []