Package: gimp-plugin-registry
Version: 9.20180625
Severity: normal
Tags: patch  pending


Dear maintainer,

I've prepared an NMU for gimp-plugin-registry (versioned as 9.20180625+nmu1). 
The diff
is attached to this message.

Regards.

diff -Nru gimp-plugin-registry-9.20180625/debian/changelog gimp-plugin-registry-9.20180625+nmu1/debian/changelog
--- gimp-plugin-registry-9.20180625/debian/changelog	2018-06-25 17:54:35.000000000 -0400
+++ gimp-plugin-registry-9.20180625+nmu1/debian/changelog	2020-04-10 21:15:11.000000000 -0400
@@ -1,3 +1,10 @@
+gimp-plugin-registry (9.20180625+nmu1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * port packaging-helper.py to python3, partially addresses #936612
+
+ -- Sandro Tosi <mo...@debian.org>  Fri, 10 Apr 2020 21:15:11 -0400
+
 gimp-plugin-registry (9.20180625) unstable; urgency=medium
 
   * [b24cbac] Auto update of debian/control
diff -Nru gimp-plugin-registry-9.20180625/debian/control gimp-plugin-registry-9.20180625+nmu1/debian/control
--- gimp-plugin-registry-9.20180625/debian/control	2018-06-25 17:54:35.000000000 -0400
+++ gimp-plugin-registry-9.20180625+nmu1/debian/control	2020-04-10 21:15:11.000000000 -0400
@@ -6,7 +6,7 @@
 Build-Depends: autotools-dev, quilt, libgimp2.0-dev, intltool,
  python, automake, autoconf, autotools-dev, dh-autoreconf,
  libxml-parser-perl, liblqr-1-0-dev, automake (>= 1.6), autoconf (>= 2.54), liblcms2-dev, libtiff-dev, debhelper (>= 8.0.0), libglib2.0-dev,
- python-debian
+ python3, python3-debian
 Standards-Version: 3.9.5
 Vcs-Git: https://github.com/bzed/gimp-plugin-registry.git
 Vcs-Browser: https://github.com/bzed/gimp-plugin-registry
diff -Nru gimp-plugin-registry-9.20180625/debian/control.in gimp-plugin-registry-9.20180625+nmu1/debian/control.in
--- gimp-plugin-registry-9.20180625/debian/control.in	2018-06-25 17:54:35.000000000 -0400
+++ gimp-plugin-registry-9.20180625+nmu1/debian/control.in	2020-04-10 21:14:38.000000000 -0400
@@ -6,7 +6,7 @@
 Build-Depends: autotools-dev, quilt, libgimp2.0-dev, intltool,
  python, automake, autoconf, autotools-dev, dh-autoreconf,
  #AUTO_UPDATE_Build-Depends#, debhelper (>= 8.0.0), libglib2.0-dev,
- python-debian
+ python3, python3-debian
 Standards-Version: 3.9.5
 Vcs-Git: https://github.com/bzed/gimp-plugin-registry.git
 Vcs-Browser: https://github.com/bzed/gimp-plugin-registry
diff -Nru gimp-plugin-registry-9.20180625/debian/packaging-helper.py gimp-plugin-registry-9.20180625+nmu1/debian/packaging-helper.py
--- gimp-plugin-registry-9.20180625/debian/packaging-helper.py	2018-06-25 17:54:35.000000000 -0400
+++ gimp-plugin-registry-9.20180625+nmu1/debian/packaging-helper.py	2020-04-10 21:14:38.000000000 -0400
@@ -29,8 +29,8 @@
     # returns (plug, parsed control field data)
     # We look at the first paragraph only!
     for plugin in __plugins__:
-        data=(plugin, [x for x in deb822.Packages.iter_paragraphs(file(__basedir__ + os.path.sep+ plugin + os.path.sep + 'control'))][0])
-        for key in data[1].iterkeys():
+        data=(plugin, [x for x in deb822.Packages.iter_paragraphs(open(__basedir__ + os.path.sep+ plugin + os.path.sep + 'control'))][0])
+        for key in data[1].keys():
             if key not in ALLOWED_FIELDS:
                 raise Exception("Unknown control field in plugin %s: %s" %(data[0],key))
         yield data
@@ -44,7 +44,7 @@
         plugins_depends[plugin]={}
         # look trough keys we might want to merge
         for key in ['Suggests', 'Recommends']:
-            if _control.has_key(key):
+            if key in _control:
                 plugins_depends[plugin][key]=deb822.PkgRelation.parse_relations(_control[key])
 
         # check for generated substvars files
@@ -54,7 +54,7 @@
                 substvars = fd.read()
             try:
                 rel = deb822.PkgRelation.parse_relations(__shlibs_re__.findall(substvars)[0])
-                if plugins_depends[plugin].has_key('Recommends'):
+                if 'Recommends' in plugins_depends[plugin]:
                     plugins_depends[plugin]['Recommends'].extend(rel)
                 else:
                     plugins_depends[plugin]['Recommends']=rel
@@ -66,12 +66,12 @@
     for plugin in __plugins__:
         if len(plugins_depends[plugin]) > 0:
             rtext = '%s:' %(plugin,)
-            if plugins_depends[plugin].has_key('Recommends'):
+            if 'Recommends' in plugins_depends[plugin]:
                 rtext = '%s\n    Required Packages: %s' %(
                     rtext,
                     deb822.PkgRelation.str(plugins_depends[plugin]['Recommends'])
                 )
-            if plugins_depends[plugin].has_key('Suggests'):
+            if 'Suggests' in plugins_depends[plugin]:
                 rtext = '%s\n    Optional Packages: %s' %(
                     rtext,
                     deb822.PkgRelation.str(plugins_depends[plugin]['Suggests'])
@@ -104,18 +104,18 @@
         #    print "Don't use 'Depends' in %s/control - use 'Recommends' instead" %(plugin,)
         #    sys.exit(1)
         for key in ['Build-Depends', 'Depends', 'Suggests', 'Recommends']:
-            if _control.has_key(key):
+            if key in _control:
                 for rel in deb822.PkgRelation.parse_relations(_control[key]):
                     if not rel in control_data[key]:
                         control_data[key].append(rel)
         # extract description
         description = '   * %s' %(plugin,)
-        if _control.has_key('Version'):
+        if 'Version' in _control:
             description = '%s (%s)' %(description, _control['Version'])
         try:
             description = '%s: %s' %(description, _control['Description'].replace('\n','\n    '))
         except KeyError:
-            print 'Description for plugin %s missing!' %(plugin,)
+            print('Description for plugin %s missing!' %(plugin,))
             sys.exit(1)
 
         try:
@@ -135,11 +135,11 @@
     with open(__basedir__ + os.path.sep + 'debian' + os.path.sep + 'control.in', 'r') as f:
         control_in = f.read()
 
-    for k, v in control_data.iteritems():
+    for k, v in control_data.items():
         if k == 'Description':
-            control_in = control_in.replace('#AUTO_UPDATE_Description#', u'\n'.join(v))
+            control_in = control_in.replace('#AUTO_UPDATE_Description#', '\n'.join(v))
         elif k == 'Uploaders':
-            control_in = control_in.replace('#AUTO_UPDATE_Uploaders#', u', '.join(v))
+            control_in = control_in.replace('#AUTO_UPDATE_Uploaders#', ', '.join(v))
         else:
             control_in = control_in.replace('#AUTO_UPDATE_%s#' %(k, ), deb822.PkgRelation.str(v))
 
@@ -154,25 +154,25 @@
     copyrights = []
     for plugin, _control in __get_control_data__():
         _p_copyright = '%s:\n\n' %(plugin,)
-        if _control.has_key('Homepage'):
+        if 'Homepage' in _control:
             _p_copyright = '%sThe plugin was downloaded from: \n%s\n\n' %(_p_copyright, _control['Homepage'])
 
         try:
             with open(__basedir__ + os.path.sep + plugin + os.path.sep + 'copyright', 'r') as f:
-                _p_copyright = '%s  %s' %(_p_copyright, f.read().decode('utf-8').replace('\n','\n  '))
+                _p_copyright = '%s  %s' %(_p_copyright, f.read().replace('\n','\n  '))
         except IOError:
-            print 'copyright file for plugin %s missing!' %(plugin,)
+            print('copyright file for plugin %s missing!' %(plugin,))
             sys.exit(1)
 
         copyrights.append(_p_copyright)
 
     with open(__basedir__ + os.path.sep + 'debian' + os.path.sep + 'copyright.in', 'r') as f:
-        copyright_in = f.read().decode('utf-8')
+        copyright_in = f.read()
 
-    copyright_in = copyright_in.replace('#AUTO_UPDATE_Copyright#', u'\n\n------------------------------------------------------------------------------\n\n'.join(copyrights))
+    copyright_in = copyright_in.replace('#AUTO_UPDATE_Copyright#', '\n\n------------------------------------------------------------------------------\n\n'.join(copyrights))
 
     with open(__basedir__ + os.path.sep + 'debian' + os.path.sep + 'copyright', 'w') as f:
-        f.write(copyright_in.encode('utf-8'))
+        f.write(copyright_in)
 
 
 def watch():
@@ -182,39 +182,39 @@
 
     import hashlib
 
-    import urllib2
-    url_opener = urllib2.build_opener()
+    import urllib.request, urllib.error, urllib.parse
+    url_opener = urllib.request.build_opener()
     url_opener.addheaders = [('User-agent', 'Debian nagios-plugins-contrib 1.0')]
 
     watch_re = re.compile(r'([^ ]+) (.+)')
     whitespace_re = re.compile(r'\s')
     for plugin, _control in __get_control_data__():
-        if not _control.has_key('Watch'):
-            print 'WARNING: %s - missing watch information!' %(plugin,)
+        if 'Watch' not in _control:
+            print('WARNING: %s - missing watch information!' %(plugin,))
             continue
         try:
             url, check = watch_re.findall(_control['Watch'])[0]
         except IndexError:
-            print 'WARNING: %s - failed to parse Watch line!' %(plugin,)
+            print('WARNING: %s - failed to parse Watch line!' %(plugin,))
             continue
         try:
             f=url_opener.open(url)
             content = f.read()
             f.close()
         except IOError:
-            print 'WARNING: %s - failed to retrieve %s !' %(plugin,url)
+            print('WARNING: %s - failed to retrieve %s !' %(plugin,url))
             continue
         check=check.strip()
         if check.startswith('SHA1:'):
             check=check.replace('SHA1:','')
             new_sha=hashlib.sha1(content).hexdigest()
             if check != new_sha:
-                print 'UPDATE NECESSARY: %s - SHA1 checksum does not match! New checksum: %s' %(plugin,new_sha)
+                print('UPDATE NECESSARY: %s - SHA1 checksum does not match! New checksum: %s' %(plugin,new_sha))
             else:
-                print 'OK: %s' %(plugin,)
+                print('OK: %s' %(plugin,))
         else:
-            if not _control.has_key('Version'):
-                print 'WARNING: %s - missing current version information!' %(plugin,)
+            if 'Version' not in _control:
+                print('WARNING: %s - missing current version information!' %(plugin,))
                 continue
             check_re=re.compile(check)
             # check for simple matches
@@ -225,7 +225,7 @@
                 if not v in found_versions:
                     found_versions.append(v)
             if not found_versions:
-                print "WARNING: %s - regex does not match!" %(plugin)
+                print("WARNING: %s - regex does not match!" %(plugin))
                 continue
 
             new_version = found_versions[0]
@@ -233,11 +233,11 @@
                 if (apt_pkg.version_compare(v, found_versions[0]) > 0):
                     new_version = v
             if (apt_pkg.version_compare(new_version, _control['Version'].strip()) > 0):
-                print 'UPDATE NECESSARY: %s - found new version %s' %(plugin, new_version)
+                print('UPDATE NECESSARY: %s - found new version %s' %(plugin, new_version))
             elif (apt_pkg.version_compare(new_version, _control['Version'].strip()) < 0):
-                print 'WARNING: %s - could not find the current version (found: %s, control says: %s)!' %(plugin, new_version, _control['Version'])
+                print('WARNING: %s - could not find the current version (found: %s, control says: %s)!' %(plugin, new_version, _control['Version']))
             else:
-                print 'OK: %s' %(plugin,)
+                print('OK: %s' %(plugin,))
 
 
 
diff -Nru gimp-plugin-registry-9.20180625/debian/rules gimp-plugin-registry-9.20180625+nmu1/debian/rules
--- gimp-plugin-registry-9.20180625/debian/rules	2018-06-25 17:54:35.000000000 -0400
+++ gimp-plugin-registry-9.20180625+nmu1/debian/rules	2020-04-10 21:14:38.000000000 -0400
@@ -33,7 +33,7 @@
 			echo failed to build $$plugin; exit 255 ; \
 		fi
 
-PACKAGING_HELPER = /usr/bin/python $(CURDIR)/debian/packaging-helper.py
+PACKAGING_HELPER = /usr/bin/python3 $(CURDIR)/debian/packaging-helper.py
 
 
 clean: $(PLUGINS:%=clean-%) debian/copyright debian/control

Reply via email to