Hi, Here is a patch to fix bug-bind in Focal that has no more python-launchpadlib. Just need that since I've already cleaned up python2 packages as possible a couple days ago. So maybe you'll also need it.
However, it's probably not a desired way to post some random patch in the mail only. Should have a much more complete solution for these tools we use everyday. So I have been wondering what about creating a PPA to host these scripts as normal deb packages, so that we can have the compatibility in both Bionic with python2 and Focal with python3, and maybe some other complicated cases as well. It's surely also possible to migrate to python3 for both of them, but still a PPA for all daily scripts sounds better to me. HDYT? You-Sheng Yang
From 921f45efbd4238739431e0d06f75c99df4a18e46 Mon Sep 17 00:00:00 2001 From: You-Sheng Yang <vic...@gmail.com> Date: Wed, 25 Mar 2020 17:23:05 +0800 Subject: [PATCH] bug-bind: migrate to python3 Signed-off-by: You-Sheng Yang <vic...@gmail.com> --- bug-bind | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/bug-bind b/bug-bind index f0a0e32..db000c2 100755 --- a/bug-bind +++ b/bug-bind @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # # Fallback stable bug = 824112 # Defalut BIOS bug = 824125 @@ -8,7 +8,6 @@ import os import re import sys import getopt -import string import logging from launchpadlib.launchpad import Launchpad @@ -25,9 +24,9 @@ log.setLevel(logging.DEBUG) logging.basicConfig(format='%(levelname)s %(asctime)s - %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p') def usage(): - print "Usage: bug-bind [-n] -p <public-bug> private-bug1 ... private-bug2" - print "Options:" - print " -n, --nomination\tAutomatically nominate n and n+1 series" + print("Usage: bug-bind [-n] -p <public-bug> private-bug1 ... private-bug2") + print("Options:") + print(" -n, --nomination\tAutomatically nominate n and n+1 series") def lp_login(): global lp @@ -47,7 +46,7 @@ def find_latest_stable_release(): omit_targeted=False) task = list.pop(sorted (bugtasks)) - print task.bug.id + print((task.bug.id)) return task.bug.id @@ -63,7 +62,7 @@ def fix_private_bugs(privates,no_nomination): except: continue - m = re.search(ur'X-HWE-Bug: Bug #(\d+)', bug.description) + m = re.search(r'X-HWE-Bug: Bug #(\d+)', bug.description) if m: log.info(lp.bugs[priv].web_link + ' is linked to' + lp.bugs[m.group(1)].web_link) @@ -152,7 +151,7 @@ def link_bugs(public,privates,ihv): pub_bug = lp.bugs[public] tag = "\n\nX-HWE-Bug: Bug #" + public + "\n" - regex = ur'X-HWE-Bug:' + regex = r'X-HWE-Bug:' # Add X-HWE-Bug: tag to description. for priv in privates: @@ -160,11 +159,11 @@ def link_bugs(public,privates,ihv): bug = lp.bugs[priv] # If there is already an X-HWE-Bug tag in the description, replace it. Otherwise, append it. - if string.find(bug.description,regex) != -1: - m = re.search(regex + ur' Bug #?(\d+)', bug.description) + if regex in bug.description: + m = re.search(regex + r' Bug #?(\d+)', bug.description) already_linked = lp.bugs[m.group(1)] log.warning("Bug already linked to public bug " + already_linked.web_link) - bug.description = re.sub(regex + ur' Bug #?(\d+)', tag, bug.description) + bug.description = re.sub(regex + r' Bug #?(\d+)', tag, bug.description) else: bug.description += tag bug.lp_save() @@ -173,7 +172,7 @@ def link_bugs(public,privates,ihv): # remove 'hwe-needs-public-bug' if it exists. # workaround for lp:254901 tags = bug.tags - tags.remove(u'hwe-needs-public-bug') + tags.remove('hwe-needs-public-bug') bug.tags = tags except ValueError: @@ -184,7 +183,7 @@ def link_bugs(public,privates,ihv): bug.lp_save() # Now subscrube the canonical-hwe-team to the public bug - sub_url = "%s~%s" % (lp._root_uri, u'canonical-hwe-team') + sub_url = "%s~%s" % (lp._root_uri, 'canonical-hwe-team') pub_bug.subscribe(person=sub_url) if ihv == "hwe": -- 2.25.1
signature.asc
Description: OpenPGP digital signature
-- Mailing list: https://launchpad.net/~canonical-hwe-team Post to : canonical-hwe-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~canonical-hwe-team More help : https://help.launchpad.net/ListHelp