On Mon, 15 Apr 2019 11:24:37 -0400 Scott Kitterman <deb...@kitterman.com> 
wrote:
> Package: ubuntu-dev-tools
> Version: 0.166
> Severity: important
> 
> The requestsync script uses the DNS module (python-dns).  I plan to remove
> this package during the Bullseye development cycle.  DNS is available for
> Python 3 (python3-dns).  Please port to Python 3.  At a glance, it doesn't
> look like a difficult port.

This looks like what needs doing in the actual requestsync script and related 
d/control changes.  There are more ubuntutools changes needed and it's late 
and I'm tired.  Note: Less the shebang changes the script changes are fine with 
python2, so they can be applied any time.

Scott K
diff -Nru ubuntu-dev-tools-0.171/debian/changelog ubuntu-dev-tools-0.171+nmu1/debian/changelog
--- ubuntu-dev-tools-0.171/debian/changelog	2019-08-12 07:42:31.000000000 -0400
+++ ubuntu-dev-tools-0.171+nmu1/debian/changelog	2019-09-01 02:05:12.000000000 -0400
@@ -1,3 +1,10 @@
+ubuntu-dev-tools (0.171+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Update requestsync to python3
+
+ -- Scott Kitterman <sc...@kitterman.com>  Sun, 01 Sep 2019 02:05:12 -0400
+
 ubuntu-dev-tools (0.171) unstable; urgency=medium
 
   * Add an autopkgtest running the package tests.
diff -Nru ubuntu-dev-tools-0.171/debian/control ubuntu-dev-tools-0.171+nmu1/debian/control
--- ubuntu-dev-tools-0.171/debian/control	2019-07-20 09:10:57.000000000 -0400
+++ ubuntu-dev-tools-0.171+nmu1/debian/control	2019-09-01 02:05:12.000000000 -0400
@@ -80,7 +80,8 @@
  lintian,
  patch,
  pbuilder | cowbuilder | sbuild,
- python-dns,
+ python3-dns,
+ python3-launchpadlib,
  python-soappy,
  quilt,
  reportbug (>= 3.39ubuntu1),
diff -Nru ubuntu-dev-tools-0.171/requestsync ubuntu-dev-tools-0.171+nmu1/requestsync
--- ubuntu-dev-tools-0.171/requestsync	2017-05-02 04:46:41.000000000 -0400
+++ ubuntu-dev-tools-0.171+nmu1/requestsync	2019-09-01 02:05:05.000000000 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 # -*- coding: utf-8 -*-
 #
 # (C) 2007 Canonical Ltd., Steve Kowalik
@@ -97,7 +97,7 @@
     config = UDTConfig(options.no_conf)
 
     if options.deprecated_lp_flag:
-        print "The --lp flag is now default, ignored."
+        print("The --lp flag is now default, ignored.")
     if options.email:
         options.lpapi = False
     else:
@@ -115,8 +115,8 @@
         elif options.lpinstance == 'staging':
             bug_mail_domain = 'bugs.staging.launchpad.net'
         else:
-            print >> sys.stderr, ('Error: Unknown launchpad instance: %s'
-                                  % options.lpinstance)
+            print(('Error: Unknown launchpad instance: %s'
+                                  % options.lpinstance), file=sys.stderr)
             sys.exit(1)
 
     mailserver_host = config.get_value('SMTP_SERVER',
@@ -130,8 +130,8 @@
             firstmx = mxlist[0]
             mailserver_host = firstmx[1]
         except ImportError:
-            print >> sys.stderr, ('Please install python-dns to support '
-                                  'Launchpad mail server lookup.')
+            print(('Please install python-dns to support '
+                                  'Launchpad mail server lookup.'), file=sys.stderr)
             sys.exit(1)
 
     mailserver_port = config.get_value('SMTP_PORT', default=25,
@@ -167,9 +167,9 @@
                                                   get_ubuntu_delta_changelog,
                                                   mail_bug, need_sponsorship)
         if not any(x in os.environ for x in ('UBUMAIL', 'DEBEMAIL', 'EMAIL')):
-            print >> sys.stderr, (
+            print((
                 'E: The environment variable UBUMAIL, DEBEMAIL or EMAIL needs '
-                'to be set to let this script mail the sync request.')
+                'to be set to let this script mail the sync request.'), file=sys.stderr)
             sys.exit(1)
 
     newsource = options.newpkg
@@ -187,14 +187,14 @@
         else:
             ubu_info = UbuntuDistroInfo()
             release = ubu_info.devel()
-        print >> sys.stderr, 'W: Target release missing - assuming %s' % release
+        print('W: Target release missing - assuming %s' % release, file=sys.stderr)
     elif len(args) == 2:
         release = args[1]
     elif len(args) == 3:
         release = args[1]
         force_base_version = Version(args[2])
     else:
-        print >> sys.stderr, 'E: Too many arguments.'
+        print('E: Too many arguments.', file=sys.stderr)
         parser.print_help()
         sys.exit(1)
 
@@ -209,12 +209,12 @@
         ubuntu_version = Version('~')
         ubuntu_component = None  # Set after getting the Debian info
         if not newsource:
-            print("'%s' doesn't exist in 'Ubuntu %s'.\nDo you want to sync a new package?" %
-                  (srcpkg, release))
+            print(("'%s' doesn't exist in 'Ubuntu %s'.\nDo you want to sync a new package?" %
+                  (srcpkg, release)))
             confirmation_prompt()
             newsource = True
-    except udtexceptions.SeriesNotFoundException, error:
-        print >> sys.stderr, "E: %s" % error
+    except udtexceptions.SeriesNotFoundException as error:
+        print("E: %s" % error, file=sys.stderr)
         sys.exit(1)
 
     # Get the requested Debian source package
@@ -222,11 +222,11 @@
         debian_srcpkg = get_debian_srcpkg(srcpkg, distro)
         debian_version = Version(debian_srcpkg.getVersion())
         debian_component = debian_srcpkg.getComponent()
-    except udtexceptions.PackageNotFoundException, error:
-        print >> sys.stderr, "E: %s" % error
+    except udtexceptions.PackageNotFoundException as error:
+        print("E: %s" % error, file=sys.stderr)
         sys.exit(1)
-    except udtexceptions.SeriesNotFoundException, error:
-        print >> sys.stderr, "E: %s" % error
+    except udtexceptions.SeriesNotFoundException as error:
+        print("E: %s" % error, file=sys.stderr)
         sys.exit(1)
 
     if ubuntu_component is None:
@@ -243,18 +243,18 @@
             debian_srcpkg = ubuntutools.requestsync.mail.get_debian_srcpkg(srcpkg, distro)
             debian_version = Version(debian_srcpkg.getVersion())
             debian_component = debian_srcpkg.getComponent()
-        except udtexceptions.PackageNotFoundException, error:
-            print >> sys.stderr, "E: %s" % error
+        except udtexceptions.PackageNotFoundException as error:
+            print("E: %s" % error, file=sys.stderr)
             sys.exit(1)
 
     if ubuntu_version == debian_version:
-        print >> sys.stderr, ('E: The versions in Debian and Ubuntu are the '
-                              'same already (%s). Aborting.' % ubuntu_version)
+        print(('E: The versions in Debian and Ubuntu are the '
+                              'same already (%s). Aborting.' % ubuntu_version), file=sys.stderr)
         sys.exit(1)
     if ubuntu_version > debian_version:
-        print >> sys.stderr, ('E: The version in Ubuntu (%s) is newer than '
+        print(('E: The version in Ubuntu (%s) is newer than '
                               'the version in Debian (%s). Aborting.'
-                              % (ubuntu_version, debian_version))
+                              % (ubuntu_version, debian_version)), file=sys.stderr)
         sys.exit(1)
 
     # -s flag not specified - check if we do need sponsorship
@@ -262,8 +262,8 @@
         sponsorship = need_sponsorship(srcpkg, ubuntu_component, release)
 
     if not sponsorship and not ffe:
-        print >> sys.stderr, ('Consider using syncpackage(1) for syncs that '
-                              'do not require feature freeze exceptions.')
+        print(('Consider using syncpackage(1) for syncs that '
+                              'do not require feature freeze exceptions.'), file=sys.stderr)
 
     # Check for existing package reports
     if not newsource:
@@ -284,8 +284,8 @@
         print('Changes have been made to the package in Ubuntu.\n'
               'Please edit the report and give an explanation.\n'
               'Not saving the report file will abort the request.')
-        report += (u'Explanation of the Ubuntu delta and why it can be '
-                   u'dropped:\n%s\n>>> ENTER_EXPLANATION_HERE <<<\n\n'
+        report += ('Explanation of the Ubuntu delta and why it can be '
+                   'dropped:\n%s\n>>> ENTER_EXPLANATION_HERE <<<\n\n'
                    % get_ubuntu_delta_changelog(ubuntu_srcpkg))
 
     if ffe:
@@ -310,10 +310,10 @@
     changelog = debian_srcpkg.getChangelog(since_version=base_version)
     if not changelog:
         if not options.missing_changelog_ok:
-            print >> sys.stderr, ("E: Did not retrieve any changelog entries. "
+            print(("E: Did not retrieve any changelog entries. "
                                   "Do you need to specify '-C'? "
                                   "Was the package recently uploaded? (check "
-                                  "http://packages.debian.org/changelogs/)")
+                                  "http://packages.debian.org/changelogs/)"), file=sys.stderr)
             sys.exit(1)
         else:
             need_interaction = True
@@ -325,8 +325,8 @@
     title, report = editor.get_report()
 
     if 'XXX FIXME' in report:
-        print >> sys.stderr, ("E: changelog boilerplate found in report, "
-                              "please manually add changelog when using '-C'")
+        print(("E: changelog boilerplate found in report, "
+                              "please manually add changelog when using '-C'"), file=sys.stderr)
         sys.exit(1)
 
     # bug status and bug subscriber
@@ -357,5 +357,5 @@
     try:
         main()
     except KeyboardInterrupt:
-        print "\nUser abort."
+        print("\nUser abort.")
         sys.exit(2)

Reply via email to