forked from pool/bugzilla
Accepting request 1080245 from home:mlin7442:python3_shebang
port jb2bz.py to python3, boo#1210577 OBS-URL: https://build.opensuse.org/request/show/1080245 OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/bugzilla?expand=0&rev=25
This commit is contained in:
parent
51295d2c6e
commit
a01c134e10
75
bugzilla-py3-jb2bz.patch
Normal file
75
bugzilla-py3-jb2bz.patch
Normal file
@ -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)
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 18 14:54:37 UTC 2023 - Max Lin <mlin@suse.com>
|
||||
|
||||
- Port jb2bz.py to python3
|
||||
* Add bugzilla-py3-jb2bz.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 31 06:31:13 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user