diff --git a/bugzilla-py3-jb2bz.patch b/bugzilla-py3-jb2bz.patch new file mode 100644 index 0000000..030c42f --- /dev/null +++ b/bugzilla-py3-jb2bz.patch @@ -0,0 +1,75 @@ +--- a/contrib/jb2bz.py ++++ b/contrib/jb2bz.py +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/python ++#!/usr/bin/python3 + # -*- mode: python -*- + + """ +@@ -22,10 +22,10 @@ import sys, re, glob, os, stat, time + import MySQLdb, getopt + + # mimetypes doesn't include everything we might encounter, yet. +-if not mimetypes.types_map.has_key('.doc'): ++if '.doc' not in mimetypes.types_map: + mimetypes.types_map['.doc'] = 'application/msword' + +-if not mimetypes.encodings_map.has_key('.bz2'): ++if '.bz2' not in mimetypes.encodings_map: + mimetypes.encodings_map['.bz2'] = "bzip2" + + bug_status='CONFIRMED' +@@ -170,7 +170,7 @@ def process_jitterbug(filename): + current['date-reported'] = () + current['short-description'] = '' + +- print "Processing: %d" % current['number'] ++ print("Processing: %d" % current['number']) + + mfile = open(filename, "r") + create_date = os.fstat(mfile.fileno()) +@@ -183,7 +183,7 @@ def process_jitterbug(filename): + if current['date-reported'][0] < 1900: + current['date-reported'] = time.gmtime(create_date[stat.ST_MTIME]) + +- if msg.has_key('Subject') is not False: ++ if 'Subject' in msg: + current['short-description'] = msg['Subject'] + else: + current['short-description'] = "Unknown" +@@ -195,7 +195,7 @@ def process_jitterbug(filename): + process_multi_part(msg, current) + else: + # Huh? This should never happen. +- print "Unknown content-type: %s" % msgtype ++ print("Unknown content-type: %s" % msgtype) + sys.exit(1) + + add_notes(current) +@@ -289,7 +289,7 @@ def process_jitterbug(filename): + "id=LAST_INSERT_ID(), thedata=%s", + [ a[2] ]) + +- except MySQLdb.IntegrityError, message: ++ except MySQLdb.IntegrityError as message: + errorcode = message[0] + if errorcode == 1062: # duplicate + return +@@ -301,7 +301,7 @@ def process_jitterbug(filename): + db.close() + + def usage(): +- print """Usage: jb2bz.py [OPTIONS] Product ++ print("""Usage: jb2bz.py [OPTIONS] Product + + Where OPTIONS are one or more of the following: + +@@ -316,7 +316,7 @@ Product is the Product to assign these d + + All of the JitterBugs in the current directory are imported, including replies, notes, + attachments, and similar noise. +-""" ++""") + sys.exit(1) + + diff --git a/bugzilla.changes b/bugzilla.changes index a1fbe27..c5351fc 100644 --- a/bugzilla.changes +++ b/bugzilla.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Apr 18 14:54:37 UTC 2023 - Max Lin + +- Port jb2bz.py to python3 + * Add bugzilla-py3-jb2bz.patch + ------------------------------------------------------------------- Tue Aug 31 06:31:13 UTC 2021 - Steve Kowalik diff --git a/bugzilla.spec b/bugzilla.spec index 4a36ad7..00eed6c 100644 --- a/bugzilla.spec +++ b/bugzilla.spec @@ -30,6 +30,7 @@ Source4: %{name}.conf Source5: %{name}-rpmlintrc Patch1: fix_whine_error.patch Patch2: modernize-bugzilla-submit.patch +Patch3: bugzilla-py3-jb2bz.patch BuildRequires: apache-rpm-macros BuildRequires: fdupes BuildRequires: pkgconfig(systemd)