From 1c541dafb37276bf5cdbdb2995013a5bf6026cda Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Sat, 7 Oct 2023 04:38:21 -0400 Subject: [PATCH] gtksourceview2: patch for python3 --- srcpkgs/gtksourceview2/patches/python3.patch | 59 ++++++++++++++++++++ srcpkgs/gtksourceview2/template | 5 +- 2 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/gtksourceview2/patches/python3.patch diff --git a/srcpkgs/gtksourceview2/patches/python3.patch b/srcpkgs/gtksourceview2/patches/python3.patch new file mode 100644 index 00000000000..0a05b38556d --- /dev/null +++ b/srcpkgs/gtksourceview2/patches/python3.patch @@ -0,0 +1,59 @@ +--- a/gtksourceview/language-specs/convert.py ++++ b/gtksourceview/language-specs/convert.py +@@ -1,7 +1,7 @@ + #!/usr/bin/env python + + import xml.dom.minidom as dom +-import cgi ++import html + + default_styles = { + 'Comment' : 'def:comment', +@@ -29,7 +29,7 @@ + raise RuntimeError("don't know how to escape '%s'" % (ch,)) + + def escape_regex(s): +- return cgi.escape(s) ++ return html.escape(s) + + def normalize_id(id): + if id == "C#": +@@ -91,9 +91,9 @@ + if self.mimetypes or self.globs: + string += indent + '\n' + if self.mimetypes: +- string += 2*indent + '%s\n' % (cgi.escape(self.mimetypes),) ++ string += 2*indent + '%s\n' % (html.escape(self.mimetypes),) + if self.globs: +- string += 2*indent + '%s\n' % (cgi.escape(self.globs),) ++ string += 2*indent + '%s\n' % (html.escape(self.globs),) + string += indent + '\n\n' + + return string +@@ -175,7 +175,7 @@ + self.is_container = False + + def format(self, indent, esc_ctx, line_esc_ctx): +- print "Implement me: %s.format()" % (type(self).__name__,) ++ print("Implement me: %s.format()" % (type(self).__name__,)) + return indent*2 + '\n' % (self.id) + + def format_escape(self, indent, esc_ctx, line_esc_ctx): +@@ -472,7 +472,7 @@ + elif cur.tagName == "syntax-item": + ctx = parseSyntaxItem(cur, name, _name, style) + else: +- print "Unknown tag: %s" % (cur.tagName,) ++ print("Unknown tag: %s" % (cur.tagName,)) + ctx = None + + return ctx +@@ -510,7 +510,7 @@ + import sys + + if not sys.argv[1:]: +- print "usage: %s LANG_FILE" % (sys.argv[0]) ++ print("usage: %s LANG_FILE" % (sys.argv[0])) + sys.exit(1) + + lang_file = parse_file(sys.argv[1]) diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template index 1ffb4346694..09d13015265 100644 --- a/srcpkgs/gtksourceview2/template +++ b/srcpkgs/gtksourceview2/template @@ -1,7 +1,7 @@ # Template file for 'gtksourceview2' pkgname=gtksourceview2 version=2.10.5 -revision=7 +revision=8 build_style=gnu-configure configure_args="--disable-static" hostmakedepends="pkg-config intltool glib-devel" @@ -12,8 +12,7 @@ license="GPL-2.0-or-later" homepage="http://www.gnome.org" distfiles="${GNOME_SITE}/gtksourceview/2.10/gtksourceview-${version}.tar.bz2" checksum=c585773743b1df8a04b1be7f7d90eecdf22681490d6810be54c81a7ae152191e -# convert.py:178 -python_version=2 +python_version=3 post_patch() { vsed -i -e 's/DATADIRNAME=lib/DATADIRNAME=share/' configure