void-packages/srcpkgs/gtksourceview2/patches/python3.patch

60 lines
2.0 KiB
Diff

--- 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 + '<metadata>\n'
if self.mimetypes:
- string += 2*indent + '<property name="mimetypes">%s</property>\n' % (cgi.escape(self.mimetypes),)
+ string += 2*indent + '<property name="mimetypes">%s</property>\n' % (html.escape(self.mimetypes),)
if self.globs:
- string += 2*indent + '<property name="globs">%s</property>\n' % (cgi.escape(self.globs),)
+ string += 2*indent + '<property name="globs">%s</property>\n' % (html.escape(self.globs),)
string += indent + '</metadata>\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 + '<context id="%s"/>\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])