pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/56088: pkgsrc/editors/medit python3 support



>Number:         56088
>Category:       pkg
>Synopsis:       pkg
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 01 17:10:00 +0000 2021
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.1
>Organization:
>Environment:
System: NetBSD mirage 9.1 NetBSD 9.1 (GENERIC) #0: Sun Oct 18 19:24:30 UTC 2020 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
pkgsrc/editors/medit doesn't support python3.

>How-To-Repeat:
Code inspection

>Fix:
Mechanical python2->3 diffs that emit identical generated files:
 medit-1.2.0/moo/mooutils/mooaccelprefs-gxml.h
 medit-1.2.0/moo/mooutils/mooaccelbutton-gxml.h
 medit-1.2.0/moo/mooutils/moologwindow-gxml.h
 medit-1.2.0/moo/mooapp-credits.h
etc.

---
? patches/patch-tools_glade2c.py
? patches/patch-tools_xml2h.py
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/editors/medit/Makefile,v
retrieving revision 1.46
diff -u -p -d -r1.46 Makefile
--- Makefile	5 Nov 2020 09:08:02 -0000	1.46
+++ Makefile	1 Apr 2021 16:58:45 -0000
@@ -1,7 +1,7 @@
 # $NetBSD: Makefile,v 1.46 2020/11/05 09:08:02 ryoon Exp $
 
 DISTNAME=	medit-1.2.0
-PKGREVISION=	16
+PKGREVISION=	17
 CATEGORIES=	editors
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE:=mooedit/}
 EXTRACT_SUFX=	.tar.bz2
@@ -19,7 +19,7 @@ USE_LANGUAGES=	c c++
 USE_TOOLS+=	gmake pkg-config msgfmt intltool
 
 PYTHON_FOR_BUILD_ONLY=		yes
-PYTHON_VERSIONS_ACCEPTED=	27 # not yet ported as of 1.2.0
+PYTHON_VERSIONS_INCOMPATIBLE+=	27
 CONFIGURE_ARGS+=		--with-python=no
 CONFIGURE_ENV+=			MOO_PYTHON=${PYTHONBIN}
 
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/editors/medit/distinfo,v
retrieving revision 1.5
diff -u -p -d -r1.5 distinfo
--- distinfo	3 Nov 2015 03:32:18 -0000	1.5
+++ distinfo	1 Apr 2021 16:58:45 -0000
@@ -5,3 +5,5 @@ RMD160 (medit-1.2.0.tar.bz2) = 24c9e9a3d
 SHA512 (medit-1.2.0.tar.bz2) = 936ce5390c7cbc92291946bda08ae271e1d8537686f134d9ac5a9c1067172933c11555a484d7036d7fed8c7fcb57ca145479bcc9009feb44eb3489b6099534f4
 Size (medit-1.2.0.tar.bz2) = 1771094 bytes
 SHA1 (patch-moo_Makefile.in) = 18334afff24bde08a83b670a57745c6317b84e71
+SHA1 (patch-tools_glade2c.py) = 5e7a744f46604a7b4c8be4e45561390c9427286a
+SHA1 (patch-tools_xml2h.py) = 0258456c05c31cf1d209a23abed68097f0451d22
--- /dev/null	2021-04-02 01:58:38.153021181 +0900
+++ patches/patch-tools_glade2c.py	2021-04-02 01:51:10.700721062 +0900
@@ -0,0 +1,104 @@
+$NetBSD$
+
+- mechanical python3 support
+
+--- tools/glade2c.py.orig	2012-12-16 23:55:32.000000000 +0000
++++ tools/glade2c.py
+@@ -5,7 +5,7 @@ import sys
+ import getopt
+ import xml.dom
+ import xml.dom.minidom as minidom
+-import StringIO
++import io
+ 
+ def name_is_nice(name):
+     return name[-1:] not in "0123456789"
+@@ -50,7 +50,7 @@ class GladeXml(object):
+         walk_node(root, False, check_node)
+ 
+     def format_buffer(self):
+-        out = StringIO.StringIO()
++        out = io.StringIO()
+         for l in self.buffer.splitlines():
+             out.write('"')
+             out.write(l.replace('\\', '\\\\').replace('"', '\\"'))
+@@ -208,9 +208,9 @@ G_GNUC_UNUSED static %(XmlStruct)s *
+ }
+ """
+ 
+-    buf = StringIO.StringIO()
++    buf = io.StringIO()
+     if gxml.widgets:
+-        print >> buf, ''
++        print('', file=buf)
+         for w in gxml.widgets:
+             name = w.name
+             ct = params.id_map.get(name)
+@@ -218,11 +218,11 @@ G_GNUC_UNUSED static %(XmlStruct)s *
+                 class_name = w.class_name
+             else:
+                 class_name = ct[0]
+-            print >> buf, '    %s *%s;' % (class_name, name)
++            print('    %s *%s;' % (class_name, name), file=buf)
+     glade_xml_widgets_decl = buf.getvalue()
+     buf.close()
+ 
+-    buf = StringIO.StringIO()
++    buf = io.StringIO()
+     for w in gxml.widgets:
+         name = w.name
+         ct = params.id_map.get(name)
+@@ -230,20 +230,20 @@ G_GNUC_UNUSED static %(XmlStruct)s *
+             class_name = w.class_name
+         else:
+             class_name = ct[0]
+-        print >> buf, """\
++        print("""\
+     xml->%(struct_mem)s = (%(class_name)s*) moo_glade_xml_get_widget (xml->xml, "%(glade_name)s");
+-    g_return_val_if_fail (xml->%(struct_mem)s != NULL, FALSE);""" % { 'struct_mem': w.name, 'glade_name': w.real_name, 'class_name': class_name }
++    g_return_val_if_fail (xml->%(struct_mem)s != NULL, FALSE);""" % { 'struct_mem': w.name, 'glade_name': w.real_name, 'class_name': class_name }, file=buf)
+     glade_xml_widgets_defs = buf.getvalue()
+     buf.close()
+ 
+-    buf = StringIO.StringIO()
++    buf = io.StringIO()
+     for id in params.id_map:
+         ct = params.id_map.get(id)
+         if ct[1]:
+             type_name = ct[1]
+         else:
+             type_name = 'g_type_from_name ("%s")' % (ct[0],)
+-        print >> buf, '    moo_glade_xml_map_id (xml->xml, "%s", %s);' % (id, type_name)
++        print('    moo_glade_xml_map_id (xml->xml, "%s", %s);' % (id, type_name), file=buf)
+     glade_xml_widgets_map = buf.getvalue()
+     buf.close()
+ 
+@@ -300,7 +300,7 @@ def convert_buffer(buf, params, output, 
+ 
+         if output is None:
+             output = sys.stdout
+-        elif isinstance(output, str) or isinstance(output, unicode):
++        elif isinstance(output, str):
+             output = open(output, 'w')
+             close_output = True
+ 
+@@ -317,7 +317,7 @@ def convert_file(filename, params, outpu
+     return ret
+ 
+ def usage():
+-    print "Usage: %s [--map=id,ClassName,CLASS_TYPE...] [--output=outfile] FILE" % (sys.argv[0],)
++    print("Usage: %s [--map=id,ClassName,CLASS_TYPE...] [--output=outfile] FILE" % (sys.argv[0],))
+ 
+ def main(args):
+     params = ConvertParams()
+@@ -325,8 +325,8 @@ def main(args):
+     try:
+         opts, files = getopt.getopt(args[1:], "hm:o:s:S:r:",
+                                     ["help", "map=", "output=", "struct-name=", "StructName=", "root="])
+-    except getopt.GetoptError, err:
+-        print str(err)
++    except getopt.GetoptError as err:
++        print(str(err))
+         usage()
+         return 2
+ 
--- /dev/null	2021-04-02 01:58:38.153021181 +0900
+++ patches/patch-tools_xml2h.py	2021-04-02 01:58:14.419930617 +0900
@@ -0,0 +1,24 @@
+$NetBSD$
+
+- mechanical python3 support
+
+--- tools/xml2h.py.orig	2012-12-16 23:55:32.000000000 +0000
++++ tools/xml2h.py
+@@ -11,13 +11,13 @@ tmp_output = output + '.tmp'
+ varname = sys.argv[3]
+ 
+ outfile = open(tmp_output, 'w')
+-print >> outfile, '/* -*- C -*- */'
+-print >> outfile, 'static const char %s [] = ""' % (varname,)
++print('/* -*- C -*- */', file=outfile)
++print('static const char %s [] = ""' % (varname,), file=outfile)
+ for line in open(input):
+     if line.endswith('\n'):
+         line = line[:-1]
+-    print >> outfile, '"' + line.replace('"', '\\"') + '\\n"'
+-print >> outfile, ';'
++    print('"' + line.replace('"', '\\"') + '\\n"', file=outfile)
++print(';', file=outfile)
+ 
+ outfile.close()
+ 



Home | Main Index | Thread Index | Old Index