Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] py2->3 fixes
@ 2023-10-08  1:36 classabbyamp
  2023-10-08  1:58 ` [PR PATCH] [Updated] " classabbyamp
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-08  1:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

There is a new pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages py2
https://github.com/void-linux/void-packages/pull/46515

py2->3 fixes
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46515.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py2-46515.patch --]
[-- Type: text/x-diff, Size: 13856 bytes --]

From d6f9d04eda8f5220ae4f733c94a784a1ec5fcd57 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:38:21 -0400
Subject: [PATCH 1/5] 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 0000000000000..0a05b38556d66
--- /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 + '<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])
diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template
index 1ffb434669413..09d1301526530 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

From dffae39d70ee2c7be09ffff9d69a658402599ec0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:51:37 -0400
Subject: [PATCH 2/5] kcachegrind: patch for python3

---
 srcpkgs/kcachegrind/patches/python3.patch | 77 +++++++++++++++++++++++
 srcpkgs/kcachegrind/template              |  4 +-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kcachegrind/patches/python3.patch

diff --git a/srcpkgs/kcachegrind/patches/python3.patch b/srcpkgs/kcachegrind/patches/python3.patch
new file mode 100644
index 0000000000000..1d701ddf0321c
--- /dev/null
+++ b/srcpkgs/kcachegrind/patches/python3.patch
@@ -0,0 +1,77 @@
+--- a/converters/hotshot2calltree.in
++++ b/converters/hotshot2calltree.in
+@@ -147,8 +147,8 @@
+         if (file_limit > 0) and (filecount > file_limit):
+             break
+     
+-    print
+-    print "total_cost: % d Ticks",total_cost
++    print()
++    print("total_cost: % d Ticks",total_cost)
+     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
+ 
+ def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
+@@ -234,9 +234,9 @@
+             return_from_call(caller_stack, call_dict, total_cost)
+ 
+     except IOError:
+-        print "could not open inputfile '%s', ignore this." % inputfilename
+-    except EOFError, m:
+-        print "EOF: %s" % (m,)
++        print("could not open inputfile '%s', ignore this." % inputfilename)
++    except EOFError as m:
++        print("EOF: %s" % (m,))
+     return total_cost
+ 
+ def pretty_name(file, function):
+@@ -252,7 +252,7 @@
+         self.last_values = {}
+ 
+     def clearTag(self, tag):
+-        if self.last_values.has_key(tag):
++        if tag in self.last_values.keys():
+             del self.last_values[ tag ]
+     def clear(self):
+         self.last_values = {}
+@@ -316,16 +316,16 @@
+ def run_without_optparse():
+     """parse the options without optparse, use sys.argv"""
+     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
+-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
++        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
+         return
+     outputfilename = sys.argv[2]
+     try:
+-        output = file(outputfilename, "w")
++        output = open(outputfilename, "w")
+         args = sys.argv[3:]
+         convertProfFiles(output, args)
+         output.close()
+     except IOError:
+-        print "could not open '%s' for writing." % outputfilename
++        print("could not open '%s' for writing." % outputfilename)
+ 
+ def run_with_optparse():
+     """parse the options with optparse"""
+@@ -346,10 +346,10 @@
+     file_limit = int(options.file_limit)
+     try:
+         if options.outputfilename and options.outputfilename != "-":
+-            output = file(options.outputfilename, "w")
++            output = open(options.outputfilename, "w")
+             close_output = 1
+     except IOError:
+-        print "could not open '%s' for writing." % options.outputfilename
++        print("could not open '%s' for writing." % options.outputfilename)
+     if output:
+         convertProfFiles(output, args)
+         if close_output:
+@@ -364,7 +364,7 @@
+         prof.runcall(run)
+         prof.close()
+     else:
+-        print "not profiling myself, since '%s' exists, running normal" % filename
++        print("not profiling myself, since '%s' exists, running normal" % filename)
+         run()
+ 
+ # check if optparse is available.
diff --git a/srcpkgs/kcachegrind/template b/srcpkgs/kcachegrind/template
index 0d812ba71f46a..6c295a6f5bf07 100644
--- a/srcpkgs/kcachegrind/template
+++ b/srcpkgs/kcachegrind/template
@@ -1,7 +1,7 @@
 # Template file for 'kcachegrind'
 pkgname=kcachegrind
 version=23.08.0
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
  pkg-config qt5-host-tools qt5-qmake"
@@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
 changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
 distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
-python_version=2
+python_version=3

From a39027e2e990743fd69dc9e32973e1361fbcd612 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 15:26:01 -0400
Subject: [PATCH 3/5] eclipse: works on python3

---
 srcpkgs/eclipse/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/eclipse/template b/srcpkgs/eclipse/template
index 4108117dabc67..56e8f67373236 100644
--- a/srcpkgs/eclipse/template
+++ b/srcpkgs/eclipse/template
@@ -19,7 +19,7 @@ _edition=java
 _mirror="http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse"
 distfiles="${_mirror}/technology/epp/downloads/release/${_release}/${_patch}/eclipse-${_edition}-${_release}-R-linux-gtk-x86_64.tar.gz"
 checksum=142e33831fbbe52f53255a746b35a038dff0366a04cb4d3be2d8fe0ce76f34e8
-python_version=2
+python_version=3
 
 do_install() {
 	vmkdir usr/lib/eclipse

From 5c0261d4654a2edcd6ea1ba86b0eb1fb87743489 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 16:58:44 -0400
Subject: [PATCH 4/5] libdbusmenu-glib: work on python3

---
 .../libdbusmenu-glib/patches/python3.patch    | 60 +++++++++++++++++++
 srcpkgs/libdbusmenu-glib/template             |  3 +-
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libdbusmenu-glib/patches/python3.patch

diff --git a/srcpkgs/libdbusmenu-glib/patches/python3.patch b/srcpkgs/libdbusmenu-glib/patches/python3.patch
new file mode 100644
index 0000000000000..830a19005be58
--- /dev/null
+++ b/srcpkgs/libdbusmenu-glib/patches/python3.patch
@@ -0,0 +1,60 @@
+--- a/tools/dbusmenu-bench
++++ b/tools/dbusmenu-bench
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -61,7 +61,7 @@
+ 
+ def dump_properties(properties, prepend=""):
+     for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++        print("%s- %s: %s" % (prepend, key, value))
+ 
+ 
+ def run_test_sequence(menu, dump=False):
+@@ -74,9 +74,9 @@
+     revision, layout = menu.GetLayout(dbus.Int32(0))
+     times["GetLayout"] = chrono.elapsed()
+     if dump:
+-        print "revision:", revision
+-        print "layout:"
+-        print layout
++        print("revision:", revision)
++        print("layout:")
++        print(layout)
+ 
+     # Get ids
+     tree = ET.fromstring(layout)
+@@ -89,17 +89,17 @@
+     children = menu.GetChildren(dbus.Int32(root_id), property_names)
+     times["GetChildren"] = chrono.elapsed()
+     if dump:
+-        print "children:"
++        print("children:")
+         for child in children:
+             id, properties = child
+-            print "- %d:" % id
++            print("- %d:" % id)
+             dump_properties(properties, prepend=" ")
+ 
+     chrono.restart()
+     properties = menu.GetProperties(dbus.Int32(child_id), property_names)
+     times["GetProperties"] = chrono.elapsed()
+     if dump:
+-        print "properties:"
++        print("properties:")
+         dump_properties(properties)
+ 
+     return times
+@@ -109,7 +109,7 @@
+ 
+ def print_probe(prefix, name, value, timestamp):
+     value = int(value * 1000000)
+-    print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
++    print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
+ 
+ def main():
+     parser = OptionParser(usage = "%prog [options]")
diff --git a/srcpkgs/libdbusmenu-glib/template b/srcpkgs/libdbusmenu-glib/template
index 8981401214cba..26c7d3f201f94 100644
--- a/srcpkgs/libdbusmenu-glib/template
+++ b/srcpkgs/libdbusmenu-glib/template
@@ -1,7 +1,7 @@
 # Template file for 'libdbusmenu-glib'
 pkgname=libdbusmenu-glib
 version=16.04.0
-revision=5
+revision=6
 build_style=gnu-configure
 build_helper="gir"
 configure_args="--disable-dumper --disable-static --disable-tests
@@ -15,7 +15,6 @@ license="GPL-3, LGPL-2.1, LGPL-3"
 homepage="https://launchpad.net/libdbusmenu"
 distfiles="${homepage}/${version%.*}/${version}/+download/libdbusmenu-${version}.tar.gz"
 checksum=b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
-python_version=2 #unverified
 
 build_options="gir"
 build_options_default="gir"

From 3ffb4baccc9ae3594ed29dc66006400928f29d4e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 17:12:55 -0400
Subject: [PATCH 5/5] nitroshare: work on python3

---
 srcpkgs/nitroshare/patches/python3.patch | 13 +++++++++++++
 srcpkgs/nitroshare/template              |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nitroshare/patches/python3.patch

diff --git a/srcpkgs/nitroshare/patches/python3.patch b/srcpkgs/nitroshare/patches/python3.patch
new file mode 100644
index 0000000000000..f30aaaca3d5c4
--- /dev/null
+++ b/srcpkgs/nitroshare/patches/python3.patch
@@ -0,0 +1,13 @@
+--- a/src/dist/nitroshare.py.in
++++ b/src/dist/nitroshare.py.in
+@@ -27,8 +27,8 @@
+ 
+ from json import loads
+ from os import path
+-from urllib import url2pathname
+-from urlparse import urlparse
++from urllib.request import url2pathname
++from urllib.parse import urlparse
+ 
+ import gi
+ gi.require_version('Gtk', '3.0')
diff --git a/srcpkgs/nitroshare/template b/srcpkgs/nitroshare/template
index 50f1a6f62a91c..0850074b28cfd 100644
--- a/srcpkgs/nitroshare/template
+++ b/srcpkgs/nitroshare/template
@@ -1,7 +1,7 @@
 # Template file for 'nitroshare'
 pkgname=nitroshare
 version=0.3.4
-revision=1
+revision=2
 build_style=cmake
 pycompile_dirs="usr/share/nautilus-python/extensions
  usr/share/nemo-python/extensions
@@ -15,7 +15,7 @@ license="MIT"
 homepage="http://nitroshare.net"
 distfiles="https://github.com/nitroshare/nitroshare-desktop/archive/${version}.tar.gz"
 checksum=29874e5909c29211a3c9e13f8c0f49b901ec2996e5d60d80af80d2fb80c3d7ec
-python_version=2 #unverified
+python_version=3
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools"

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
@ 2023-10-08  1:58 ` classabbyamp
  2023-10-08  6:03 ` classabbyamp
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-08  1:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages py2
https://github.com/void-linux/void-packages/pull/46515

py2->3 fixes
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46515.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py2-46515.patch --]
[-- Type: text/x-diff, Size: 20119 bytes --]

From d6f9d04eda8f5220ae4f733c94a784a1ec5fcd57 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:38:21 -0400
Subject: [PATCH 1/7] 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 0000000000000..0a05b38556d66
--- /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 + '<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])
diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template
index 1ffb434669413..09d1301526530 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

From dffae39d70ee2c7be09ffff9d69a658402599ec0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:51:37 -0400
Subject: [PATCH 2/7] kcachegrind: patch for python3

---
 srcpkgs/kcachegrind/patches/python3.patch | 77 +++++++++++++++++++++++
 srcpkgs/kcachegrind/template              |  4 +-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kcachegrind/patches/python3.patch

diff --git a/srcpkgs/kcachegrind/patches/python3.patch b/srcpkgs/kcachegrind/patches/python3.patch
new file mode 100644
index 0000000000000..1d701ddf0321c
--- /dev/null
+++ b/srcpkgs/kcachegrind/patches/python3.patch
@@ -0,0 +1,77 @@
+--- a/converters/hotshot2calltree.in
++++ b/converters/hotshot2calltree.in
+@@ -147,8 +147,8 @@
+         if (file_limit > 0) and (filecount > file_limit):
+             break
+     
+-    print
+-    print "total_cost: % d Ticks",total_cost
++    print()
++    print("total_cost: % d Ticks",total_cost)
+     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
+ 
+ def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
+@@ -234,9 +234,9 @@
+             return_from_call(caller_stack, call_dict, total_cost)
+ 
+     except IOError:
+-        print "could not open inputfile '%s', ignore this." % inputfilename
+-    except EOFError, m:
+-        print "EOF: %s" % (m,)
++        print("could not open inputfile '%s', ignore this." % inputfilename)
++    except EOFError as m:
++        print("EOF: %s" % (m,))
+     return total_cost
+ 
+ def pretty_name(file, function):
+@@ -252,7 +252,7 @@
+         self.last_values = {}
+ 
+     def clearTag(self, tag):
+-        if self.last_values.has_key(tag):
++        if tag in self.last_values.keys():
+             del self.last_values[ tag ]
+     def clear(self):
+         self.last_values = {}
+@@ -316,16 +316,16 @@
+ def run_without_optparse():
+     """parse the options without optparse, use sys.argv"""
+     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
+-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
++        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
+         return
+     outputfilename = sys.argv[2]
+     try:
+-        output = file(outputfilename, "w")
++        output = open(outputfilename, "w")
+         args = sys.argv[3:]
+         convertProfFiles(output, args)
+         output.close()
+     except IOError:
+-        print "could not open '%s' for writing." % outputfilename
++        print("could not open '%s' for writing." % outputfilename)
+ 
+ def run_with_optparse():
+     """parse the options with optparse"""
+@@ -346,10 +346,10 @@
+     file_limit = int(options.file_limit)
+     try:
+         if options.outputfilename and options.outputfilename != "-":
+-            output = file(options.outputfilename, "w")
++            output = open(options.outputfilename, "w")
+             close_output = 1
+     except IOError:
+-        print "could not open '%s' for writing." % options.outputfilename
++        print("could not open '%s' for writing." % options.outputfilename)
+     if output:
+         convertProfFiles(output, args)
+         if close_output:
+@@ -364,7 +364,7 @@
+         prof.runcall(run)
+         prof.close()
+     else:
+-        print "not profiling myself, since '%s' exists, running normal" % filename
++        print("not profiling myself, since '%s' exists, running normal" % filename)
+         run()
+ 
+ # check if optparse is available.
diff --git a/srcpkgs/kcachegrind/template b/srcpkgs/kcachegrind/template
index 0d812ba71f46a..6c295a6f5bf07 100644
--- a/srcpkgs/kcachegrind/template
+++ b/srcpkgs/kcachegrind/template
@@ -1,7 +1,7 @@
 # Template file for 'kcachegrind'
 pkgname=kcachegrind
 version=23.08.0
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
  pkg-config qt5-host-tools qt5-qmake"
@@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
 changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
 distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
-python_version=2
+python_version=3

From 7879ca113da4f64a6709e37c6b14fb384c544f5f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 15:26:01 -0400
Subject: [PATCH 3/7] eclipse: works on python3

---
 srcpkgs/eclipse/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/eclipse/template b/srcpkgs/eclipse/template
index 4108117dabc67..f1b9064b58920 100644
--- a/srcpkgs/eclipse/template
+++ b/srcpkgs/eclipse/template
@@ -1,7 +1,7 @@
 # Template file for 'eclipse'
 pkgname=eclipse
 version=4.28
-revision=1
+revision=2
 #code name of version
 _release=2023-06
 archs="x86_64"
@@ -19,7 +19,7 @@ _edition=java
 _mirror="http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse"
 distfiles="${_mirror}/technology/epp/downloads/release/${_release}/${_patch}/eclipse-${_edition}-${_release}-R-linux-gtk-x86_64.tar.gz"
 checksum=142e33831fbbe52f53255a746b35a038dff0366a04cb4d3be2d8fe0ce76f34e8
-python_version=2
+python_version=3
 
 do_install() {
 	vmkdir usr/lib/eclipse

From ac7d8e537a534ca346090a23660e36d150e87777 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 16:58:44 -0400
Subject: [PATCH 4/7] libdbusmenu-glib: work on python3

---
 .../libdbusmenu-glib/patches/python3.patch    | 60 +++++++++++++++++++
 srcpkgs/libdbusmenu-glib/template             |  3 +-
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libdbusmenu-glib/patches/python3.patch

diff --git a/srcpkgs/libdbusmenu-glib/patches/python3.patch b/srcpkgs/libdbusmenu-glib/patches/python3.patch
new file mode 100644
index 0000000000000..830a19005be58
--- /dev/null
+++ b/srcpkgs/libdbusmenu-glib/patches/python3.patch
@@ -0,0 +1,60 @@
+--- a/tools/dbusmenu-bench
++++ b/tools/dbusmenu-bench
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -61,7 +61,7 @@
+ 
+ def dump_properties(properties, prepend=""):
+     for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++        print("%s- %s: %s" % (prepend, key, value))
+ 
+ 
+ def run_test_sequence(menu, dump=False):
+@@ -74,9 +74,9 @@
+     revision, layout = menu.GetLayout(dbus.Int32(0))
+     times["GetLayout"] = chrono.elapsed()
+     if dump:
+-        print "revision:", revision
+-        print "layout:"
+-        print layout
++        print("revision:", revision)
++        print("layout:")
++        print(layout)
+ 
+     # Get ids
+     tree = ET.fromstring(layout)
+@@ -89,17 +89,17 @@
+     children = menu.GetChildren(dbus.Int32(root_id), property_names)
+     times["GetChildren"] = chrono.elapsed()
+     if dump:
+-        print "children:"
++        print("children:")
+         for child in children:
+             id, properties = child
+-            print "- %d:" % id
++            print("- %d:" % id)
+             dump_properties(properties, prepend=" ")
+ 
+     chrono.restart()
+     properties = menu.GetProperties(dbus.Int32(child_id), property_names)
+     times["GetProperties"] = chrono.elapsed()
+     if dump:
+-        print "properties:"
++        print("properties:")
+         dump_properties(properties)
+ 
+     return times
+@@ -109,7 +109,7 @@
+ 
+ def print_probe(prefix, name, value, timestamp):
+     value = int(value * 1000000)
+-    print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
++    print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
+ 
+ def main():
+     parser = OptionParser(usage = "%prog [options]")
diff --git a/srcpkgs/libdbusmenu-glib/template b/srcpkgs/libdbusmenu-glib/template
index 8981401214cba..26c7d3f201f94 100644
--- a/srcpkgs/libdbusmenu-glib/template
+++ b/srcpkgs/libdbusmenu-glib/template
@@ -1,7 +1,7 @@
 # Template file for 'libdbusmenu-glib'
 pkgname=libdbusmenu-glib
 version=16.04.0
-revision=5
+revision=6
 build_style=gnu-configure
 build_helper="gir"
 configure_args="--disable-dumper --disable-static --disable-tests
@@ -15,7 +15,6 @@ license="GPL-3, LGPL-2.1, LGPL-3"
 homepage="https://launchpad.net/libdbusmenu"
 distfiles="${homepage}/${version%.*}/${version}/+download/libdbusmenu-${version}.tar.gz"
 checksum=b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
-python_version=2 #unverified
 
 build_options="gir"
 build_options_default="gir"

From 6ef1ab58a52abf40e232fdfdc5a03bfec9676a6e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 17:12:55 -0400
Subject: [PATCH 5/7] nitroshare: work on python3

---
 srcpkgs/nitroshare/patches/python3.patch | 13 +++++++++++++
 srcpkgs/nitroshare/template              |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nitroshare/patches/python3.patch

diff --git a/srcpkgs/nitroshare/patches/python3.patch b/srcpkgs/nitroshare/patches/python3.patch
new file mode 100644
index 0000000000000..f30aaaca3d5c4
--- /dev/null
+++ b/srcpkgs/nitroshare/patches/python3.patch
@@ -0,0 +1,13 @@
+--- a/src/dist/nitroshare.py.in
++++ b/src/dist/nitroshare.py.in
+@@ -27,8 +27,8 @@
+ 
+ from json import loads
+ from os import path
+-from urllib import url2pathname
+-from urlparse import urlparse
++from urllib.request import url2pathname
++from urllib.parse import urlparse
+ 
+ import gi
+ gi.require_version('Gtk', '3.0')
diff --git a/srcpkgs/nitroshare/template b/srcpkgs/nitroshare/template
index 50f1a6f62a91c..0850074b28cfd 100644
--- a/srcpkgs/nitroshare/template
+++ b/srcpkgs/nitroshare/template
@@ -1,7 +1,7 @@
 # Template file for 'nitroshare'
 pkgname=nitroshare
 version=0.3.4
-revision=1
+revision=2
 build_style=cmake
 pycompile_dirs="usr/share/nautilus-python/extensions
  usr/share/nemo-python/extensions
@@ -15,7 +15,7 @@ license="MIT"
 homepage="http://nitroshare.net"
 distfiles="https://github.com/nitroshare/nitroshare-desktop/archive/${version}.tar.gz"
 checksum=29874e5909c29211a3c9e13f8c0f49b901ec2996e5d60d80af80d2fb80c3d7ec
-python_version=2 #unverified
+python_version=3
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools"

From f08131992c8c64c7ef05069ca4ce32478d5ab685 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:49:23 -0400
Subject: [PATCH 6/7] tvheadend: compatible with python3

---
 srcpkgs/tvheadend/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tvheadend/template b/srcpkgs/tvheadend/template
index a2004480332b2..9aea7de4ec705 100644
--- a/srcpkgs/tvheadend/template
+++ b/srcpkgs/tvheadend/template
@@ -7,7 +7,7 @@ configure_args="--enable-dvbscan --disable-ffmpeg_static
 --disable-hdhomerun_static --disable-bintray_cache --disable-libx264_static
 --disable-libx265_static --disable-libvpx_static --disable-libtheora_static
 --disable-libvorbis_static --disable-libfdkaac_static"
-hostmakedepends="gettext pkg-config python git which"
+hostmakedepends="gettext pkg-config python3 git which"
 makedepends="avahi-libs-devel openssl-devel zlib-devel libcurl-devel ffmpeg-devel"
 short_desc="TV streaming server"
 maintainer="lemmi <lemmi@nerd2nerd.org>"

From 0c09a8010b2eeb8b76cd0376722ecb18e77891f6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:58:02 -0400
Subject: [PATCH 7/7] skktools: patch for python3

---
 srcpkgs/skktools/patches/python3.patch | 131 +++++++++++++++++++++++++
 srcpkgs/skktools/template              |   4 +-
 2 files changed, 133 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/skktools/patches/python3.patch

diff --git a/srcpkgs/skktools/patches/python3.patch b/srcpkgs/skktools/patches/python3.patch
new file mode 100644
index 0000000000000..efd52da4af257
--- /dev/null
+++ b/srcpkgs/skktools/patches/python3.patch
@@ -0,0 +1,131 @@
+--- a/skk2cdb.py
++++ b/skk2cdb.py
+@@ -16,11 +16,12 @@
+ import sys, os
+ from struct import pack, unpack
+ from array import array
++from functools import reduce
+ 
+ 
+ # calc hash value with a given key
+-def cdbhash(s, n=0L):
+-  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffffL, s, n+5381L)
++def cdbhash(s, n=0):
++  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffff, s, n+5381)
+ 
+ if pack('=i',1) == pack('>i',1):
+   # big endian
+@@ -62,9 +63,9 @@
+   
+   def __init__(self, cdbname, docache=1):
+     self.name = cdbname
+-    self._fp = file(cdbname, 'rb')
++    self._fp = open(cdbname, 'rb')
+     hash0 = decode(self._fp.read(2048))
+-    self._hash0 = [ (hash0[i], hash0[i+1]) for i in xrange(0, 512, 2) ]
++    self._hash0 = [ (hash0[i], hash0[i+1]) for i in range(0, 512, 2) ]
+     self._hash1 = [ None ] * 256
+     (self._eod,_) = self._hash0[0]
+     self._docache = docache
+@@ -93,7 +94,7 @@
+       self._hash1[h1] = hs
+     i = ((h >> 8) % ncells) * 2
+     n = ncells*2
+-    for _ in xrange(ncells):
++    for _ in range(ncells):
+       p1 = hs[i+1]
+       if p1 == 0: raise KeyError(k)
+       if hs[i] == h:
+@@ -122,7 +123,7 @@
+       return False
+ 
+   def __contains__(self, k):
+-    return self.has_key(k)
++    return k in self
+ 
+   def firstkey(self):
+     self._keyiter = None
+@@ -132,7 +133,7 @@
+     if not self._keyiter:
+       self._keyiter = ( k for (k,v) in cdbiter(self._fp, self._eod) )
+     try:
+-      return self._keyiter.next()
++      return next(self._keyiter)
+     except StopIteration:
+       return None
+ 
+@@ -140,7 +141,7 @@
+     if not self._eachiter:
+       self._eachiter = cdbiter(self._fp, self._eod)
+     try:
+-      return self._eachiter.next()
++      return next(self._eachiter)
+     except StopIteration:
+       return None
+   
+@@ -159,9 +160,9 @@
+     self.fn = cdbname
+     self.fntmp = tmpname
+     self.numentries = 0
+-    self._fp = file(tmpname, 'wb')
++    self._fp = open(tmpname, 'wb')
+     self._pos = 2048                    # sizeof((h,p))*256
+-    self._bucket = [ array('I') for _ in xrange(256) ]
++    self._bucket = [ array('I') for _ in range(256) ]
+     return
+ 
+   def __len__(self):
+@@ -197,7 +198,7 @@
+       if not b1: continue
+       blen = len(b1)
+       a = array('I', [0]*blen*2)
+-      for j in xrange(0, blen, 2):
++      for j in range(0, blen, 2):
+         (h,p) = (b1[j],b1[j+1])
+         i = ((h >> 8) % blen)*2
+         while a[i+1]:             # is cell[i] already occupied?
+@@ -238,7 +239,7 @@
+ 
+ # cdbdump
+ def cdbdump(cdbname):
+-  fp = file(cdbname, 'rb')
++  fp = open(cdbname, 'rb')
+   (eor,) = unpack('<I', fp.read(4))
+   return cdbiter(fp, eor)
+ 
+@@ -248,7 +249,7 @@
+   q = []
+   for it in iters:
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       pass
+   k0 = None
+@@ -262,7 +263,7 @@
+     vs.append(v)
+     k0 = k
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       continue
+   if vs: yield (k0,vs)
+@@ -280,7 +281,7 @@
+   import fileinput
+   import os.path
+   def usage():
+-    print 'usage: %s [-f] outfile [infile ...]' % argv[0]
++    print('usage: %s [-f] outfile [infile ...]' % argv[0])
+     return 100
+   try:
+     (opts, args) = getopt.getopt(argv[1:], 'dfo:')
+@@ -292,7 +293,7 @@
+   if not args: return usage()
+   outfile = args.pop(0)
+   if not force and os.path.exists(outfile):
+-    print >>sys.stderr, 'file exists: %r' % outfile
++    print('file exists: %r' % outfile, file=sys.stderr)
+     return 1
+   #
+   maker = CDBMaker(outfile, outfile+'.tmp')
diff --git a/srcpkgs/skktools/template b/srcpkgs/skktools/template
index 4c1ddda99c00e..3cfa8fe3168c5 100644
--- a/srcpkgs/skktools/template
+++ b/srcpkgs/skktools/template
@@ -1,7 +1,7 @@
 # Template file for 'skktools'
 pkgname=skktools
 version=1.3.4
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-gdbm"
 hostmakedepends="pkg-config glib-devel"
@@ -12,7 +12,7 @@ license="GPL-2.0-or-later"
 homepage="http://openlab.ring.gr.jp/skk/"
 distfiles="http://openlab.ring.gr.jp/skk/tools/${pkgname}-${version}.tar.gz"
 checksum=84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168
-python_version=2 #unverified
+python_version=3
 
 post_install() {
 	vmkdir usr/share/${pkgname}

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
  2023-10-08  1:58 ` [PR PATCH] [Updated] " classabbyamp
@ 2023-10-08  6:03 ` classabbyamp
  2023-10-08  6:04 ` classabbyamp
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-08  6:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages py2
https://github.com/void-linux/void-packages/pull/46515

py2->3 fixes
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46515.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py2-46515.patch --]
[-- Type: text/x-diff, Size: 21300 bytes --]

From d6f9d04eda8f5220ae4f733c94a784a1ec5fcd57 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:38:21 -0400
Subject: [PATCH 1/8] 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 0000000000000..0a05b38556d66
--- /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 + '<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])
diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template
index 1ffb434669413..09d1301526530 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

From dffae39d70ee2c7be09ffff9d69a658402599ec0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:51:37 -0400
Subject: [PATCH 2/8] kcachegrind: patch for python3

---
 srcpkgs/kcachegrind/patches/python3.patch | 77 +++++++++++++++++++++++
 srcpkgs/kcachegrind/template              |  4 +-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kcachegrind/patches/python3.patch

diff --git a/srcpkgs/kcachegrind/patches/python3.patch b/srcpkgs/kcachegrind/patches/python3.patch
new file mode 100644
index 0000000000000..1d701ddf0321c
--- /dev/null
+++ b/srcpkgs/kcachegrind/patches/python3.patch
@@ -0,0 +1,77 @@
+--- a/converters/hotshot2calltree.in
++++ b/converters/hotshot2calltree.in
+@@ -147,8 +147,8 @@
+         if (file_limit > 0) and (filecount > file_limit):
+             break
+     
+-    print
+-    print "total_cost: % d Ticks",total_cost
++    print()
++    print("total_cost: % d Ticks",total_cost)
+     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
+ 
+ def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
+@@ -234,9 +234,9 @@
+             return_from_call(caller_stack, call_dict, total_cost)
+ 
+     except IOError:
+-        print "could not open inputfile '%s', ignore this." % inputfilename
+-    except EOFError, m:
+-        print "EOF: %s" % (m,)
++        print("could not open inputfile '%s', ignore this." % inputfilename)
++    except EOFError as m:
++        print("EOF: %s" % (m,))
+     return total_cost
+ 
+ def pretty_name(file, function):
+@@ -252,7 +252,7 @@
+         self.last_values = {}
+ 
+     def clearTag(self, tag):
+-        if self.last_values.has_key(tag):
++        if tag in self.last_values.keys():
+             del self.last_values[ tag ]
+     def clear(self):
+         self.last_values = {}
+@@ -316,16 +316,16 @@
+ def run_without_optparse():
+     """parse the options without optparse, use sys.argv"""
+     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
+-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
++        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
+         return
+     outputfilename = sys.argv[2]
+     try:
+-        output = file(outputfilename, "w")
++        output = open(outputfilename, "w")
+         args = sys.argv[3:]
+         convertProfFiles(output, args)
+         output.close()
+     except IOError:
+-        print "could not open '%s' for writing." % outputfilename
++        print("could not open '%s' for writing." % outputfilename)
+ 
+ def run_with_optparse():
+     """parse the options with optparse"""
+@@ -346,10 +346,10 @@
+     file_limit = int(options.file_limit)
+     try:
+         if options.outputfilename and options.outputfilename != "-":
+-            output = file(options.outputfilename, "w")
++            output = open(options.outputfilename, "w")
+             close_output = 1
+     except IOError:
+-        print "could not open '%s' for writing." % options.outputfilename
++        print("could not open '%s' for writing." % options.outputfilename)
+     if output:
+         convertProfFiles(output, args)
+         if close_output:
+@@ -364,7 +364,7 @@
+         prof.runcall(run)
+         prof.close()
+     else:
+-        print "not profiling myself, since '%s' exists, running normal" % filename
++        print("not profiling myself, since '%s' exists, running normal" % filename)
+         run()
+ 
+ # check if optparse is available.
diff --git a/srcpkgs/kcachegrind/template b/srcpkgs/kcachegrind/template
index 0d812ba71f46a..6c295a6f5bf07 100644
--- a/srcpkgs/kcachegrind/template
+++ b/srcpkgs/kcachegrind/template
@@ -1,7 +1,7 @@
 # Template file for 'kcachegrind'
 pkgname=kcachegrind
 version=23.08.0
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
  pkg-config qt5-host-tools qt5-qmake"
@@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
 changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
 distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
-python_version=2
+python_version=3

From 7879ca113da4f64a6709e37c6b14fb384c544f5f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 15:26:01 -0400
Subject: [PATCH 3/8] eclipse: works on python3

---
 srcpkgs/eclipse/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/eclipse/template b/srcpkgs/eclipse/template
index 4108117dabc67..f1b9064b58920 100644
--- a/srcpkgs/eclipse/template
+++ b/srcpkgs/eclipse/template
@@ -1,7 +1,7 @@
 # Template file for 'eclipse'
 pkgname=eclipse
 version=4.28
-revision=1
+revision=2
 #code name of version
 _release=2023-06
 archs="x86_64"
@@ -19,7 +19,7 @@ _edition=java
 _mirror="http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse"
 distfiles="${_mirror}/technology/epp/downloads/release/${_release}/${_patch}/eclipse-${_edition}-${_release}-R-linux-gtk-x86_64.tar.gz"
 checksum=142e33831fbbe52f53255a746b35a038dff0366a04cb4d3be2d8fe0ce76f34e8
-python_version=2
+python_version=3
 
 do_install() {
 	vmkdir usr/lib/eclipse

From ac7d8e537a534ca346090a23660e36d150e87777 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 16:58:44 -0400
Subject: [PATCH 4/8] libdbusmenu-glib: work on python3

---
 .../libdbusmenu-glib/patches/python3.patch    | 60 +++++++++++++++++++
 srcpkgs/libdbusmenu-glib/template             |  3 +-
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libdbusmenu-glib/patches/python3.patch

diff --git a/srcpkgs/libdbusmenu-glib/patches/python3.patch b/srcpkgs/libdbusmenu-glib/patches/python3.patch
new file mode 100644
index 0000000000000..830a19005be58
--- /dev/null
+++ b/srcpkgs/libdbusmenu-glib/patches/python3.patch
@@ -0,0 +1,60 @@
+--- a/tools/dbusmenu-bench
++++ b/tools/dbusmenu-bench
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -61,7 +61,7 @@
+ 
+ def dump_properties(properties, prepend=""):
+     for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++        print("%s- %s: %s" % (prepend, key, value))
+ 
+ 
+ def run_test_sequence(menu, dump=False):
+@@ -74,9 +74,9 @@
+     revision, layout = menu.GetLayout(dbus.Int32(0))
+     times["GetLayout"] = chrono.elapsed()
+     if dump:
+-        print "revision:", revision
+-        print "layout:"
+-        print layout
++        print("revision:", revision)
++        print("layout:")
++        print(layout)
+ 
+     # Get ids
+     tree = ET.fromstring(layout)
+@@ -89,17 +89,17 @@
+     children = menu.GetChildren(dbus.Int32(root_id), property_names)
+     times["GetChildren"] = chrono.elapsed()
+     if dump:
+-        print "children:"
++        print("children:")
+         for child in children:
+             id, properties = child
+-            print "- %d:" % id
++            print("- %d:" % id)
+             dump_properties(properties, prepend=" ")
+ 
+     chrono.restart()
+     properties = menu.GetProperties(dbus.Int32(child_id), property_names)
+     times["GetProperties"] = chrono.elapsed()
+     if dump:
+-        print "properties:"
++        print("properties:")
+         dump_properties(properties)
+ 
+     return times
+@@ -109,7 +109,7 @@
+ 
+ def print_probe(prefix, name, value, timestamp):
+     value = int(value * 1000000)
+-    print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
++    print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
+ 
+ def main():
+     parser = OptionParser(usage = "%prog [options]")
diff --git a/srcpkgs/libdbusmenu-glib/template b/srcpkgs/libdbusmenu-glib/template
index 8981401214cba..26c7d3f201f94 100644
--- a/srcpkgs/libdbusmenu-glib/template
+++ b/srcpkgs/libdbusmenu-glib/template
@@ -1,7 +1,7 @@
 # Template file for 'libdbusmenu-glib'
 pkgname=libdbusmenu-glib
 version=16.04.0
-revision=5
+revision=6
 build_style=gnu-configure
 build_helper="gir"
 configure_args="--disable-dumper --disable-static --disable-tests
@@ -15,7 +15,6 @@ license="GPL-3, LGPL-2.1, LGPL-3"
 homepage="https://launchpad.net/libdbusmenu"
 distfiles="${homepage}/${version%.*}/${version}/+download/libdbusmenu-${version}.tar.gz"
 checksum=b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
-python_version=2 #unverified
 
 build_options="gir"
 build_options_default="gir"

From 6ef1ab58a52abf40e232fdfdc5a03bfec9676a6e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 17:12:55 -0400
Subject: [PATCH 5/8] nitroshare: work on python3

---
 srcpkgs/nitroshare/patches/python3.patch | 13 +++++++++++++
 srcpkgs/nitroshare/template              |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nitroshare/patches/python3.patch

diff --git a/srcpkgs/nitroshare/patches/python3.patch b/srcpkgs/nitroshare/patches/python3.patch
new file mode 100644
index 0000000000000..f30aaaca3d5c4
--- /dev/null
+++ b/srcpkgs/nitroshare/patches/python3.patch
@@ -0,0 +1,13 @@
+--- a/src/dist/nitroshare.py.in
++++ b/src/dist/nitroshare.py.in
+@@ -27,8 +27,8 @@
+ 
+ from json import loads
+ from os import path
+-from urllib import url2pathname
+-from urlparse import urlparse
++from urllib.request import url2pathname
++from urllib.parse import urlparse
+ 
+ import gi
+ gi.require_version('Gtk', '3.0')
diff --git a/srcpkgs/nitroshare/template b/srcpkgs/nitroshare/template
index 50f1a6f62a91c..0850074b28cfd 100644
--- a/srcpkgs/nitroshare/template
+++ b/srcpkgs/nitroshare/template
@@ -1,7 +1,7 @@
 # Template file for 'nitroshare'
 pkgname=nitroshare
 version=0.3.4
-revision=1
+revision=2
 build_style=cmake
 pycompile_dirs="usr/share/nautilus-python/extensions
  usr/share/nemo-python/extensions
@@ -15,7 +15,7 @@ license="MIT"
 homepage="http://nitroshare.net"
 distfiles="https://github.com/nitroshare/nitroshare-desktop/archive/${version}.tar.gz"
 checksum=29874e5909c29211a3c9e13f8c0f49b901ec2996e5d60d80af80d2fb80c3d7ec
-python_version=2 #unverified
+python_version=3
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools"

From f08131992c8c64c7ef05069ca4ce32478d5ab685 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:49:23 -0400
Subject: [PATCH 6/8] tvheadend: compatible with python3

---
 srcpkgs/tvheadend/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tvheadend/template b/srcpkgs/tvheadend/template
index a2004480332b2..9aea7de4ec705 100644
--- a/srcpkgs/tvheadend/template
+++ b/srcpkgs/tvheadend/template
@@ -7,7 +7,7 @@ configure_args="--enable-dvbscan --disable-ffmpeg_static
 --disable-hdhomerun_static --disable-bintray_cache --disable-libx264_static
 --disable-libx265_static --disable-libvpx_static --disable-libtheora_static
 --disable-libvorbis_static --disable-libfdkaac_static"
-hostmakedepends="gettext pkg-config python git which"
+hostmakedepends="gettext pkg-config python3 git which"
 makedepends="avahi-libs-devel openssl-devel zlib-devel libcurl-devel ffmpeg-devel"
 short_desc="TV streaming server"
 maintainer="lemmi <lemmi@nerd2nerd.org>"

From 0c09a8010b2eeb8b76cd0376722ecb18e77891f6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:58:02 -0400
Subject: [PATCH 7/8] skktools: patch for python3

---
 srcpkgs/skktools/patches/python3.patch | 131 +++++++++++++++++++++++++
 srcpkgs/skktools/template              |   4 +-
 2 files changed, 133 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/skktools/patches/python3.patch

diff --git a/srcpkgs/skktools/patches/python3.patch b/srcpkgs/skktools/patches/python3.patch
new file mode 100644
index 0000000000000..efd52da4af257
--- /dev/null
+++ b/srcpkgs/skktools/patches/python3.patch
@@ -0,0 +1,131 @@
+--- a/skk2cdb.py
++++ b/skk2cdb.py
+@@ -16,11 +16,12 @@
+ import sys, os
+ from struct import pack, unpack
+ from array import array
++from functools import reduce
+ 
+ 
+ # calc hash value with a given key
+-def cdbhash(s, n=0L):
+-  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffffL, s, n+5381L)
++def cdbhash(s, n=0):
++  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffff, s, n+5381)
+ 
+ if pack('=i',1) == pack('>i',1):
+   # big endian
+@@ -62,9 +63,9 @@
+   
+   def __init__(self, cdbname, docache=1):
+     self.name = cdbname
+-    self._fp = file(cdbname, 'rb')
++    self._fp = open(cdbname, 'rb')
+     hash0 = decode(self._fp.read(2048))
+-    self._hash0 = [ (hash0[i], hash0[i+1]) for i in xrange(0, 512, 2) ]
++    self._hash0 = [ (hash0[i], hash0[i+1]) for i in range(0, 512, 2) ]
+     self._hash1 = [ None ] * 256
+     (self._eod,_) = self._hash0[0]
+     self._docache = docache
+@@ -93,7 +94,7 @@
+       self._hash1[h1] = hs
+     i = ((h >> 8) % ncells) * 2
+     n = ncells*2
+-    for _ in xrange(ncells):
++    for _ in range(ncells):
+       p1 = hs[i+1]
+       if p1 == 0: raise KeyError(k)
+       if hs[i] == h:
+@@ -122,7 +123,7 @@
+       return False
+ 
+   def __contains__(self, k):
+-    return self.has_key(k)
++    return k in self
+ 
+   def firstkey(self):
+     self._keyiter = None
+@@ -132,7 +133,7 @@
+     if not self._keyiter:
+       self._keyiter = ( k for (k,v) in cdbiter(self._fp, self._eod) )
+     try:
+-      return self._keyiter.next()
++      return next(self._keyiter)
+     except StopIteration:
+       return None
+ 
+@@ -140,7 +141,7 @@
+     if not self._eachiter:
+       self._eachiter = cdbiter(self._fp, self._eod)
+     try:
+-      return self._eachiter.next()
++      return next(self._eachiter)
+     except StopIteration:
+       return None
+   
+@@ -159,9 +160,9 @@
+     self.fn = cdbname
+     self.fntmp = tmpname
+     self.numentries = 0
+-    self._fp = file(tmpname, 'wb')
++    self._fp = open(tmpname, 'wb')
+     self._pos = 2048                    # sizeof((h,p))*256
+-    self._bucket = [ array('I') for _ in xrange(256) ]
++    self._bucket = [ array('I') for _ in range(256) ]
+     return
+ 
+   def __len__(self):
+@@ -197,7 +198,7 @@
+       if not b1: continue
+       blen = len(b1)
+       a = array('I', [0]*blen*2)
+-      for j in xrange(0, blen, 2):
++      for j in range(0, blen, 2):
+         (h,p) = (b1[j],b1[j+1])
+         i = ((h >> 8) % blen)*2
+         while a[i+1]:             # is cell[i] already occupied?
+@@ -238,7 +239,7 @@
+ 
+ # cdbdump
+ def cdbdump(cdbname):
+-  fp = file(cdbname, 'rb')
++  fp = open(cdbname, 'rb')
+   (eor,) = unpack('<I', fp.read(4))
+   return cdbiter(fp, eor)
+ 
+@@ -248,7 +249,7 @@
+   q = []
+   for it in iters:
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       pass
+   k0 = None
+@@ -262,7 +263,7 @@
+     vs.append(v)
+     k0 = k
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       continue
+   if vs: yield (k0,vs)
+@@ -280,7 +281,7 @@
+   import fileinput
+   import os.path
+   def usage():
+-    print 'usage: %s [-f] outfile [infile ...]' % argv[0]
++    print('usage: %s [-f] outfile [infile ...]' % argv[0])
+     return 100
+   try:
+     (opts, args) = getopt.getopt(argv[1:], 'dfo:')
+@@ -292,7 +293,7 @@
+   if not args: return usage()
+   outfile = args.pop(0)
+   if not force and os.path.exists(outfile):
+-    print >>sys.stderr, 'file exists: %r' % outfile
++    print('file exists: %r' % outfile, file=sys.stderr)
+     return 1
+   #
+   maker = CDBMaker(outfile, outfile+'.tmp')
diff --git a/srcpkgs/skktools/template b/srcpkgs/skktools/template
index 4c1ddda99c00e..3cfa8fe3168c5 100644
--- a/srcpkgs/skktools/template
+++ b/srcpkgs/skktools/template
@@ -1,7 +1,7 @@
 # Template file for 'skktools'
 pkgname=skktools
 version=1.3.4
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-gdbm"
 hostmakedepends="pkg-config glib-devel"
@@ -12,7 +12,7 @@ license="GPL-2.0-or-later"
 homepage="http://openlab.ring.gr.jp/skk/"
 distfiles="http://openlab.ring.gr.jp/skk/tools/${pkgname}-${version}.tar.gz"
 checksum=84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168
-python_version=2 #unverified
+python_version=3
 
 post_install() {
 	vmkdir usr/share/${pkgname}

From 2b1e64d1f3f5b18c7f1e3f30906d66a96b1d3477 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:03:37 -0400
Subject: [PATCH 8/8] tacacs: convert script to python3

---
 srcpkgs/tacacs/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/tacacs/template b/srcpkgs/tacacs/template
index 1cb4f17935297..179fc1fa161ee 100644
--- a/srcpkgs/tacacs/template
+++ b/srcpkgs/tacacs/template
@@ -1,7 +1,7 @@
 # Template file for 'tacacs'
 pkgname=tacacs
 version=4.0.4.28
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--with-libwrap=no"
 hostmakedepends="flex perl"
@@ -10,9 +10,9 @@ short_desc="Modified version of Cisco's tacacs+ (tac_plus) developer's kit"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="custom:Cisco"
 homepage="http://www.shrubbery.net/tac_plus/"
-distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/$pkgname-F$version.tar.gz"
+distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/tacacs-F$version.tar.gz"
 checksum=147f2dc98d26d2f93f0aba76c988ced196ffe1c001dc2e91f788a1a2c747219e
-python_version=2
+python_version=3
 disable_parallel_build=yes
 
 pre_configure() {

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
  2023-10-08  1:58 ` [PR PATCH] [Updated] " classabbyamp
  2023-10-08  6:03 ` classabbyamp
@ 2023-10-08  6:04 ` classabbyamp
  2023-10-08  6:43 ` classabbyamp
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-08  6:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages py2
https://github.com/void-linux/void-packages/pull/46515

py2->3 fixes
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46515.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py2-46515.patch --]
[-- Type: text/x-diff, Size: 25447 bytes --]

From d6f9d04eda8f5220ae4f733c94a784a1ec5fcd57 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:38:21 -0400
Subject: [PATCH 1/8] 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 0000000000000..0a05b38556d66
--- /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 + '<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])
diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template
index 1ffb434669413..09d1301526530 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

From dffae39d70ee2c7be09ffff9d69a658402599ec0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:51:37 -0400
Subject: [PATCH 2/8] kcachegrind: patch for python3

---
 srcpkgs/kcachegrind/patches/python3.patch | 77 +++++++++++++++++++++++
 srcpkgs/kcachegrind/template              |  4 +-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kcachegrind/patches/python3.patch

diff --git a/srcpkgs/kcachegrind/patches/python3.patch b/srcpkgs/kcachegrind/patches/python3.patch
new file mode 100644
index 0000000000000..1d701ddf0321c
--- /dev/null
+++ b/srcpkgs/kcachegrind/patches/python3.patch
@@ -0,0 +1,77 @@
+--- a/converters/hotshot2calltree.in
++++ b/converters/hotshot2calltree.in
+@@ -147,8 +147,8 @@
+         if (file_limit > 0) and (filecount > file_limit):
+             break
+     
+-    print
+-    print "total_cost: % d Ticks",total_cost
++    print()
++    print("total_cost: % d Ticks",total_cost)
+     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
+ 
+ def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
+@@ -234,9 +234,9 @@
+             return_from_call(caller_stack, call_dict, total_cost)
+ 
+     except IOError:
+-        print "could not open inputfile '%s', ignore this." % inputfilename
+-    except EOFError, m:
+-        print "EOF: %s" % (m,)
++        print("could not open inputfile '%s', ignore this." % inputfilename)
++    except EOFError as m:
++        print("EOF: %s" % (m,))
+     return total_cost
+ 
+ def pretty_name(file, function):
+@@ -252,7 +252,7 @@
+         self.last_values = {}
+ 
+     def clearTag(self, tag):
+-        if self.last_values.has_key(tag):
++        if tag in self.last_values.keys():
+             del self.last_values[ tag ]
+     def clear(self):
+         self.last_values = {}
+@@ -316,16 +316,16 @@
+ def run_without_optparse():
+     """parse the options without optparse, use sys.argv"""
+     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
+-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
++        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
+         return
+     outputfilename = sys.argv[2]
+     try:
+-        output = file(outputfilename, "w")
++        output = open(outputfilename, "w")
+         args = sys.argv[3:]
+         convertProfFiles(output, args)
+         output.close()
+     except IOError:
+-        print "could not open '%s' for writing." % outputfilename
++        print("could not open '%s' for writing." % outputfilename)
+ 
+ def run_with_optparse():
+     """parse the options with optparse"""
+@@ -346,10 +346,10 @@
+     file_limit = int(options.file_limit)
+     try:
+         if options.outputfilename and options.outputfilename != "-":
+-            output = file(options.outputfilename, "w")
++            output = open(options.outputfilename, "w")
+             close_output = 1
+     except IOError:
+-        print "could not open '%s' for writing." % options.outputfilename
++        print("could not open '%s' for writing." % options.outputfilename)
+     if output:
+         convertProfFiles(output, args)
+         if close_output:
+@@ -364,7 +364,7 @@
+         prof.runcall(run)
+         prof.close()
+     else:
+-        print "not profiling myself, since '%s' exists, running normal" % filename
++        print("not profiling myself, since '%s' exists, running normal" % filename)
+         run()
+ 
+ # check if optparse is available.
diff --git a/srcpkgs/kcachegrind/template b/srcpkgs/kcachegrind/template
index 0d812ba71f46a..6c295a6f5bf07 100644
--- a/srcpkgs/kcachegrind/template
+++ b/srcpkgs/kcachegrind/template
@@ -1,7 +1,7 @@
 # Template file for 'kcachegrind'
 pkgname=kcachegrind
 version=23.08.0
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
  pkg-config qt5-host-tools qt5-qmake"
@@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
 changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
 distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
-python_version=2
+python_version=3

From 7879ca113da4f64a6709e37c6b14fb384c544f5f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 15:26:01 -0400
Subject: [PATCH 3/8] eclipse: works on python3

---
 srcpkgs/eclipse/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/eclipse/template b/srcpkgs/eclipse/template
index 4108117dabc67..f1b9064b58920 100644
--- a/srcpkgs/eclipse/template
+++ b/srcpkgs/eclipse/template
@@ -1,7 +1,7 @@
 # Template file for 'eclipse'
 pkgname=eclipse
 version=4.28
-revision=1
+revision=2
 #code name of version
 _release=2023-06
 archs="x86_64"
@@ -19,7 +19,7 @@ _edition=java
 _mirror="http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse"
 distfiles="${_mirror}/technology/epp/downloads/release/${_release}/${_patch}/eclipse-${_edition}-${_release}-R-linux-gtk-x86_64.tar.gz"
 checksum=142e33831fbbe52f53255a746b35a038dff0366a04cb4d3be2d8fe0ce76f34e8
-python_version=2
+python_version=3
 
 do_install() {
 	vmkdir usr/lib/eclipse

From ac7d8e537a534ca346090a23660e36d150e87777 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 16:58:44 -0400
Subject: [PATCH 4/8] libdbusmenu-glib: work on python3

---
 .../libdbusmenu-glib/patches/python3.patch    | 60 +++++++++++++++++++
 srcpkgs/libdbusmenu-glib/template             |  3 +-
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libdbusmenu-glib/patches/python3.patch

diff --git a/srcpkgs/libdbusmenu-glib/patches/python3.patch b/srcpkgs/libdbusmenu-glib/patches/python3.patch
new file mode 100644
index 0000000000000..830a19005be58
--- /dev/null
+++ b/srcpkgs/libdbusmenu-glib/patches/python3.patch
@@ -0,0 +1,60 @@
+--- a/tools/dbusmenu-bench
++++ b/tools/dbusmenu-bench
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -61,7 +61,7 @@
+ 
+ def dump_properties(properties, prepend=""):
+     for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++        print("%s- %s: %s" % (prepend, key, value))
+ 
+ 
+ def run_test_sequence(menu, dump=False):
+@@ -74,9 +74,9 @@
+     revision, layout = menu.GetLayout(dbus.Int32(0))
+     times["GetLayout"] = chrono.elapsed()
+     if dump:
+-        print "revision:", revision
+-        print "layout:"
+-        print layout
++        print("revision:", revision)
++        print("layout:")
++        print(layout)
+ 
+     # Get ids
+     tree = ET.fromstring(layout)
+@@ -89,17 +89,17 @@
+     children = menu.GetChildren(dbus.Int32(root_id), property_names)
+     times["GetChildren"] = chrono.elapsed()
+     if dump:
+-        print "children:"
++        print("children:")
+         for child in children:
+             id, properties = child
+-            print "- %d:" % id
++            print("- %d:" % id)
+             dump_properties(properties, prepend=" ")
+ 
+     chrono.restart()
+     properties = menu.GetProperties(dbus.Int32(child_id), property_names)
+     times["GetProperties"] = chrono.elapsed()
+     if dump:
+-        print "properties:"
++        print("properties:")
+         dump_properties(properties)
+ 
+     return times
+@@ -109,7 +109,7 @@
+ 
+ def print_probe(prefix, name, value, timestamp):
+     value = int(value * 1000000)
+-    print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
++    print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
+ 
+ def main():
+     parser = OptionParser(usage = "%prog [options]")
diff --git a/srcpkgs/libdbusmenu-glib/template b/srcpkgs/libdbusmenu-glib/template
index 8981401214cba..26c7d3f201f94 100644
--- a/srcpkgs/libdbusmenu-glib/template
+++ b/srcpkgs/libdbusmenu-glib/template
@@ -1,7 +1,7 @@
 # Template file for 'libdbusmenu-glib'
 pkgname=libdbusmenu-glib
 version=16.04.0
-revision=5
+revision=6
 build_style=gnu-configure
 build_helper="gir"
 configure_args="--disable-dumper --disable-static --disable-tests
@@ -15,7 +15,6 @@ license="GPL-3, LGPL-2.1, LGPL-3"
 homepage="https://launchpad.net/libdbusmenu"
 distfiles="${homepage}/${version%.*}/${version}/+download/libdbusmenu-${version}.tar.gz"
 checksum=b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
-python_version=2 #unverified
 
 build_options="gir"
 build_options_default="gir"

From 6ef1ab58a52abf40e232fdfdc5a03bfec9676a6e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 17:12:55 -0400
Subject: [PATCH 5/8] nitroshare: work on python3

---
 srcpkgs/nitroshare/patches/python3.patch | 13 +++++++++++++
 srcpkgs/nitroshare/template              |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nitroshare/patches/python3.patch

diff --git a/srcpkgs/nitroshare/patches/python3.patch b/srcpkgs/nitroshare/patches/python3.patch
new file mode 100644
index 0000000000000..f30aaaca3d5c4
--- /dev/null
+++ b/srcpkgs/nitroshare/patches/python3.patch
@@ -0,0 +1,13 @@
+--- a/src/dist/nitroshare.py.in
++++ b/src/dist/nitroshare.py.in
+@@ -27,8 +27,8 @@
+ 
+ from json import loads
+ from os import path
+-from urllib import url2pathname
+-from urlparse import urlparse
++from urllib.request import url2pathname
++from urllib.parse import urlparse
+ 
+ import gi
+ gi.require_version('Gtk', '3.0')
diff --git a/srcpkgs/nitroshare/template b/srcpkgs/nitroshare/template
index 50f1a6f62a91c..0850074b28cfd 100644
--- a/srcpkgs/nitroshare/template
+++ b/srcpkgs/nitroshare/template
@@ -1,7 +1,7 @@
 # Template file for 'nitroshare'
 pkgname=nitroshare
 version=0.3.4
-revision=1
+revision=2
 build_style=cmake
 pycompile_dirs="usr/share/nautilus-python/extensions
  usr/share/nemo-python/extensions
@@ -15,7 +15,7 @@ license="MIT"
 homepage="http://nitroshare.net"
 distfiles="https://github.com/nitroshare/nitroshare-desktop/archive/${version}.tar.gz"
 checksum=29874e5909c29211a3c9e13f8c0f49b901ec2996e5d60d80af80d2fb80c3d7ec
-python_version=2 #unverified
+python_version=3
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools"

From f08131992c8c64c7ef05069ca4ce32478d5ab685 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:49:23 -0400
Subject: [PATCH 6/8] tvheadend: compatible with python3

---
 srcpkgs/tvheadend/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tvheadend/template b/srcpkgs/tvheadend/template
index a2004480332b2..9aea7de4ec705 100644
--- a/srcpkgs/tvheadend/template
+++ b/srcpkgs/tvheadend/template
@@ -7,7 +7,7 @@ configure_args="--enable-dvbscan --disable-ffmpeg_static
 --disable-hdhomerun_static --disable-bintray_cache --disable-libx264_static
 --disable-libx265_static --disable-libvpx_static --disable-libtheora_static
 --disable-libvorbis_static --disable-libfdkaac_static"
-hostmakedepends="gettext pkg-config python git which"
+hostmakedepends="gettext pkg-config python3 git which"
 makedepends="avahi-libs-devel openssl-devel zlib-devel libcurl-devel ffmpeg-devel"
 short_desc="TV streaming server"
 maintainer="lemmi <lemmi@nerd2nerd.org>"

From 0c09a8010b2eeb8b76cd0376722ecb18e77891f6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:58:02 -0400
Subject: [PATCH 7/8] skktools: patch for python3

---
 srcpkgs/skktools/patches/python3.patch | 131 +++++++++++++++++++++++++
 srcpkgs/skktools/template              |   4 +-
 2 files changed, 133 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/skktools/patches/python3.patch

diff --git a/srcpkgs/skktools/patches/python3.patch b/srcpkgs/skktools/patches/python3.patch
new file mode 100644
index 0000000000000..efd52da4af257
--- /dev/null
+++ b/srcpkgs/skktools/patches/python3.patch
@@ -0,0 +1,131 @@
+--- a/skk2cdb.py
++++ b/skk2cdb.py
+@@ -16,11 +16,12 @@
+ import sys, os
+ from struct import pack, unpack
+ from array import array
++from functools import reduce
+ 
+ 
+ # calc hash value with a given key
+-def cdbhash(s, n=0L):
+-  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffffL, s, n+5381L)
++def cdbhash(s, n=0):
++  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffff, s, n+5381)
+ 
+ if pack('=i',1) == pack('>i',1):
+   # big endian
+@@ -62,9 +63,9 @@
+   
+   def __init__(self, cdbname, docache=1):
+     self.name = cdbname
+-    self._fp = file(cdbname, 'rb')
++    self._fp = open(cdbname, 'rb')
+     hash0 = decode(self._fp.read(2048))
+-    self._hash0 = [ (hash0[i], hash0[i+1]) for i in xrange(0, 512, 2) ]
++    self._hash0 = [ (hash0[i], hash0[i+1]) for i in range(0, 512, 2) ]
+     self._hash1 = [ None ] * 256
+     (self._eod,_) = self._hash0[0]
+     self._docache = docache
+@@ -93,7 +94,7 @@
+       self._hash1[h1] = hs
+     i = ((h >> 8) % ncells) * 2
+     n = ncells*2
+-    for _ in xrange(ncells):
++    for _ in range(ncells):
+       p1 = hs[i+1]
+       if p1 == 0: raise KeyError(k)
+       if hs[i] == h:
+@@ -122,7 +123,7 @@
+       return False
+ 
+   def __contains__(self, k):
+-    return self.has_key(k)
++    return k in self
+ 
+   def firstkey(self):
+     self._keyiter = None
+@@ -132,7 +133,7 @@
+     if not self._keyiter:
+       self._keyiter = ( k for (k,v) in cdbiter(self._fp, self._eod) )
+     try:
+-      return self._keyiter.next()
++      return next(self._keyiter)
+     except StopIteration:
+       return None
+ 
+@@ -140,7 +141,7 @@
+     if not self._eachiter:
+       self._eachiter = cdbiter(self._fp, self._eod)
+     try:
+-      return self._eachiter.next()
++      return next(self._eachiter)
+     except StopIteration:
+       return None
+   
+@@ -159,9 +160,9 @@
+     self.fn = cdbname
+     self.fntmp = tmpname
+     self.numentries = 0
+-    self._fp = file(tmpname, 'wb')
++    self._fp = open(tmpname, 'wb')
+     self._pos = 2048                    # sizeof((h,p))*256
+-    self._bucket = [ array('I') for _ in xrange(256) ]
++    self._bucket = [ array('I') for _ in range(256) ]
+     return
+ 
+   def __len__(self):
+@@ -197,7 +198,7 @@
+       if not b1: continue
+       blen = len(b1)
+       a = array('I', [0]*blen*2)
+-      for j in xrange(0, blen, 2):
++      for j in range(0, blen, 2):
+         (h,p) = (b1[j],b1[j+1])
+         i = ((h >> 8) % blen)*2
+         while a[i+1]:             # is cell[i] already occupied?
+@@ -238,7 +239,7 @@
+ 
+ # cdbdump
+ def cdbdump(cdbname):
+-  fp = file(cdbname, 'rb')
++  fp = open(cdbname, 'rb')
+   (eor,) = unpack('<I', fp.read(4))
+   return cdbiter(fp, eor)
+ 
+@@ -248,7 +249,7 @@
+   q = []
+   for it in iters:
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       pass
+   k0 = None
+@@ -262,7 +263,7 @@
+     vs.append(v)
+     k0 = k
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       continue
+   if vs: yield (k0,vs)
+@@ -280,7 +281,7 @@
+   import fileinput
+   import os.path
+   def usage():
+-    print 'usage: %s [-f] outfile [infile ...]' % argv[0]
++    print('usage: %s [-f] outfile [infile ...]' % argv[0])
+     return 100
+   try:
+     (opts, args) = getopt.getopt(argv[1:], 'dfo:')
+@@ -292,7 +293,7 @@
+   if not args: return usage()
+   outfile = args.pop(0)
+   if not force and os.path.exists(outfile):
+-    print >>sys.stderr, 'file exists: %r' % outfile
++    print('file exists: %r' % outfile, file=sys.stderr)
+     return 1
+   #
+   maker = CDBMaker(outfile, outfile+'.tmp')
diff --git a/srcpkgs/skktools/template b/srcpkgs/skktools/template
index 4c1ddda99c00e..3cfa8fe3168c5 100644
--- a/srcpkgs/skktools/template
+++ b/srcpkgs/skktools/template
@@ -1,7 +1,7 @@
 # Template file for 'skktools'
 pkgname=skktools
 version=1.3.4
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-gdbm"
 hostmakedepends="pkg-config glib-devel"
@@ -12,7 +12,7 @@ license="GPL-2.0-or-later"
 homepage="http://openlab.ring.gr.jp/skk/"
 distfiles="http://openlab.ring.gr.jp/skk/tools/${pkgname}-${version}.tar.gz"
 checksum=84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168
-python_version=2 #unverified
+python_version=3
 
 post_install() {
 	vmkdir usr/share/${pkgname}

From ea71613db67d29d922ded4efa04a9a9ad43d7d0a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:03:37 -0400
Subject: [PATCH 8/8] tacacs: convert script to python3

---
 srcpkgs/tacacs/patches/python3.patch | 98 ++++++++++++++++++++++++++++
 srcpkgs/tacacs/template              |  6 +-
 2 files changed, 101 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/tacacs/patches/python3.patch

diff --git a/srcpkgs/tacacs/patches/python3.patch b/srcpkgs/tacacs/patches/python3.patch
new file mode 100644
index 0000000000000..c8183d69a8b3e
--- /dev/null
+++ b/srcpkgs/tacacs/patches/python3.patch
@@ -0,0 +1,98 @@
+--- a/do_auth.py
++++ b/do_auth.py
+@@ -211,7 +211,7 @@
+ Written by Dan Schmidt - Please visit tacacs.org to check for updates.
+ '''
+ 
+-import sys,re,getopt,ConfigParser
++import sys,re,getopt,configparser
+ from time import strftime
+ 
+ # I really don't want to deal with these exceptions more than once
+@@ -230,23 +230,23 @@
+     #Should not have any exceptions - BUT, just in case
+     try:
+         attributes = config.get(the_section, the_option)
+-    except ConfigParser.NoSectionError:
++    except configparser.NoSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Section '%s' Doesn't Exist!\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.DuplicateSectionError:
++    except configparser.DuplicateSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Duplicate section '%s'\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.NoOptionError:
++    except configparser.NoOptionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                     + "Error: '%s' not found in section '%s\n'" 
+                      % (the_option, the_section))
+         sys.exit(1)
+     #To do: finish exceptions. 
+-    except ConfigParser.ParsingError:
++    except configparser.ParsingError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't parse file '%s'! (You got me)\n" 
+              % (filename))
+@@ -298,9 +298,9 @@
+     argv = sys.argv
+     try:
+         optlist, args = getopt.getopt(sys.argv[1:], 'i:u:f:l:d:?:D', ['fix_crs_bug','?', '-?', 'help', 'Help'])
+-    except getopt.GetoptError, err:
+-        print str(err) 
+-        print __doc__
++    except getopt.GetoptError as err:
++        print(str(err)) 
++        print(__doc__)
+         sys.exit(1)
+     for (i, j) in optlist:
+         if i == '-i':
+@@ -314,15 +314,15 @@
+         elif i == '-d':
+             device = j
+         elif i in ('?', '-?', 'help', 'Help'):
+-            print __doc__
++            print(__doc__)
+             sys.exit(1)
+         elif i == '-D':
+             is_debug = True
+         else:
+-            print 'Unknown option:', i
++            print('Unknown option:', i)
+             sys.exit(1)
+     if len(argv) < 7:
+-        print __doc__
++        print(__doc__)
+         sys.exit(1)
+     log_file = open (log_name, "a")
+ #DEBUG!  We at least got CALLED
+@@ -384,7 +384,7 @@
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: No username entered!\n")
+         sys.exit(1)
+-    config = ConfigParser.SafeConfigParser()
++    config = configparser.SafeConfigParser()
+     if not (filename in config.read(filename)):
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't open/parse '%s'\n" 
+@@ -491,7 +491,7 @@
+                     for item in return_pairs:
+                         #DEBUG
+                         # log_file.write("Returning:%s\n" % item.strip())
+-                        print item.strip('\n')
++                        print(item.strip('\n'))
+                     if want_tac_pairs:
+                         #DEBUG
+                         # log_file.write("Exiting status 2\n")
+@@ -507,7 +507,7 @@
+             for item in return_pairs:
+                 #DEBUG
+                 # log_file.write("Returning:%s\n" % item.strip())
+-                print item.strip('\n')
++                print(item.strip('\n'))
+             log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                  + "User '%s' granted access to device '%s' in group '%s' from '%s'\n"
+                  % (user_name, device, this_group, ip_addr))
diff --git a/srcpkgs/tacacs/template b/srcpkgs/tacacs/template
index 1cb4f17935297..179fc1fa161ee 100644
--- a/srcpkgs/tacacs/template
+++ b/srcpkgs/tacacs/template
@@ -1,7 +1,7 @@
 # Template file for 'tacacs'
 pkgname=tacacs
 version=4.0.4.28
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--with-libwrap=no"
 hostmakedepends="flex perl"
@@ -10,9 +10,9 @@ short_desc="Modified version of Cisco's tacacs+ (tac_plus) developer's kit"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="custom:Cisco"
 homepage="http://www.shrubbery.net/tac_plus/"
-distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/$pkgname-F$version.tar.gz"
+distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/tacacs-F$version.tar.gz"
 checksum=147f2dc98d26d2f93f0aba76c988ced196ffe1c001dc2e91f788a1a2c747219e
-python_version=2
+python_version=3
 disable_parallel_build=yes
 
 pre_configure() {

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
                   ` (2 preceding siblings ...)
  2023-10-08  6:04 ` classabbyamp
@ 2023-10-08  6:43 ` classabbyamp
  2023-10-08  7:37 ` classabbyamp
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-08  6:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages py2
https://github.com/void-linux/void-packages/pull/46515

py2->3 fixes
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46515.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py2-46515.patch --]
[-- Type: text/x-diff, Size: 26723 bytes --]

From d6f9d04eda8f5220ae4f733c94a784a1ec5fcd57 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:38:21 -0400
Subject: [PATCH 1/9] 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 0000000000000..0a05b38556d66
--- /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 + '<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])
diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template
index 1ffb434669413..09d1301526530 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

From dffae39d70ee2c7be09ffff9d69a658402599ec0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:51:37 -0400
Subject: [PATCH 2/9] kcachegrind: patch for python3

---
 srcpkgs/kcachegrind/patches/python3.patch | 77 +++++++++++++++++++++++
 srcpkgs/kcachegrind/template              |  4 +-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kcachegrind/patches/python3.patch

diff --git a/srcpkgs/kcachegrind/patches/python3.patch b/srcpkgs/kcachegrind/patches/python3.patch
new file mode 100644
index 0000000000000..1d701ddf0321c
--- /dev/null
+++ b/srcpkgs/kcachegrind/patches/python3.patch
@@ -0,0 +1,77 @@
+--- a/converters/hotshot2calltree.in
++++ b/converters/hotshot2calltree.in
+@@ -147,8 +147,8 @@
+         if (file_limit > 0) and (filecount > file_limit):
+             break
+     
+-    print
+-    print "total_cost: % d Ticks",total_cost
++    print()
++    print("total_cost: % d Ticks",total_cost)
+     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
+ 
+ def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
+@@ -234,9 +234,9 @@
+             return_from_call(caller_stack, call_dict, total_cost)
+ 
+     except IOError:
+-        print "could not open inputfile '%s', ignore this." % inputfilename
+-    except EOFError, m:
+-        print "EOF: %s" % (m,)
++        print("could not open inputfile '%s', ignore this." % inputfilename)
++    except EOFError as m:
++        print("EOF: %s" % (m,))
+     return total_cost
+ 
+ def pretty_name(file, function):
+@@ -252,7 +252,7 @@
+         self.last_values = {}
+ 
+     def clearTag(self, tag):
+-        if self.last_values.has_key(tag):
++        if tag in self.last_values.keys():
+             del self.last_values[ tag ]
+     def clear(self):
+         self.last_values = {}
+@@ -316,16 +316,16 @@
+ def run_without_optparse():
+     """parse the options without optparse, use sys.argv"""
+     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
+-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
++        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
+         return
+     outputfilename = sys.argv[2]
+     try:
+-        output = file(outputfilename, "w")
++        output = open(outputfilename, "w")
+         args = sys.argv[3:]
+         convertProfFiles(output, args)
+         output.close()
+     except IOError:
+-        print "could not open '%s' for writing." % outputfilename
++        print("could not open '%s' for writing." % outputfilename)
+ 
+ def run_with_optparse():
+     """parse the options with optparse"""
+@@ -346,10 +346,10 @@
+     file_limit = int(options.file_limit)
+     try:
+         if options.outputfilename and options.outputfilename != "-":
+-            output = file(options.outputfilename, "w")
++            output = open(options.outputfilename, "w")
+             close_output = 1
+     except IOError:
+-        print "could not open '%s' for writing." % options.outputfilename
++        print("could not open '%s' for writing." % options.outputfilename)
+     if output:
+         convertProfFiles(output, args)
+         if close_output:
+@@ -364,7 +364,7 @@
+         prof.runcall(run)
+         prof.close()
+     else:
+-        print "not profiling myself, since '%s' exists, running normal" % filename
++        print("not profiling myself, since '%s' exists, running normal" % filename)
+         run()
+ 
+ # check if optparse is available.
diff --git a/srcpkgs/kcachegrind/template b/srcpkgs/kcachegrind/template
index 0d812ba71f46a..6c295a6f5bf07 100644
--- a/srcpkgs/kcachegrind/template
+++ b/srcpkgs/kcachegrind/template
@@ -1,7 +1,7 @@
 # Template file for 'kcachegrind'
 pkgname=kcachegrind
 version=23.08.0
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
  pkg-config qt5-host-tools qt5-qmake"
@@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
 changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
 distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
-python_version=2
+python_version=3

From 7879ca113da4f64a6709e37c6b14fb384c544f5f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 15:26:01 -0400
Subject: [PATCH 3/9] eclipse: works on python3

---
 srcpkgs/eclipse/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/eclipse/template b/srcpkgs/eclipse/template
index 4108117dabc67..f1b9064b58920 100644
--- a/srcpkgs/eclipse/template
+++ b/srcpkgs/eclipse/template
@@ -1,7 +1,7 @@
 # Template file for 'eclipse'
 pkgname=eclipse
 version=4.28
-revision=1
+revision=2
 #code name of version
 _release=2023-06
 archs="x86_64"
@@ -19,7 +19,7 @@ _edition=java
 _mirror="http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse"
 distfiles="${_mirror}/technology/epp/downloads/release/${_release}/${_patch}/eclipse-${_edition}-${_release}-R-linux-gtk-x86_64.tar.gz"
 checksum=142e33831fbbe52f53255a746b35a038dff0366a04cb4d3be2d8fe0ce76f34e8
-python_version=2
+python_version=3
 
 do_install() {
 	vmkdir usr/lib/eclipse

From ac7d8e537a534ca346090a23660e36d150e87777 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 16:58:44 -0400
Subject: [PATCH 4/9] libdbusmenu-glib: work on python3

---
 .../libdbusmenu-glib/patches/python3.patch    | 60 +++++++++++++++++++
 srcpkgs/libdbusmenu-glib/template             |  3 +-
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libdbusmenu-glib/patches/python3.patch

diff --git a/srcpkgs/libdbusmenu-glib/patches/python3.patch b/srcpkgs/libdbusmenu-glib/patches/python3.patch
new file mode 100644
index 0000000000000..830a19005be58
--- /dev/null
+++ b/srcpkgs/libdbusmenu-glib/patches/python3.patch
@@ -0,0 +1,60 @@
+--- a/tools/dbusmenu-bench
++++ b/tools/dbusmenu-bench
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -61,7 +61,7 @@
+ 
+ def dump_properties(properties, prepend=""):
+     for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++        print("%s- %s: %s" % (prepend, key, value))
+ 
+ 
+ def run_test_sequence(menu, dump=False):
+@@ -74,9 +74,9 @@
+     revision, layout = menu.GetLayout(dbus.Int32(0))
+     times["GetLayout"] = chrono.elapsed()
+     if dump:
+-        print "revision:", revision
+-        print "layout:"
+-        print layout
++        print("revision:", revision)
++        print("layout:")
++        print(layout)
+ 
+     # Get ids
+     tree = ET.fromstring(layout)
+@@ -89,17 +89,17 @@
+     children = menu.GetChildren(dbus.Int32(root_id), property_names)
+     times["GetChildren"] = chrono.elapsed()
+     if dump:
+-        print "children:"
++        print("children:")
+         for child in children:
+             id, properties = child
+-            print "- %d:" % id
++            print("- %d:" % id)
+             dump_properties(properties, prepend=" ")
+ 
+     chrono.restart()
+     properties = menu.GetProperties(dbus.Int32(child_id), property_names)
+     times["GetProperties"] = chrono.elapsed()
+     if dump:
+-        print "properties:"
++        print("properties:")
+         dump_properties(properties)
+ 
+     return times
+@@ -109,7 +109,7 @@
+ 
+ def print_probe(prefix, name, value, timestamp):
+     value = int(value * 1000000)
+-    print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
++    print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
+ 
+ def main():
+     parser = OptionParser(usage = "%prog [options]")
diff --git a/srcpkgs/libdbusmenu-glib/template b/srcpkgs/libdbusmenu-glib/template
index 8981401214cba..26c7d3f201f94 100644
--- a/srcpkgs/libdbusmenu-glib/template
+++ b/srcpkgs/libdbusmenu-glib/template
@@ -1,7 +1,7 @@
 # Template file for 'libdbusmenu-glib'
 pkgname=libdbusmenu-glib
 version=16.04.0
-revision=5
+revision=6
 build_style=gnu-configure
 build_helper="gir"
 configure_args="--disable-dumper --disable-static --disable-tests
@@ -15,7 +15,6 @@ license="GPL-3, LGPL-2.1, LGPL-3"
 homepage="https://launchpad.net/libdbusmenu"
 distfiles="${homepage}/${version%.*}/${version}/+download/libdbusmenu-${version}.tar.gz"
 checksum=b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
-python_version=2 #unverified
 
 build_options="gir"
 build_options_default="gir"

From 6ef1ab58a52abf40e232fdfdc5a03bfec9676a6e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 17:12:55 -0400
Subject: [PATCH 5/9] nitroshare: work on python3

---
 srcpkgs/nitroshare/patches/python3.patch | 13 +++++++++++++
 srcpkgs/nitroshare/template              |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nitroshare/patches/python3.patch

diff --git a/srcpkgs/nitroshare/patches/python3.patch b/srcpkgs/nitroshare/patches/python3.patch
new file mode 100644
index 0000000000000..f30aaaca3d5c4
--- /dev/null
+++ b/srcpkgs/nitroshare/patches/python3.patch
@@ -0,0 +1,13 @@
+--- a/src/dist/nitroshare.py.in
++++ b/src/dist/nitroshare.py.in
+@@ -27,8 +27,8 @@
+ 
+ from json import loads
+ from os import path
+-from urllib import url2pathname
+-from urlparse import urlparse
++from urllib.request import url2pathname
++from urllib.parse import urlparse
+ 
+ import gi
+ gi.require_version('Gtk', '3.0')
diff --git a/srcpkgs/nitroshare/template b/srcpkgs/nitroshare/template
index 50f1a6f62a91c..0850074b28cfd 100644
--- a/srcpkgs/nitroshare/template
+++ b/srcpkgs/nitroshare/template
@@ -1,7 +1,7 @@
 # Template file for 'nitroshare'
 pkgname=nitroshare
 version=0.3.4
-revision=1
+revision=2
 build_style=cmake
 pycompile_dirs="usr/share/nautilus-python/extensions
  usr/share/nemo-python/extensions
@@ -15,7 +15,7 @@ license="MIT"
 homepage="http://nitroshare.net"
 distfiles="https://github.com/nitroshare/nitroshare-desktop/archive/${version}.tar.gz"
 checksum=29874e5909c29211a3c9e13f8c0f49b901ec2996e5d60d80af80d2fb80c3d7ec
-python_version=2 #unverified
+python_version=3
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools"

From f08131992c8c64c7ef05069ca4ce32478d5ab685 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:49:23 -0400
Subject: [PATCH 6/9] tvheadend: compatible with python3

---
 srcpkgs/tvheadend/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tvheadend/template b/srcpkgs/tvheadend/template
index a2004480332b2..9aea7de4ec705 100644
--- a/srcpkgs/tvheadend/template
+++ b/srcpkgs/tvheadend/template
@@ -7,7 +7,7 @@ configure_args="--enable-dvbscan --disable-ffmpeg_static
 --disable-hdhomerun_static --disable-bintray_cache --disable-libx264_static
 --disable-libx265_static --disable-libvpx_static --disable-libtheora_static
 --disable-libvorbis_static --disable-libfdkaac_static"
-hostmakedepends="gettext pkg-config python git which"
+hostmakedepends="gettext pkg-config python3 git which"
 makedepends="avahi-libs-devel openssl-devel zlib-devel libcurl-devel ffmpeg-devel"
 short_desc="TV streaming server"
 maintainer="lemmi <lemmi@nerd2nerd.org>"

From 0c09a8010b2eeb8b76cd0376722ecb18e77891f6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:58:02 -0400
Subject: [PATCH 7/9] skktools: patch for python3

---
 srcpkgs/skktools/patches/python3.patch | 131 +++++++++++++++++++++++++
 srcpkgs/skktools/template              |   4 +-
 2 files changed, 133 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/skktools/patches/python3.patch

diff --git a/srcpkgs/skktools/patches/python3.patch b/srcpkgs/skktools/patches/python3.patch
new file mode 100644
index 0000000000000..efd52da4af257
--- /dev/null
+++ b/srcpkgs/skktools/patches/python3.patch
@@ -0,0 +1,131 @@
+--- a/skk2cdb.py
++++ b/skk2cdb.py
+@@ -16,11 +16,12 @@
+ import sys, os
+ from struct import pack, unpack
+ from array import array
++from functools import reduce
+ 
+ 
+ # calc hash value with a given key
+-def cdbhash(s, n=0L):
+-  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffffL, s, n+5381L)
++def cdbhash(s, n=0):
++  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffff, s, n+5381)
+ 
+ if pack('=i',1) == pack('>i',1):
+   # big endian
+@@ -62,9 +63,9 @@
+   
+   def __init__(self, cdbname, docache=1):
+     self.name = cdbname
+-    self._fp = file(cdbname, 'rb')
++    self._fp = open(cdbname, 'rb')
+     hash0 = decode(self._fp.read(2048))
+-    self._hash0 = [ (hash0[i], hash0[i+1]) for i in xrange(0, 512, 2) ]
++    self._hash0 = [ (hash0[i], hash0[i+1]) for i in range(0, 512, 2) ]
+     self._hash1 = [ None ] * 256
+     (self._eod,_) = self._hash0[0]
+     self._docache = docache
+@@ -93,7 +94,7 @@
+       self._hash1[h1] = hs
+     i = ((h >> 8) % ncells) * 2
+     n = ncells*2
+-    for _ in xrange(ncells):
++    for _ in range(ncells):
+       p1 = hs[i+1]
+       if p1 == 0: raise KeyError(k)
+       if hs[i] == h:
+@@ -122,7 +123,7 @@
+       return False
+ 
+   def __contains__(self, k):
+-    return self.has_key(k)
++    return k in self
+ 
+   def firstkey(self):
+     self._keyiter = None
+@@ -132,7 +133,7 @@
+     if not self._keyiter:
+       self._keyiter = ( k for (k,v) in cdbiter(self._fp, self._eod) )
+     try:
+-      return self._keyiter.next()
++      return next(self._keyiter)
+     except StopIteration:
+       return None
+ 
+@@ -140,7 +141,7 @@
+     if not self._eachiter:
+       self._eachiter = cdbiter(self._fp, self._eod)
+     try:
+-      return self._eachiter.next()
++      return next(self._eachiter)
+     except StopIteration:
+       return None
+   
+@@ -159,9 +160,9 @@
+     self.fn = cdbname
+     self.fntmp = tmpname
+     self.numentries = 0
+-    self._fp = file(tmpname, 'wb')
++    self._fp = open(tmpname, 'wb')
+     self._pos = 2048                    # sizeof((h,p))*256
+-    self._bucket = [ array('I') for _ in xrange(256) ]
++    self._bucket = [ array('I') for _ in range(256) ]
+     return
+ 
+   def __len__(self):
+@@ -197,7 +198,7 @@
+       if not b1: continue
+       blen = len(b1)
+       a = array('I', [0]*blen*2)
+-      for j in xrange(0, blen, 2):
++      for j in range(0, blen, 2):
+         (h,p) = (b1[j],b1[j+1])
+         i = ((h >> 8) % blen)*2
+         while a[i+1]:             # is cell[i] already occupied?
+@@ -238,7 +239,7 @@
+ 
+ # cdbdump
+ def cdbdump(cdbname):
+-  fp = file(cdbname, 'rb')
++  fp = open(cdbname, 'rb')
+   (eor,) = unpack('<I', fp.read(4))
+   return cdbiter(fp, eor)
+ 
+@@ -248,7 +249,7 @@
+   q = []
+   for it in iters:
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       pass
+   k0 = None
+@@ -262,7 +263,7 @@
+     vs.append(v)
+     k0 = k
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       continue
+   if vs: yield (k0,vs)
+@@ -280,7 +281,7 @@
+   import fileinput
+   import os.path
+   def usage():
+-    print 'usage: %s [-f] outfile [infile ...]' % argv[0]
++    print('usage: %s [-f] outfile [infile ...]' % argv[0])
+     return 100
+   try:
+     (opts, args) = getopt.getopt(argv[1:], 'dfo:')
+@@ -292,7 +293,7 @@
+   if not args: return usage()
+   outfile = args.pop(0)
+   if not force and os.path.exists(outfile):
+-    print >>sys.stderr, 'file exists: %r' % outfile
++    print('file exists: %r' % outfile, file=sys.stderr)
+     return 1
+   #
+   maker = CDBMaker(outfile, outfile+'.tmp')
diff --git a/srcpkgs/skktools/template b/srcpkgs/skktools/template
index 4c1ddda99c00e..3cfa8fe3168c5 100644
--- a/srcpkgs/skktools/template
+++ b/srcpkgs/skktools/template
@@ -1,7 +1,7 @@
 # Template file for 'skktools'
 pkgname=skktools
 version=1.3.4
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-gdbm"
 hostmakedepends="pkg-config glib-devel"
@@ -12,7 +12,7 @@ license="GPL-2.0-or-later"
 homepage="http://openlab.ring.gr.jp/skk/"
 distfiles="http://openlab.ring.gr.jp/skk/tools/${pkgname}-${version}.tar.gz"
 checksum=84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168
-python_version=2 #unverified
+python_version=3
 
 post_install() {
 	vmkdir usr/share/${pkgname}

From ea71613db67d29d922ded4efa04a9a9ad43d7d0a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:03:37 -0400
Subject: [PATCH 8/9] tacacs: convert script to python3

---
 srcpkgs/tacacs/patches/python3.patch | 98 ++++++++++++++++++++++++++++
 srcpkgs/tacacs/template              |  6 +-
 2 files changed, 101 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/tacacs/patches/python3.patch

diff --git a/srcpkgs/tacacs/patches/python3.patch b/srcpkgs/tacacs/patches/python3.patch
new file mode 100644
index 0000000000000..c8183d69a8b3e
--- /dev/null
+++ b/srcpkgs/tacacs/patches/python3.patch
@@ -0,0 +1,98 @@
+--- a/do_auth.py
++++ b/do_auth.py
+@@ -211,7 +211,7 @@
+ Written by Dan Schmidt - Please visit tacacs.org to check for updates.
+ '''
+ 
+-import sys,re,getopt,ConfigParser
++import sys,re,getopt,configparser
+ from time import strftime
+ 
+ # I really don't want to deal with these exceptions more than once
+@@ -230,23 +230,23 @@
+     #Should not have any exceptions - BUT, just in case
+     try:
+         attributes = config.get(the_section, the_option)
+-    except ConfigParser.NoSectionError:
++    except configparser.NoSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Section '%s' Doesn't Exist!\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.DuplicateSectionError:
++    except configparser.DuplicateSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Duplicate section '%s'\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.NoOptionError:
++    except configparser.NoOptionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                     + "Error: '%s' not found in section '%s\n'" 
+                      % (the_option, the_section))
+         sys.exit(1)
+     #To do: finish exceptions. 
+-    except ConfigParser.ParsingError:
++    except configparser.ParsingError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't parse file '%s'! (You got me)\n" 
+              % (filename))
+@@ -298,9 +298,9 @@
+     argv = sys.argv
+     try:
+         optlist, args = getopt.getopt(sys.argv[1:], 'i:u:f:l:d:?:D', ['fix_crs_bug','?', '-?', 'help', 'Help'])
+-    except getopt.GetoptError, err:
+-        print str(err) 
+-        print __doc__
++    except getopt.GetoptError as err:
++        print(str(err)) 
++        print(__doc__)
+         sys.exit(1)
+     for (i, j) in optlist:
+         if i == '-i':
+@@ -314,15 +314,15 @@
+         elif i == '-d':
+             device = j
+         elif i in ('?', '-?', 'help', 'Help'):
+-            print __doc__
++            print(__doc__)
+             sys.exit(1)
+         elif i == '-D':
+             is_debug = True
+         else:
+-            print 'Unknown option:', i
++            print('Unknown option:', i)
+             sys.exit(1)
+     if len(argv) < 7:
+-        print __doc__
++        print(__doc__)
+         sys.exit(1)
+     log_file = open (log_name, "a")
+ #DEBUG!  We at least got CALLED
+@@ -384,7 +384,7 @@
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: No username entered!\n")
+         sys.exit(1)
+-    config = ConfigParser.SafeConfigParser()
++    config = configparser.SafeConfigParser()
+     if not (filename in config.read(filename)):
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't open/parse '%s'\n" 
+@@ -491,7 +491,7 @@
+                     for item in return_pairs:
+                         #DEBUG
+                         # log_file.write("Returning:%s\n" % item.strip())
+-                        print item.strip('\n')
++                        print(item.strip('\n'))
+                     if want_tac_pairs:
+                         #DEBUG
+                         # log_file.write("Exiting status 2\n")
+@@ -507,7 +507,7 @@
+             for item in return_pairs:
+                 #DEBUG
+                 # log_file.write("Returning:%s\n" % item.strip())
+-                print item.strip('\n')
++                print(item.strip('\n'))
+             log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                  + "User '%s' granted access to device '%s' in group '%s' from '%s'\n"
+                  % (user_name, device, this_group, ip_addr))
diff --git a/srcpkgs/tacacs/template b/srcpkgs/tacacs/template
index 1cb4f17935297..179fc1fa161ee 100644
--- a/srcpkgs/tacacs/template
+++ b/srcpkgs/tacacs/template
@@ -1,7 +1,7 @@
 # Template file for 'tacacs'
 pkgname=tacacs
 version=4.0.4.28
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--with-libwrap=no"
 hostmakedepends="flex perl"
@@ -10,9 +10,9 @@ short_desc="Modified version of Cisco's tacacs+ (tac_plus) developer's kit"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="custom:Cisco"
 homepage="http://www.shrubbery.net/tac_plus/"
-distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/$pkgname-F$version.tar.gz"
+distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/tacacs-F$version.tar.gz"
 checksum=147f2dc98d26d2f93f0aba76c988ced196ffe1c001dc2e91f788a1a2c747219e
-python_version=2
+python_version=3
 disable_parallel_build=yes
 
 pre_configure() {

From df14b3aa0b9d413d8a8573bca006fb6ee89f541a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:43:33 -0400
Subject: [PATCH 9/9] vdrift: remove sconscript files

---
 srcpkgs/vdrift/template | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/vdrift/template b/srcpkgs/vdrift/template
index 643cb08847d19..90b702affecbc 100644
--- a/srcpkgs/vdrift/template
+++ b/srcpkgs/vdrift/template
@@ -1,7 +1,7 @@
 # Template file for 'vdrift'
 pkgname=vdrift
 version=2014.10.20
-revision=11
+revision=12
 build_style=scons
 scons_use_destdir=yes
 make_build_args="release=1 force_feedback=1 extbullet=1 datadir=share/${pkgname}"
@@ -16,7 +16,7 @@ license="GPL-3.0-or-later"
 homepage="http://vdrift.net/"
 distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version//./-}.tar.bz2"
 checksum=458d45d59075c2ce943ec6bc271a5bd0eb6bc6ed123670b65038703345020be3
-python_version=2
+python_version=3
 
 post_install() {
 	# install .desktop file
@@ -31,6 +31,9 @@ post_install() {
 	done
 	vinstall data/textures/icons/vdrift-64x64.png 644 \
 		usr/share/pixmaps vdrift.png
+
+	# remove unnecessary build system files
+	find "${DESTDIR}"/usr/share/vdrift -name '*SConscript*' -delete
 }
 
 vdrift-data_package() {

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
                   ` (3 preceding siblings ...)
  2023-10-08  6:43 ` classabbyamp
@ 2023-10-08  7:37 ` classabbyamp
  2023-10-08 10:28 ` [PR REVIEW] " r-ricci
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-08  7:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages py2
https://github.com/void-linux/void-packages/pull/46515

py2->3 fixes
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46515.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py2-46515.patch --]
[-- Type: text/x-diff, Size: 30352 bytes --]

From d6f9d04eda8f5220ae4f733c94a784a1ec5fcd57 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:38:21 -0400
Subject: [PATCH 01/10] 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 0000000000000..0a05b38556d66
--- /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 + '<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])
diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template
index 1ffb434669413..09d1301526530 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

From dffae39d70ee2c7be09ffff9d69a658402599ec0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:51:37 -0400
Subject: [PATCH 02/10] kcachegrind: patch for python3

---
 srcpkgs/kcachegrind/patches/python3.patch | 77 +++++++++++++++++++++++
 srcpkgs/kcachegrind/template              |  4 +-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kcachegrind/patches/python3.patch

diff --git a/srcpkgs/kcachegrind/patches/python3.patch b/srcpkgs/kcachegrind/patches/python3.patch
new file mode 100644
index 0000000000000..1d701ddf0321c
--- /dev/null
+++ b/srcpkgs/kcachegrind/patches/python3.patch
@@ -0,0 +1,77 @@
+--- a/converters/hotshot2calltree.in
++++ b/converters/hotshot2calltree.in
+@@ -147,8 +147,8 @@
+         if (file_limit > 0) and (filecount > file_limit):
+             break
+     
+-    print
+-    print "total_cost: % d Ticks",total_cost
++    print()
++    print("total_cost: % d Ticks",total_cost)
+     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
+ 
+ def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
+@@ -234,9 +234,9 @@
+             return_from_call(caller_stack, call_dict, total_cost)
+ 
+     except IOError:
+-        print "could not open inputfile '%s', ignore this." % inputfilename
+-    except EOFError, m:
+-        print "EOF: %s" % (m,)
++        print("could not open inputfile '%s', ignore this." % inputfilename)
++    except EOFError as m:
++        print("EOF: %s" % (m,))
+     return total_cost
+ 
+ def pretty_name(file, function):
+@@ -252,7 +252,7 @@
+         self.last_values = {}
+ 
+     def clearTag(self, tag):
+-        if self.last_values.has_key(tag):
++        if tag in self.last_values.keys():
+             del self.last_values[ tag ]
+     def clear(self):
+         self.last_values = {}
+@@ -316,16 +316,16 @@
+ def run_without_optparse():
+     """parse the options without optparse, use sys.argv"""
+     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
+-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
++        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
+         return
+     outputfilename = sys.argv[2]
+     try:
+-        output = file(outputfilename, "w")
++        output = open(outputfilename, "w")
+         args = sys.argv[3:]
+         convertProfFiles(output, args)
+         output.close()
+     except IOError:
+-        print "could not open '%s' for writing." % outputfilename
++        print("could not open '%s' for writing." % outputfilename)
+ 
+ def run_with_optparse():
+     """parse the options with optparse"""
+@@ -346,10 +346,10 @@
+     file_limit = int(options.file_limit)
+     try:
+         if options.outputfilename and options.outputfilename != "-":
+-            output = file(options.outputfilename, "w")
++            output = open(options.outputfilename, "w")
+             close_output = 1
+     except IOError:
+-        print "could not open '%s' for writing." % options.outputfilename
++        print("could not open '%s' for writing." % options.outputfilename)
+     if output:
+         convertProfFiles(output, args)
+         if close_output:
+@@ -364,7 +364,7 @@
+         prof.runcall(run)
+         prof.close()
+     else:
+-        print "not profiling myself, since '%s' exists, running normal" % filename
++        print("not profiling myself, since '%s' exists, running normal" % filename)
+         run()
+ 
+ # check if optparse is available.
diff --git a/srcpkgs/kcachegrind/template b/srcpkgs/kcachegrind/template
index 0d812ba71f46a..6c295a6f5bf07 100644
--- a/srcpkgs/kcachegrind/template
+++ b/srcpkgs/kcachegrind/template
@@ -1,7 +1,7 @@
 # Template file for 'kcachegrind'
 pkgname=kcachegrind
 version=23.08.0
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
  pkg-config qt5-host-tools qt5-qmake"
@@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
 changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
 distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
-python_version=2
+python_version=3

From 7879ca113da4f64a6709e37c6b14fb384c544f5f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 15:26:01 -0400
Subject: [PATCH 03/10] eclipse: works on python3

---
 srcpkgs/eclipse/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/eclipse/template b/srcpkgs/eclipse/template
index 4108117dabc67..f1b9064b58920 100644
--- a/srcpkgs/eclipse/template
+++ b/srcpkgs/eclipse/template
@@ -1,7 +1,7 @@
 # Template file for 'eclipse'
 pkgname=eclipse
 version=4.28
-revision=1
+revision=2
 #code name of version
 _release=2023-06
 archs="x86_64"
@@ -19,7 +19,7 @@ _edition=java
 _mirror="http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse"
 distfiles="${_mirror}/technology/epp/downloads/release/${_release}/${_patch}/eclipse-${_edition}-${_release}-R-linux-gtk-x86_64.tar.gz"
 checksum=142e33831fbbe52f53255a746b35a038dff0366a04cb4d3be2d8fe0ce76f34e8
-python_version=2
+python_version=3
 
 do_install() {
 	vmkdir usr/lib/eclipse

From ac7d8e537a534ca346090a23660e36d150e87777 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 16:58:44 -0400
Subject: [PATCH 04/10] libdbusmenu-glib: work on python3

---
 .../libdbusmenu-glib/patches/python3.patch    | 60 +++++++++++++++++++
 srcpkgs/libdbusmenu-glib/template             |  3 +-
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libdbusmenu-glib/patches/python3.patch

diff --git a/srcpkgs/libdbusmenu-glib/patches/python3.patch b/srcpkgs/libdbusmenu-glib/patches/python3.patch
new file mode 100644
index 0000000000000..830a19005be58
--- /dev/null
+++ b/srcpkgs/libdbusmenu-glib/patches/python3.patch
@@ -0,0 +1,60 @@
+--- a/tools/dbusmenu-bench
++++ b/tools/dbusmenu-bench
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -61,7 +61,7 @@
+ 
+ def dump_properties(properties, prepend=""):
+     for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++        print("%s- %s: %s" % (prepend, key, value))
+ 
+ 
+ def run_test_sequence(menu, dump=False):
+@@ -74,9 +74,9 @@
+     revision, layout = menu.GetLayout(dbus.Int32(0))
+     times["GetLayout"] = chrono.elapsed()
+     if dump:
+-        print "revision:", revision
+-        print "layout:"
+-        print layout
++        print("revision:", revision)
++        print("layout:")
++        print(layout)
+ 
+     # Get ids
+     tree = ET.fromstring(layout)
+@@ -89,17 +89,17 @@
+     children = menu.GetChildren(dbus.Int32(root_id), property_names)
+     times["GetChildren"] = chrono.elapsed()
+     if dump:
+-        print "children:"
++        print("children:")
+         for child in children:
+             id, properties = child
+-            print "- %d:" % id
++            print("- %d:" % id)
+             dump_properties(properties, prepend=" ")
+ 
+     chrono.restart()
+     properties = menu.GetProperties(dbus.Int32(child_id), property_names)
+     times["GetProperties"] = chrono.elapsed()
+     if dump:
+-        print "properties:"
++        print("properties:")
+         dump_properties(properties)
+ 
+     return times
+@@ -109,7 +109,7 @@
+ 
+ def print_probe(prefix, name, value, timestamp):
+     value = int(value * 1000000)
+-    print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
++    print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
+ 
+ def main():
+     parser = OptionParser(usage = "%prog [options]")
diff --git a/srcpkgs/libdbusmenu-glib/template b/srcpkgs/libdbusmenu-glib/template
index 8981401214cba..26c7d3f201f94 100644
--- a/srcpkgs/libdbusmenu-glib/template
+++ b/srcpkgs/libdbusmenu-glib/template
@@ -1,7 +1,7 @@
 # Template file for 'libdbusmenu-glib'
 pkgname=libdbusmenu-glib
 version=16.04.0
-revision=5
+revision=6
 build_style=gnu-configure
 build_helper="gir"
 configure_args="--disable-dumper --disable-static --disable-tests
@@ -15,7 +15,6 @@ license="GPL-3, LGPL-2.1, LGPL-3"
 homepage="https://launchpad.net/libdbusmenu"
 distfiles="${homepage}/${version%.*}/${version}/+download/libdbusmenu-${version}.tar.gz"
 checksum=b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
-python_version=2 #unverified
 
 build_options="gir"
 build_options_default="gir"

From 6ef1ab58a52abf40e232fdfdc5a03bfec9676a6e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 17:12:55 -0400
Subject: [PATCH 05/10] nitroshare: work on python3

---
 srcpkgs/nitroshare/patches/python3.patch | 13 +++++++++++++
 srcpkgs/nitroshare/template              |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nitroshare/patches/python3.patch

diff --git a/srcpkgs/nitroshare/patches/python3.patch b/srcpkgs/nitroshare/patches/python3.patch
new file mode 100644
index 0000000000000..f30aaaca3d5c4
--- /dev/null
+++ b/srcpkgs/nitroshare/patches/python3.patch
@@ -0,0 +1,13 @@
+--- a/src/dist/nitroshare.py.in
++++ b/src/dist/nitroshare.py.in
+@@ -27,8 +27,8 @@
+ 
+ from json import loads
+ from os import path
+-from urllib import url2pathname
+-from urlparse import urlparse
++from urllib.request import url2pathname
++from urllib.parse import urlparse
+ 
+ import gi
+ gi.require_version('Gtk', '3.0')
diff --git a/srcpkgs/nitroshare/template b/srcpkgs/nitroshare/template
index 50f1a6f62a91c..0850074b28cfd 100644
--- a/srcpkgs/nitroshare/template
+++ b/srcpkgs/nitroshare/template
@@ -1,7 +1,7 @@
 # Template file for 'nitroshare'
 pkgname=nitroshare
 version=0.3.4
-revision=1
+revision=2
 build_style=cmake
 pycompile_dirs="usr/share/nautilus-python/extensions
  usr/share/nemo-python/extensions
@@ -15,7 +15,7 @@ license="MIT"
 homepage="http://nitroshare.net"
 distfiles="https://github.com/nitroshare/nitroshare-desktop/archive/${version}.tar.gz"
 checksum=29874e5909c29211a3c9e13f8c0f49b901ec2996e5d60d80af80d2fb80c3d7ec
-python_version=2 #unverified
+python_version=3
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools"

From f08131992c8c64c7ef05069ca4ce32478d5ab685 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:49:23 -0400
Subject: [PATCH 06/10] tvheadend: compatible with python3

---
 srcpkgs/tvheadend/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tvheadend/template b/srcpkgs/tvheadend/template
index a2004480332b2..9aea7de4ec705 100644
--- a/srcpkgs/tvheadend/template
+++ b/srcpkgs/tvheadend/template
@@ -7,7 +7,7 @@ configure_args="--enable-dvbscan --disable-ffmpeg_static
 --disable-hdhomerun_static --disable-bintray_cache --disable-libx264_static
 --disable-libx265_static --disable-libvpx_static --disable-libtheora_static
 --disable-libvorbis_static --disable-libfdkaac_static"
-hostmakedepends="gettext pkg-config python git which"
+hostmakedepends="gettext pkg-config python3 git which"
 makedepends="avahi-libs-devel openssl-devel zlib-devel libcurl-devel ffmpeg-devel"
 short_desc="TV streaming server"
 maintainer="lemmi <lemmi@nerd2nerd.org>"

From 0c09a8010b2eeb8b76cd0376722ecb18e77891f6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:58:02 -0400
Subject: [PATCH 07/10] skktools: patch for python3

---
 srcpkgs/skktools/patches/python3.patch | 131 +++++++++++++++++++++++++
 srcpkgs/skktools/template              |   4 +-
 2 files changed, 133 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/skktools/patches/python3.patch

diff --git a/srcpkgs/skktools/patches/python3.patch b/srcpkgs/skktools/patches/python3.patch
new file mode 100644
index 0000000000000..efd52da4af257
--- /dev/null
+++ b/srcpkgs/skktools/patches/python3.patch
@@ -0,0 +1,131 @@
+--- a/skk2cdb.py
++++ b/skk2cdb.py
+@@ -16,11 +16,12 @@
+ import sys, os
+ from struct import pack, unpack
+ from array import array
++from functools import reduce
+ 
+ 
+ # calc hash value with a given key
+-def cdbhash(s, n=0L):
+-  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffffL, s, n+5381L)
++def cdbhash(s, n=0):
++  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffff, s, n+5381)
+ 
+ if pack('=i',1) == pack('>i',1):
+   # big endian
+@@ -62,9 +63,9 @@
+   
+   def __init__(self, cdbname, docache=1):
+     self.name = cdbname
+-    self._fp = file(cdbname, 'rb')
++    self._fp = open(cdbname, 'rb')
+     hash0 = decode(self._fp.read(2048))
+-    self._hash0 = [ (hash0[i], hash0[i+1]) for i in xrange(0, 512, 2) ]
++    self._hash0 = [ (hash0[i], hash0[i+1]) for i in range(0, 512, 2) ]
+     self._hash1 = [ None ] * 256
+     (self._eod,_) = self._hash0[0]
+     self._docache = docache
+@@ -93,7 +94,7 @@
+       self._hash1[h1] = hs
+     i = ((h >> 8) % ncells) * 2
+     n = ncells*2
+-    for _ in xrange(ncells):
++    for _ in range(ncells):
+       p1 = hs[i+1]
+       if p1 == 0: raise KeyError(k)
+       if hs[i] == h:
+@@ -122,7 +123,7 @@
+       return False
+ 
+   def __contains__(self, k):
+-    return self.has_key(k)
++    return k in self
+ 
+   def firstkey(self):
+     self._keyiter = None
+@@ -132,7 +133,7 @@
+     if not self._keyiter:
+       self._keyiter = ( k for (k,v) in cdbiter(self._fp, self._eod) )
+     try:
+-      return self._keyiter.next()
++      return next(self._keyiter)
+     except StopIteration:
+       return None
+ 
+@@ -140,7 +141,7 @@
+     if not self._eachiter:
+       self._eachiter = cdbiter(self._fp, self._eod)
+     try:
+-      return self._eachiter.next()
++      return next(self._eachiter)
+     except StopIteration:
+       return None
+   
+@@ -159,9 +160,9 @@
+     self.fn = cdbname
+     self.fntmp = tmpname
+     self.numentries = 0
+-    self._fp = file(tmpname, 'wb')
++    self._fp = open(tmpname, 'wb')
+     self._pos = 2048                    # sizeof((h,p))*256
+-    self._bucket = [ array('I') for _ in xrange(256) ]
++    self._bucket = [ array('I') for _ in range(256) ]
+     return
+ 
+   def __len__(self):
+@@ -197,7 +198,7 @@
+       if not b1: continue
+       blen = len(b1)
+       a = array('I', [0]*blen*2)
+-      for j in xrange(0, blen, 2):
++      for j in range(0, blen, 2):
+         (h,p) = (b1[j],b1[j+1])
+         i = ((h >> 8) % blen)*2
+         while a[i+1]:             # is cell[i] already occupied?
+@@ -238,7 +239,7 @@
+ 
+ # cdbdump
+ def cdbdump(cdbname):
+-  fp = file(cdbname, 'rb')
++  fp = open(cdbname, 'rb')
+   (eor,) = unpack('<I', fp.read(4))
+   return cdbiter(fp, eor)
+ 
+@@ -248,7 +249,7 @@
+   q = []
+   for it in iters:
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       pass
+   k0 = None
+@@ -262,7 +263,7 @@
+     vs.append(v)
+     k0 = k
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       continue
+   if vs: yield (k0,vs)
+@@ -280,7 +281,7 @@
+   import fileinput
+   import os.path
+   def usage():
+-    print 'usage: %s [-f] outfile [infile ...]' % argv[0]
++    print('usage: %s [-f] outfile [infile ...]' % argv[0])
+     return 100
+   try:
+     (opts, args) = getopt.getopt(argv[1:], 'dfo:')
+@@ -292,7 +293,7 @@
+   if not args: return usage()
+   outfile = args.pop(0)
+   if not force and os.path.exists(outfile):
+-    print >>sys.stderr, 'file exists: %r' % outfile
++    print('file exists: %r' % outfile, file=sys.stderr)
+     return 1
+   #
+   maker = CDBMaker(outfile, outfile+'.tmp')
diff --git a/srcpkgs/skktools/template b/srcpkgs/skktools/template
index 4c1ddda99c00e..3cfa8fe3168c5 100644
--- a/srcpkgs/skktools/template
+++ b/srcpkgs/skktools/template
@@ -1,7 +1,7 @@
 # Template file for 'skktools'
 pkgname=skktools
 version=1.3.4
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-gdbm"
 hostmakedepends="pkg-config glib-devel"
@@ -12,7 +12,7 @@ license="GPL-2.0-or-later"
 homepage="http://openlab.ring.gr.jp/skk/"
 distfiles="http://openlab.ring.gr.jp/skk/tools/${pkgname}-${version}.tar.gz"
 checksum=84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168
-python_version=2 #unverified
+python_version=3
 
 post_install() {
 	vmkdir usr/share/${pkgname}

From ea71613db67d29d922ded4efa04a9a9ad43d7d0a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:03:37 -0400
Subject: [PATCH 08/10] tacacs: convert script to python3

---
 srcpkgs/tacacs/patches/python3.patch | 98 ++++++++++++++++++++++++++++
 srcpkgs/tacacs/template              |  6 +-
 2 files changed, 101 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/tacacs/patches/python3.patch

diff --git a/srcpkgs/tacacs/patches/python3.patch b/srcpkgs/tacacs/patches/python3.patch
new file mode 100644
index 0000000000000..c8183d69a8b3e
--- /dev/null
+++ b/srcpkgs/tacacs/patches/python3.patch
@@ -0,0 +1,98 @@
+--- a/do_auth.py
++++ b/do_auth.py
+@@ -211,7 +211,7 @@
+ Written by Dan Schmidt - Please visit tacacs.org to check for updates.
+ '''
+ 
+-import sys,re,getopt,ConfigParser
++import sys,re,getopt,configparser
+ from time import strftime
+ 
+ # I really don't want to deal with these exceptions more than once
+@@ -230,23 +230,23 @@
+     #Should not have any exceptions - BUT, just in case
+     try:
+         attributes = config.get(the_section, the_option)
+-    except ConfigParser.NoSectionError:
++    except configparser.NoSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Section '%s' Doesn't Exist!\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.DuplicateSectionError:
++    except configparser.DuplicateSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Duplicate section '%s'\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.NoOptionError:
++    except configparser.NoOptionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                     + "Error: '%s' not found in section '%s\n'" 
+                      % (the_option, the_section))
+         sys.exit(1)
+     #To do: finish exceptions. 
+-    except ConfigParser.ParsingError:
++    except configparser.ParsingError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't parse file '%s'! (You got me)\n" 
+              % (filename))
+@@ -298,9 +298,9 @@
+     argv = sys.argv
+     try:
+         optlist, args = getopt.getopt(sys.argv[1:], 'i:u:f:l:d:?:D', ['fix_crs_bug','?', '-?', 'help', 'Help'])
+-    except getopt.GetoptError, err:
+-        print str(err) 
+-        print __doc__
++    except getopt.GetoptError as err:
++        print(str(err)) 
++        print(__doc__)
+         sys.exit(1)
+     for (i, j) in optlist:
+         if i == '-i':
+@@ -314,15 +314,15 @@
+         elif i == '-d':
+             device = j
+         elif i in ('?', '-?', 'help', 'Help'):
+-            print __doc__
++            print(__doc__)
+             sys.exit(1)
+         elif i == '-D':
+             is_debug = True
+         else:
+-            print 'Unknown option:', i
++            print('Unknown option:', i)
+             sys.exit(1)
+     if len(argv) < 7:
+-        print __doc__
++        print(__doc__)
+         sys.exit(1)
+     log_file = open (log_name, "a")
+ #DEBUG!  We at least got CALLED
+@@ -384,7 +384,7 @@
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: No username entered!\n")
+         sys.exit(1)
+-    config = ConfigParser.SafeConfigParser()
++    config = configparser.SafeConfigParser()
+     if not (filename in config.read(filename)):
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't open/parse '%s'\n" 
+@@ -491,7 +491,7 @@
+                     for item in return_pairs:
+                         #DEBUG
+                         # log_file.write("Returning:%s\n" % item.strip())
+-                        print item.strip('\n')
++                        print(item.strip('\n'))
+                     if want_tac_pairs:
+                         #DEBUG
+                         # log_file.write("Exiting status 2\n")
+@@ -507,7 +507,7 @@
+             for item in return_pairs:
+                 #DEBUG
+                 # log_file.write("Returning:%s\n" % item.strip())
+-                print item.strip('\n')
++                print(item.strip('\n'))
+             log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                  + "User '%s' granted access to device '%s' in group '%s' from '%s'\n"
+                  % (user_name, device, this_group, ip_addr))
diff --git a/srcpkgs/tacacs/template b/srcpkgs/tacacs/template
index 1cb4f17935297..179fc1fa161ee 100644
--- a/srcpkgs/tacacs/template
+++ b/srcpkgs/tacacs/template
@@ -1,7 +1,7 @@
 # Template file for 'tacacs'
 pkgname=tacacs
 version=4.0.4.28
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--with-libwrap=no"
 hostmakedepends="flex perl"
@@ -10,9 +10,9 @@ short_desc="Modified version of Cisco's tacacs+ (tac_plus) developer's kit"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="custom:Cisco"
 homepage="http://www.shrubbery.net/tac_plus/"
-distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/$pkgname-F$version.tar.gz"
+distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/tacacs-F$version.tar.gz"
 checksum=147f2dc98d26d2f93f0aba76c988ced196ffe1c001dc2e91f788a1a2c747219e
-python_version=2
+python_version=3
 disable_parallel_build=yes
 
 pre_configure() {

From df14b3aa0b9d413d8a8573bca006fb6ee89f541a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:43:33 -0400
Subject: [PATCH 09/10] vdrift: remove sconscript files

---
 srcpkgs/vdrift/template | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/vdrift/template b/srcpkgs/vdrift/template
index 643cb08847d19..90b702affecbc 100644
--- a/srcpkgs/vdrift/template
+++ b/srcpkgs/vdrift/template
@@ -1,7 +1,7 @@
 # Template file for 'vdrift'
 pkgname=vdrift
 version=2014.10.20
-revision=11
+revision=12
 build_style=scons
 scons_use_destdir=yes
 make_build_args="release=1 force_feedback=1 extbullet=1 datadir=share/${pkgname}"
@@ -16,7 +16,7 @@ license="GPL-3.0-or-later"
 homepage="http://vdrift.net/"
 distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version//./-}.tar.bz2"
 checksum=458d45d59075c2ce943ec6bc271a5bd0eb6bc6ed123670b65038703345020be3
-python_version=2
+python_version=3
 
 post_install() {
 	# install .desktop file
@@ -31,6 +31,9 @@ post_install() {
 	done
 	vinstall data/textures/icons/vdrift-64x64.png 644 \
 		usr/share/pixmaps vdrift.png
+
+	# remove unnecessary build system files
+	find "${DESTDIR}"/usr/share/vdrift -name '*SConscript*' -delete
 }
 
 vdrift-data_package() {

From 55fcfbe32ad41a25b51dcd54699d26ce5fe231d3 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 03:37:04 -0400
Subject: [PATCH 10/10] flightgear: patch for python3

---
 srcpkgs/flightgear/patches/python3.patch | 47 ++++++++++++++++++++++++
 srcpkgs/flightgear/template              |  4 +-
 2 files changed, 49 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/flightgear/patches/python3.patch

diff --git a/srcpkgs/flightgear/patches/python3.patch b/srcpkgs/flightgear/patches/python3.patch
new file mode 100644
index 0000000000000..39479c6d8be73
--- /dev/null
+++ b/srcpkgs/flightgear/patches/python3.patch
@@ -0,0 +1,47 @@
+--- a/fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/asi/asi.py
++++ b/fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/asi/asi.py
+@@ -87,5 +87,5 @@
+ 	#a.at(-45,-55).text(160, size = s, font_family = "Lucida Sans", color = "white")
+ 
+ except Error as e:
+-	print >>sys.stderr, "\033[31;1m%s\033[m\n" % e
++	print("\033[31;1m%s\033[m\n" % e, file=sys.stderr)
+ 
+--- a/fgdata/Docs/compile_docs.py
++++ b/fgdata/Docs/compile_docs.py
+@@ -27,7 +27,7 @@
+         '<': r'\textless',
+         '>': r'\textgreater',
+     }
+-    regex = re.compile('|'.join(re.escape(unicode(key)) for key in sorted(conv.keys(), key = lambda item: - len(item))))
++    regex = re.compile('|'.join(re.escape(str(key)) for key in sorted(list(conv.keys()), key = lambda item: - len(item))))
+     return regex.sub(lambda match: conv[match.group()], text)
+ 
+ def generate_airplane_latex(source):
+@@ -49,7 +49,7 @@
+ 
+     documentation_tex = open(os.path.join(root, source['dir'] + "_documentation.tex"), "w")
+     documentation_tex.write("\\documentclass{article}\n")
+-    documentation_tex.write("\\usepackage{hyperref}\n\usepackage{graphicx}\n"
++    documentation_tex.write("\\usepackage{hyperref}\n\\usepackage{graphicx}\n"
+             "\\usepackage{fancyhdr}\\pagestyle{fancy}\n\\lfoot{Intended for FlightGear}\\rfoot{Not for real world use!}")
+     documentation_tex.write("\\title{"+source['name']+" documentation}\n")
+     documentation_tex.write("\\author{FlightGear team}\n")
+@@ -95,7 +95,7 @@
+         chkl_root = tree.getroot()
+         for checklist in chkl_root:
+             if checklist.tag != "checklist":
+-                print "Unrecognised tag in", xmlfile
++                print("Unrecognised tag in", xmlfile)
+                 continue
+             title = checklist.find("title")
+             if title is None:
+@@ -213,7 +213,7 @@
+     # documentation
+     aircrafts = gather_aircraft_metadata("../Aircraft")
+     if(len(aircrafts) == 0 ):
+-        print "No aircraft found; wrong directory?"
++        print("No aircraft found; wrong directory?")
+     if(not os.path.isdir("procedures")):
+         os.mkdir("procedures")
+ 
diff --git a/srcpkgs/flightgear/template b/srcpkgs/flightgear/template
index 9715c576d4e6c..66abb79255be7 100644
--- a/srcpkgs/flightgear/template
+++ b/srcpkgs/flightgear/template
@@ -1,7 +1,7 @@
 # Template file for 'flightgear'
 pkgname=flightgear
 version=2020.3.17
-revision=2
+revision=3
 # XXX: always keep in sync with simgear version!
 create_wrksrc=yes
 build_style=cmake
@@ -26,7 +26,7 @@ distfiles="
  $SOURCEFORGE_SITE/project/flightgear/release-${version%.*}/FlightGear-${version}-data.txz"
 checksum="6670dedeaca2683aca77f9f06bf9d1d8062ae32a2a5459dddc8aa0989c5f1854
  2a5eba2b9ae67a3691285833a6ce3f6bbdf3f20229f5871d7c940e151d54d8e8"
-python_version=2
+python_version=3
 # the test suite doesn't get built, if enabled it segfaults
 make_check=no
 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR REVIEW] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
                   ` (4 preceding siblings ...)
  2023-10-08  7:37 ` classabbyamp
@ 2023-10-08 10:28 ` r-ricci
  2023-10-08 10:30 ` r-ricci
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: r-ricci @ 2023-10-08 10:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

New review comment by r-ricci on void-packages repository

https://github.com/void-linux/void-packages/pull/46515#discussion_r1349672909

Comment:
This patch is not necessary. Flightgear doesn't use python (either version 2 or 3) and IIRC works fine even if python is not installed at all on the system.
The fgdata subpackage includes both files required at runtime and files needed during development (splitting them is not very straightforward). This file is part of the latter group.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR REVIEW] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
                   ` (5 preceding siblings ...)
  2023-10-08 10:28 ` [PR REVIEW] " r-ricci
@ 2023-10-08 10:30 ` r-ricci
  2023-10-08 14:30 ` classabbyamp
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: r-ricci @ 2023-10-08 10:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

New review comment by r-ricci on void-packages repository

https://github.com/void-linux/void-packages/pull/46515#discussion_r1349672909

Comment:
This patch is not necessary. Flightgear doesn't use python (either version 2 or 3) and IIRC works fine even if python{2,3} is not installed at all on the system.
The fgdata subpackage includes both files required at runtime and files needed during development (splitting them is not very straightforward). This file is part of the latter group.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR REVIEW] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
                   ` (6 preceding siblings ...)
  2023-10-08 10:30 ` r-ricci
@ 2023-10-08 14:30 ` classabbyamp
  2023-10-08 19:56 ` [PR PATCH] [Updated] " classabbyamp
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-08 14:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

New review comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/46515#discussion_r1349705772

Comment:
then the patches scripts should be removed, because they are python 2 and that makes setting python_version=2 necessary (the thing I'm trying to get rid of) 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
                   ` (7 preceding siblings ...)
  2023-10-08 14:30 ` classabbyamp
@ 2023-10-08 19:56 ` classabbyamp
  2023-10-09 23:36 ` classabbyamp
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-08 19:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages py2
https://github.com/void-linux/void-packages/pull/46515

py2->3 fixes
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46515.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py2-46515.patch --]
[-- Type: text/x-diff, Size: 28146 bytes --]

From d6f9d04eda8f5220ae4f733c94a784a1ec5fcd57 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:38:21 -0400
Subject: [PATCH 01/10] 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 0000000000000..0a05b38556d66
--- /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 + '<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])
diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template
index 1ffb434669413..09d1301526530 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

From dffae39d70ee2c7be09ffff9d69a658402599ec0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:51:37 -0400
Subject: [PATCH 02/10] kcachegrind: patch for python3

---
 srcpkgs/kcachegrind/patches/python3.patch | 77 +++++++++++++++++++++++
 srcpkgs/kcachegrind/template              |  4 +-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kcachegrind/patches/python3.patch

diff --git a/srcpkgs/kcachegrind/patches/python3.patch b/srcpkgs/kcachegrind/patches/python3.patch
new file mode 100644
index 0000000000000..1d701ddf0321c
--- /dev/null
+++ b/srcpkgs/kcachegrind/patches/python3.patch
@@ -0,0 +1,77 @@
+--- a/converters/hotshot2calltree.in
++++ b/converters/hotshot2calltree.in
+@@ -147,8 +147,8 @@
+         if (file_limit > 0) and (filecount > file_limit):
+             break
+     
+-    print
+-    print "total_cost: % d Ticks",total_cost
++    print()
++    print("total_cost: % d Ticks",total_cost)
+     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
+ 
+ def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
+@@ -234,9 +234,9 @@
+             return_from_call(caller_stack, call_dict, total_cost)
+ 
+     except IOError:
+-        print "could not open inputfile '%s', ignore this." % inputfilename
+-    except EOFError, m:
+-        print "EOF: %s" % (m,)
++        print("could not open inputfile '%s', ignore this." % inputfilename)
++    except EOFError as m:
++        print("EOF: %s" % (m,))
+     return total_cost
+ 
+ def pretty_name(file, function):
+@@ -252,7 +252,7 @@
+         self.last_values = {}
+ 
+     def clearTag(self, tag):
+-        if self.last_values.has_key(tag):
++        if tag in self.last_values.keys():
+             del self.last_values[ tag ]
+     def clear(self):
+         self.last_values = {}
+@@ -316,16 +316,16 @@
+ def run_without_optparse():
+     """parse the options without optparse, use sys.argv"""
+     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
+-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
++        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
+         return
+     outputfilename = sys.argv[2]
+     try:
+-        output = file(outputfilename, "w")
++        output = open(outputfilename, "w")
+         args = sys.argv[3:]
+         convertProfFiles(output, args)
+         output.close()
+     except IOError:
+-        print "could not open '%s' for writing." % outputfilename
++        print("could not open '%s' for writing." % outputfilename)
+ 
+ def run_with_optparse():
+     """parse the options with optparse"""
+@@ -346,10 +346,10 @@
+     file_limit = int(options.file_limit)
+     try:
+         if options.outputfilename and options.outputfilename != "-":
+-            output = file(options.outputfilename, "w")
++            output = open(options.outputfilename, "w")
+             close_output = 1
+     except IOError:
+-        print "could not open '%s' for writing." % options.outputfilename
++        print("could not open '%s' for writing." % options.outputfilename)
+     if output:
+         convertProfFiles(output, args)
+         if close_output:
+@@ -364,7 +364,7 @@
+         prof.runcall(run)
+         prof.close()
+     else:
+-        print "not profiling myself, since '%s' exists, running normal" % filename
++        print("not profiling myself, since '%s' exists, running normal" % filename)
+         run()
+ 
+ # check if optparse is available.
diff --git a/srcpkgs/kcachegrind/template b/srcpkgs/kcachegrind/template
index 0d812ba71f46a..6c295a6f5bf07 100644
--- a/srcpkgs/kcachegrind/template
+++ b/srcpkgs/kcachegrind/template
@@ -1,7 +1,7 @@
 # Template file for 'kcachegrind'
 pkgname=kcachegrind
 version=23.08.0
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
  pkg-config qt5-host-tools qt5-qmake"
@@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
 changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
 distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
-python_version=2
+python_version=3

From 7879ca113da4f64a6709e37c6b14fb384c544f5f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 15:26:01 -0400
Subject: [PATCH 03/10] eclipse: works on python3

---
 srcpkgs/eclipse/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/eclipse/template b/srcpkgs/eclipse/template
index 4108117dabc67..f1b9064b58920 100644
--- a/srcpkgs/eclipse/template
+++ b/srcpkgs/eclipse/template
@@ -1,7 +1,7 @@
 # Template file for 'eclipse'
 pkgname=eclipse
 version=4.28
-revision=1
+revision=2
 #code name of version
 _release=2023-06
 archs="x86_64"
@@ -19,7 +19,7 @@ _edition=java
 _mirror="http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse"
 distfiles="${_mirror}/technology/epp/downloads/release/${_release}/${_patch}/eclipse-${_edition}-${_release}-R-linux-gtk-x86_64.tar.gz"
 checksum=142e33831fbbe52f53255a746b35a038dff0366a04cb4d3be2d8fe0ce76f34e8
-python_version=2
+python_version=3
 
 do_install() {
 	vmkdir usr/lib/eclipse

From ac7d8e537a534ca346090a23660e36d150e87777 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 16:58:44 -0400
Subject: [PATCH 04/10] libdbusmenu-glib: work on python3

---
 .../libdbusmenu-glib/patches/python3.patch    | 60 +++++++++++++++++++
 srcpkgs/libdbusmenu-glib/template             |  3 +-
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libdbusmenu-glib/patches/python3.patch

diff --git a/srcpkgs/libdbusmenu-glib/patches/python3.patch b/srcpkgs/libdbusmenu-glib/patches/python3.patch
new file mode 100644
index 0000000000000..830a19005be58
--- /dev/null
+++ b/srcpkgs/libdbusmenu-glib/patches/python3.patch
@@ -0,0 +1,60 @@
+--- a/tools/dbusmenu-bench
++++ b/tools/dbusmenu-bench
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -61,7 +61,7 @@
+ 
+ def dump_properties(properties, prepend=""):
+     for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++        print("%s- %s: %s" % (prepend, key, value))
+ 
+ 
+ def run_test_sequence(menu, dump=False):
+@@ -74,9 +74,9 @@
+     revision, layout = menu.GetLayout(dbus.Int32(0))
+     times["GetLayout"] = chrono.elapsed()
+     if dump:
+-        print "revision:", revision
+-        print "layout:"
+-        print layout
++        print("revision:", revision)
++        print("layout:")
++        print(layout)
+ 
+     # Get ids
+     tree = ET.fromstring(layout)
+@@ -89,17 +89,17 @@
+     children = menu.GetChildren(dbus.Int32(root_id), property_names)
+     times["GetChildren"] = chrono.elapsed()
+     if dump:
+-        print "children:"
++        print("children:")
+         for child in children:
+             id, properties = child
+-            print "- %d:" % id
++            print("- %d:" % id)
+             dump_properties(properties, prepend=" ")
+ 
+     chrono.restart()
+     properties = menu.GetProperties(dbus.Int32(child_id), property_names)
+     times["GetProperties"] = chrono.elapsed()
+     if dump:
+-        print "properties:"
++        print("properties:")
+         dump_properties(properties)
+ 
+     return times
+@@ -109,7 +109,7 @@
+ 
+ def print_probe(prefix, name, value, timestamp):
+     value = int(value * 1000000)
+-    print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
++    print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
+ 
+ def main():
+     parser = OptionParser(usage = "%prog [options]")
diff --git a/srcpkgs/libdbusmenu-glib/template b/srcpkgs/libdbusmenu-glib/template
index 8981401214cba..26c7d3f201f94 100644
--- a/srcpkgs/libdbusmenu-glib/template
+++ b/srcpkgs/libdbusmenu-glib/template
@@ -1,7 +1,7 @@
 # Template file for 'libdbusmenu-glib'
 pkgname=libdbusmenu-glib
 version=16.04.0
-revision=5
+revision=6
 build_style=gnu-configure
 build_helper="gir"
 configure_args="--disable-dumper --disable-static --disable-tests
@@ -15,7 +15,6 @@ license="GPL-3, LGPL-2.1, LGPL-3"
 homepage="https://launchpad.net/libdbusmenu"
 distfiles="${homepage}/${version%.*}/${version}/+download/libdbusmenu-${version}.tar.gz"
 checksum=b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
-python_version=2 #unverified
 
 build_options="gir"
 build_options_default="gir"

From 6ef1ab58a52abf40e232fdfdc5a03bfec9676a6e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 17:12:55 -0400
Subject: [PATCH 05/10] nitroshare: work on python3

---
 srcpkgs/nitroshare/patches/python3.patch | 13 +++++++++++++
 srcpkgs/nitroshare/template              |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nitroshare/patches/python3.patch

diff --git a/srcpkgs/nitroshare/patches/python3.patch b/srcpkgs/nitroshare/patches/python3.patch
new file mode 100644
index 0000000000000..f30aaaca3d5c4
--- /dev/null
+++ b/srcpkgs/nitroshare/patches/python3.patch
@@ -0,0 +1,13 @@
+--- a/src/dist/nitroshare.py.in
++++ b/src/dist/nitroshare.py.in
+@@ -27,8 +27,8 @@
+ 
+ from json import loads
+ from os import path
+-from urllib import url2pathname
+-from urlparse import urlparse
++from urllib.request import url2pathname
++from urllib.parse import urlparse
+ 
+ import gi
+ gi.require_version('Gtk', '3.0')
diff --git a/srcpkgs/nitroshare/template b/srcpkgs/nitroshare/template
index 50f1a6f62a91c..0850074b28cfd 100644
--- a/srcpkgs/nitroshare/template
+++ b/srcpkgs/nitroshare/template
@@ -1,7 +1,7 @@
 # Template file for 'nitroshare'
 pkgname=nitroshare
 version=0.3.4
-revision=1
+revision=2
 build_style=cmake
 pycompile_dirs="usr/share/nautilus-python/extensions
  usr/share/nemo-python/extensions
@@ -15,7 +15,7 @@ license="MIT"
 homepage="http://nitroshare.net"
 distfiles="https://github.com/nitroshare/nitroshare-desktop/archive/${version}.tar.gz"
 checksum=29874e5909c29211a3c9e13f8c0f49b901ec2996e5d60d80af80d2fb80c3d7ec
-python_version=2 #unverified
+python_version=3
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools"

From f08131992c8c64c7ef05069ca4ce32478d5ab685 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:49:23 -0400
Subject: [PATCH 06/10] tvheadend: compatible with python3

---
 srcpkgs/tvheadend/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tvheadend/template b/srcpkgs/tvheadend/template
index a2004480332b2..9aea7de4ec705 100644
--- a/srcpkgs/tvheadend/template
+++ b/srcpkgs/tvheadend/template
@@ -7,7 +7,7 @@ configure_args="--enable-dvbscan --disable-ffmpeg_static
 --disable-hdhomerun_static --disable-bintray_cache --disable-libx264_static
 --disable-libx265_static --disable-libvpx_static --disable-libtheora_static
 --disable-libvorbis_static --disable-libfdkaac_static"
-hostmakedepends="gettext pkg-config python git which"
+hostmakedepends="gettext pkg-config python3 git which"
 makedepends="avahi-libs-devel openssl-devel zlib-devel libcurl-devel ffmpeg-devel"
 short_desc="TV streaming server"
 maintainer="lemmi <lemmi@nerd2nerd.org>"

From 0c09a8010b2eeb8b76cd0376722ecb18e77891f6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:58:02 -0400
Subject: [PATCH 07/10] skktools: patch for python3

---
 srcpkgs/skktools/patches/python3.patch | 131 +++++++++++++++++++++++++
 srcpkgs/skktools/template              |   4 +-
 2 files changed, 133 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/skktools/patches/python3.patch

diff --git a/srcpkgs/skktools/patches/python3.patch b/srcpkgs/skktools/patches/python3.patch
new file mode 100644
index 0000000000000..efd52da4af257
--- /dev/null
+++ b/srcpkgs/skktools/patches/python3.patch
@@ -0,0 +1,131 @@
+--- a/skk2cdb.py
++++ b/skk2cdb.py
+@@ -16,11 +16,12 @@
+ import sys, os
+ from struct import pack, unpack
+ from array import array
++from functools import reduce
+ 
+ 
+ # calc hash value with a given key
+-def cdbhash(s, n=0L):
+-  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffffL, s, n+5381L)
++def cdbhash(s, n=0):
++  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffff, s, n+5381)
+ 
+ if pack('=i',1) == pack('>i',1):
+   # big endian
+@@ -62,9 +63,9 @@
+   
+   def __init__(self, cdbname, docache=1):
+     self.name = cdbname
+-    self._fp = file(cdbname, 'rb')
++    self._fp = open(cdbname, 'rb')
+     hash0 = decode(self._fp.read(2048))
+-    self._hash0 = [ (hash0[i], hash0[i+1]) for i in xrange(0, 512, 2) ]
++    self._hash0 = [ (hash0[i], hash0[i+1]) for i in range(0, 512, 2) ]
+     self._hash1 = [ None ] * 256
+     (self._eod,_) = self._hash0[0]
+     self._docache = docache
+@@ -93,7 +94,7 @@
+       self._hash1[h1] = hs
+     i = ((h >> 8) % ncells) * 2
+     n = ncells*2
+-    for _ in xrange(ncells):
++    for _ in range(ncells):
+       p1 = hs[i+1]
+       if p1 == 0: raise KeyError(k)
+       if hs[i] == h:
+@@ -122,7 +123,7 @@
+       return False
+ 
+   def __contains__(self, k):
+-    return self.has_key(k)
++    return k in self
+ 
+   def firstkey(self):
+     self._keyiter = None
+@@ -132,7 +133,7 @@
+     if not self._keyiter:
+       self._keyiter = ( k for (k,v) in cdbiter(self._fp, self._eod) )
+     try:
+-      return self._keyiter.next()
++      return next(self._keyiter)
+     except StopIteration:
+       return None
+ 
+@@ -140,7 +141,7 @@
+     if not self._eachiter:
+       self._eachiter = cdbiter(self._fp, self._eod)
+     try:
+-      return self._eachiter.next()
++      return next(self._eachiter)
+     except StopIteration:
+       return None
+   
+@@ -159,9 +160,9 @@
+     self.fn = cdbname
+     self.fntmp = tmpname
+     self.numentries = 0
+-    self._fp = file(tmpname, 'wb')
++    self._fp = open(tmpname, 'wb')
+     self._pos = 2048                    # sizeof((h,p))*256
+-    self._bucket = [ array('I') for _ in xrange(256) ]
++    self._bucket = [ array('I') for _ in range(256) ]
+     return
+ 
+   def __len__(self):
+@@ -197,7 +198,7 @@
+       if not b1: continue
+       blen = len(b1)
+       a = array('I', [0]*blen*2)
+-      for j in xrange(0, blen, 2):
++      for j in range(0, blen, 2):
+         (h,p) = (b1[j],b1[j+1])
+         i = ((h >> 8) % blen)*2
+         while a[i+1]:             # is cell[i] already occupied?
+@@ -238,7 +239,7 @@
+ 
+ # cdbdump
+ def cdbdump(cdbname):
+-  fp = file(cdbname, 'rb')
++  fp = open(cdbname, 'rb')
+   (eor,) = unpack('<I', fp.read(4))
+   return cdbiter(fp, eor)
+ 
+@@ -248,7 +249,7 @@
+   q = []
+   for it in iters:
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       pass
+   k0 = None
+@@ -262,7 +263,7 @@
+     vs.append(v)
+     k0 = k
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       continue
+   if vs: yield (k0,vs)
+@@ -280,7 +281,7 @@
+   import fileinput
+   import os.path
+   def usage():
+-    print 'usage: %s [-f] outfile [infile ...]' % argv[0]
++    print('usage: %s [-f] outfile [infile ...]' % argv[0])
+     return 100
+   try:
+     (opts, args) = getopt.getopt(argv[1:], 'dfo:')
+@@ -292,7 +293,7 @@
+   if not args: return usage()
+   outfile = args.pop(0)
+   if not force and os.path.exists(outfile):
+-    print >>sys.stderr, 'file exists: %r' % outfile
++    print('file exists: %r' % outfile, file=sys.stderr)
+     return 1
+   #
+   maker = CDBMaker(outfile, outfile+'.tmp')
diff --git a/srcpkgs/skktools/template b/srcpkgs/skktools/template
index 4c1ddda99c00e..3cfa8fe3168c5 100644
--- a/srcpkgs/skktools/template
+++ b/srcpkgs/skktools/template
@@ -1,7 +1,7 @@
 # Template file for 'skktools'
 pkgname=skktools
 version=1.3.4
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-gdbm"
 hostmakedepends="pkg-config glib-devel"
@@ -12,7 +12,7 @@ license="GPL-2.0-or-later"
 homepage="http://openlab.ring.gr.jp/skk/"
 distfiles="http://openlab.ring.gr.jp/skk/tools/${pkgname}-${version}.tar.gz"
 checksum=84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168
-python_version=2 #unverified
+python_version=3
 
 post_install() {
 	vmkdir usr/share/${pkgname}

From ea71613db67d29d922ded4efa04a9a9ad43d7d0a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:03:37 -0400
Subject: [PATCH 08/10] tacacs: convert script to python3

---
 srcpkgs/tacacs/patches/python3.patch | 98 ++++++++++++++++++++++++++++
 srcpkgs/tacacs/template              |  6 +-
 2 files changed, 101 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/tacacs/patches/python3.patch

diff --git a/srcpkgs/tacacs/patches/python3.patch b/srcpkgs/tacacs/patches/python3.patch
new file mode 100644
index 0000000000000..c8183d69a8b3e
--- /dev/null
+++ b/srcpkgs/tacacs/patches/python3.patch
@@ -0,0 +1,98 @@
+--- a/do_auth.py
++++ b/do_auth.py
+@@ -211,7 +211,7 @@
+ Written by Dan Schmidt - Please visit tacacs.org to check for updates.
+ '''
+ 
+-import sys,re,getopt,ConfigParser
++import sys,re,getopt,configparser
+ from time import strftime
+ 
+ # I really don't want to deal with these exceptions more than once
+@@ -230,23 +230,23 @@
+     #Should not have any exceptions - BUT, just in case
+     try:
+         attributes = config.get(the_section, the_option)
+-    except ConfigParser.NoSectionError:
++    except configparser.NoSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Section '%s' Doesn't Exist!\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.DuplicateSectionError:
++    except configparser.DuplicateSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Duplicate section '%s'\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.NoOptionError:
++    except configparser.NoOptionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                     + "Error: '%s' not found in section '%s\n'" 
+                      % (the_option, the_section))
+         sys.exit(1)
+     #To do: finish exceptions. 
+-    except ConfigParser.ParsingError:
++    except configparser.ParsingError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't parse file '%s'! (You got me)\n" 
+              % (filename))
+@@ -298,9 +298,9 @@
+     argv = sys.argv
+     try:
+         optlist, args = getopt.getopt(sys.argv[1:], 'i:u:f:l:d:?:D', ['fix_crs_bug','?', '-?', 'help', 'Help'])
+-    except getopt.GetoptError, err:
+-        print str(err) 
+-        print __doc__
++    except getopt.GetoptError as err:
++        print(str(err)) 
++        print(__doc__)
+         sys.exit(1)
+     for (i, j) in optlist:
+         if i == '-i':
+@@ -314,15 +314,15 @@
+         elif i == '-d':
+             device = j
+         elif i in ('?', '-?', 'help', 'Help'):
+-            print __doc__
++            print(__doc__)
+             sys.exit(1)
+         elif i == '-D':
+             is_debug = True
+         else:
+-            print 'Unknown option:', i
++            print('Unknown option:', i)
+             sys.exit(1)
+     if len(argv) < 7:
+-        print __doc__
++        print(__doc__)
+         sys.exit(1)
+     log_file = open (log_name, "a")
+ #DEBUG!  We at least got CALLED
+@@ -384,7 +384,7 @@
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: No username entered!\n")
+         sys.exit(1)
+-    config = ConfigParser.SafeConfigParser()
++    config = configparser.SafeConfigParser()
+     if not (filename in config.read(filename)):
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't open/parse '%s'\n" 
+@@ -491,7 +491,7 @@
+                     for item in return_pairs:
+                         #DEBUG
+                         # log_file.write("Returning:%s\n" % item.strip())
+-                        print item.strip('\n')
++                        print(item.strip('\n'))
+                     if want_tac_pairs:
+                         #DEBUG
+                         # log_file.write("Exiting status 2\n")
+@@ -507,7 +507,7 @@
+             for item in return_pairs:
+                 #DEBUG
+                 # log_file.write("Returning:%s\n" % item.strip())
+-                print item.strip('\n')
++                print(item.strip('\n'))
+             log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                  + "User '%s' granted access to device '%s' in group '%s' from '%s'\n"
+                  % (user_name, device, this_group, ip_addr))
diff --git a/srcpkgs/tacacs/template b/srcpkgs/tacacs/template
index 1cb4f17935297..179fc1fa161ee 100644
--- a/srcpkgs/tacacs/template
+++ b/srcpkgs/tacacs/template
@@ -1,7 +1,7 @@
 # Template file for 'tacacs'
 pkgname=tacacs
 version=4.0.4.28
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--with-libwrap=no"
 hostmakedepends="flex perl"
@@ -10,9 +10,9 @@ short_desc="Modified version of Cisco's tacacs+ (tac_plus) developer's kit"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="custom:Cisco"
 homepage="http://www.shrubbery.net/tac_plus/"
-distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/$pkgname-F$version.tar.gz"
+distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/tacacs-F$version.tar.gz"
 checksum=147f2dc98d26d2f93f0aba76c988ced196ffe1c001dc2e91f788a1a2c747219e
-python_version=2
+python_version=3
 disable_parallel_build=yes
 
 pre_configure() {

From df14b3aa0b9d413d8a8573bca006fb6ee89f541a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:43:33 -0400
Subject: [PATCH 09/10] vdrift: remove sconscript files

---
 srcpkgs/vdrift/template | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/vdrift/template b/srcpkgs/vdrift/template
index 643cb08847d19..90b702affecbc 100644
--- a/srcpkgs/vdrift/template
+++ b/srcpkgs/vdrift/template
@@ -1,7 +1,7 @@
 # Template file for 'vdrift'
 pkgname=vdrift
 version=2014.10.20
-revision=11
+revision=12
 build_style=scons
 scons_use_destdir=yes
 make_build_args="release=1 force_feedback=1 extbullet=1 datadir=share/${pkgname}"
@@ -16,7 +16,7 @@ license="GPL-3.0-or-later"
 homepage="http://vdrift.net/"
 distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version//./-}.tar.bz2"
 checksum=458d45d59075c2ce943ec6bc271a5bd0eb6bc6ed123670b65038703345020be3
-python_version=2
+python_version=3
 
 post_install() {
 	# install .desktop file
@@ -31,6 +31,9 @@ post_install() {
 	done
 	vinstall data/textures/icons/vdrift-64x64.png 644 \
 		usr/share/pixmaps vdrift.png
+
+	# remove unnecessary build system files
+	find "${DESTDIR}"/usr/share/vdrift -name '*SConscript*' -delete
 }
 
 vdrift-data_package() {

From 01000b05df69985c187cd1019e5b23dde9c8e9dd Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 03:37:04 -0400
Subject: [PATCH 10/10] flightgear: patch for python3

---
 srcpkgs/flightgear/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/flightgear/template b/srcpkgs/flightgear/template
index 9715c576d4e6c..6f4f9ffdfb75b 100644
--- a/srcpkgs/flightgear/template
+++ b/srcpkgs/flightgear/template
@@ -1,7 +1,7 @@
 # Template file for 'flightgear'
 pkgname=flightgear
 version=2020.3.17
-revision=2
+revision=3
 # XXX: always keep in sync with simgear version!
 create_wrksrc=yes
 build_style=cmake
@@ -26,7 +26,6 @@ distfiles="
  $SOURCEFORGE_SITE/project/flightgear/release-${version%.*}/FlightGear-${version}-data.txz"
 checksum="6670dedeaca2683aca77f9f06bf9d1d8062ae32a2a5459dddc8aa0989c5f1854
  2a5eba2b9ae67a3691285833a6ce3f6bbdf3f20229f5871d7c940e151d54d8e8"
-python_version=2
 # the test suite doesn't get built, if enabled it segfaults
 make_check=no
 
@@ -48,5 +47,8 @@ flightgear-data_package() {
 	pkg_install() {
 		vmkdir usr/share/flightgear
 		mv fgdata ${PKGDESTDIR}/usr/share/flightgear
+		# python 2 build scripts
+		rm "${PKGDESTDIR}"/usr/share/flightgear/fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/asi/asi.py \
+			"${PKGDESTDIR}"/usr/share/flightgear/fgdata/Docs/compile_docs.py
 	}
 }

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
                   ` (8 preceding siblings ...)
  2023-10-08 19:56 ` [PR PATCH] [Updated] " classabbyamp
@ 2023-10-09 23:36 ` classabbyamp
  2023-10-10  1:39 ` classabbyamp
  2023-10-10  1:41 ` [PR PATCH] [Merged]: " classabbyamp
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-09 23:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages py2
https://github.com/void-linux/void-packages/pull/46515

py2->3 fixes
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46515.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py2-46515.patch --]
[-- Type: text/x-diff, Size: 28146 bytes --]

From 4f5176021b8b464c773a1b597d1b15c7e4d1c8a6 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:38:21 -0400
Subject: [PATCH 01/10] 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 0000000000000..0a05b38556d66
--- /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 + '<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])
diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template
index 1ffb434669413..09d1301526530 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

From 18989597cc92c6a68eaf6ca20dccf26305a42865 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:51:37 -0400
Subject: [PATCH 02/10] kcachegrind: patch for python3

---
 srcpkgs/kcachegrind/patches/python3.patch | 77 +++++++++++++++++++++++
 srcpkgs/kcachegrind/template              |  4 +-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kcachegrind/patches/python3.patch

diff --git a/srcpkgs/kcachegrind/patches/python3.patch b/srcpkgs/kcachegrind/patches/python3.patch
new file mode 100644
index 0000000000000..1d701ddf0321c
--- /dev/null
+++ b/srcpkgs/kcachegrind/patches/python3.patch
@@ -0,0 +1,77 @@
+--- a/converters/hotshot2calltree.in
++++ b/converters/hotshot2calltree.in
+@@ -147,8 +147,8 @@
+         if (file_limit > 0) and (filecount > file_limit):
+             break
+     
+-    print
+-    print "total_cost: % d Ticks",total_cost
++    print()
++    print("total_cost: % d Ticks",total_cost)
+     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
+ 
+ def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
+@@ -234,9 +234,9 @@
+             return_from_call(caller_stack, call_dict, total_cost)
+ 
+     except IOError:
+-        print "could not open inputfile '%s', ignore this." % inputfilename
+-    except EOFError, m:
+-        print "EOF: %s" % (m,)
++        print("could not open inputfile '%s', ignore this." % inputfilename)
++    except EOFError as m:
++        print("EOF: %s" % (m,))
+     return total_cost
+ 
+ def pretty_name(file, function):
+@@ -252,7 +252,7 @@
+         self.last_values = {}
+ 
+     def clearTag(self, tag):
+-        if self.last_values.has_key(tag):
++        if tag in self.last_values.keys():
+             del self.last_values[ tag ]
+     def clear(self):
+         self.last_values = {}
+@@ -316,16 +316,16 @@
+ def run_without_optparse():
+     """parse the options without optparse, use sys.argv"""
+     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
+-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
++        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
+         return
+     outputfilename = sys.argv[2]
+     try:
+-        output = file(outputfilename, "w")
++        output = open(outputfilename, "w")
+         args = sys.argv[3:]
+         convertProfFiles(output, args)
+         output.close()
+     except IOError:
+-        print "could not open '%s' for writing." % outputfilename
++        print("could not open '%s' for writing." % outputfilename)
+ 
+ def run_with_optparse():
+     """parse the options with optparse"""
+@@ -346,10 +346,10 @@
+     file_limit = int(options.file_limit)
+     try:
+         if options.outputfilename and options.outputfilename != "-":
+-            output = file(options.outputfilename, "w")
++            output = open(options.outputfilename, "w")
+             close_output = 1
+     except IOError:
+-        print "could not open '%s' for writing." % options.outputfilename
++        print("could not open '%s' for writing." % options.outputfilename)
+     if output:
+         convertProfFiles(output, args)
+         if close_output:
+@@ -364,7 +364,7 @@
+         prof.runcall(run)
+         prof.close()
+     else:
+-        print "not profiling myself, since '%s' exists, running normal" % filename
++        print("not profiling myself, since '%s' exists, running normal" % filename)
+         run()
+ 
+ # check if optparse is available.
diff --git a/srcpkgs/kcachegrind/template b/srcpkgs/kcachegrind/template
index 0d812ba71f46a..6c295a6f5bf07 100644
--- a/srcpkgs/kcachegrind/template
+++ b/srcpkgs/kcachegrind/template
@@ -1,7 +1,7 @@
 # Template file for 'kcachegrind'
 pkgname=kcachegrind
 version=23.08.0
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
  pkg-config qt5-host-tools qt5-qmake"
@@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
 changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
 distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
-python_version=2
+python_version=3

From 4814ee7adfa54410058661c56d59b1570271c8be Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 15:26:01 -0400
Subject: [PATCH 03/10] eclipse: works on python3

---
 srcpkgs/eclipse/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/eclipse/template b/srcpkgs/eclipse/template
index 4108117dabc67..f1b9064b58920 100644
--- a/srcpkgs/eclipse/template
+++ b/srcpkgs/eclipse/template
@@ -1,7 +1,7 @@
 # Template file for 'eclipse'
 pkgname=eclipse
 version=4.28
-revision=1
+revision=2
 #code name of version
 _release=2023-06
 archs="x86_64"
@@ -19,7 +19,7 @@ _edition=java
 _mirror="http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse"
 distfiles="${_mirror}/technology/epp/downloads/release/${_release}/${_patch}/eclipse-${_edition}-${_release}-R-linux-gtk-x86_64.tar.gz"
 checksum=142e33831fbbe52f53255a746b35a038dff0366a04cb4d3be2d8fe0ce76f34e8
-python_version=2
+python_version=3
 
 do_install() {
 	vmkdir usr/lib/eclipse

From 9cbf386ed2b67e8d01da487b9279dc6dfe2d6a14 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 16:58:44 -0400
Subject: [PATCH 04/10] libdbusmenu-glib: work on python3

---
 .../libdbusmenu-glib/patches/python3.patch    | 60 +++++++++++++++++++
 srcpkgs/libdbusmenu-glib/template             |  3 +-
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libdbusmenu-glib/patches/python3.patch

diff --git a/srcpkgs/libdbusmenu-glib/patches/python3.patch b/srcpkgs/libdbusmenu-glib/patches/python3.patch
new file mode 100644
index 0000000000000..830a19005be58
--- /dev/null
+++ b/srcpkgs/libdbusmenu-glib/patches/python3.patch
@@ -0,0 +1,60 @@
+--- a/tools/dbusmenu-bench
++++ b/tools/dbusmenu-bench
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -61,7 +61,7 @@
+ 
+ def dump_properties(properties, prepend=""):
+     for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++        print("%s- %s: %s" % (prepend, key, value))
+ 
+ 
+ def run_test_sequence(menu, dump=False):
+@@ -74,9 +74,9 @@
+     revision, layout = menu.GetLayout(dbus.Int32(0))
+     times["GetLayout"] = chrono.elapsed()
+     if dump:
+-        print "revision:", revision
+-        print "layout:"
+-        print layout
++        print("revision:", revision)
++        print("layout:")
++        print(layout)
+ 
+     # Get ids
+     tree = ET.fromstring(layout)
+@@ -89,17 +89,17 @@
+     children = menu.GetChildren(dbus.Int32(root_id), property_names)
+     times["GetChildren"] = chrono.elapsed()
+     if dump:
+-        print "children:"
++        print("children:")
+         for child in children:
+             id, properties = child
+-            print "- %d:" % id
++            print("- %d:" % id)
+             dump_properties(properties, prepend=" ")
+ 
+     chrono.restart()
+     properties = menu.GetProperties(dbus.Int32(child_id), property_names)
+     times["GetProperties"] = chrono.elapsed()
+     if dump:
+-        print "properties:"
++        print("properties:")
+         dump_properties(properties)
+ 
+     return times
+@@ -109,7 +109,7 @@
+ 
+ def print_probe(prefix, name, value, timestamp):
+     value = int(value * 1000000)
+-    print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
++    print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
+ 
+ def main():
+     parser = OptionParser(usage = "%prog [options]")
diff --git a/srcpkgs/libdbusmenu-glib/template b/srcpkgs/libdbusmenu-glib/template
index 8981401214cba..26c7d3f201f94 100644
--- a/srcpkgs/libdbusmenu-glib/template
+++ b/srcpkgs/libdbusmenu-glib/template
@@ -1,7 +1,7 @@
 # Template file for 'libdbusmenu-glib'
 pkgname=libdbusmenu-glib
 version=16.04.0
-revision=5
+revision=6
 build_style=gnu-configure
 build_helper="gir"
 configure_args="--disable-dumper --disable-static --disable-tests
@@ -15,7 +15,6 @@ license="GPL-3, LGPL-2.1, LGPL-3"
 homepage="https://launchpad.net/libdbusmenu"
 distfiles="${homepage}/${version%.*}/${version}/+download/libdbusmenu-${version}.tar.gz"
 checksum=b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
-python_version=2 #unverified
 
 build_options="gir"
 build_options_default="gir"

From cb322df764eb8a2f1e88f373a7d229df359d0a5e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 17:12:55 -0400
Subject: [PATCH 05/10] nitroshare: work on python3

---
 srcpkgs/nitroshare/patches/python3.patch | 13 +++++++++++++
 srcpkgs/nitroshare/template              |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nitroshare/patches/python3.patch

diff --git a/srcpkgs/nitroshare/patches/python3.patch b/srcpkgs/nitroshare/patches/python3.patch
new file mode 100644
index 0000000000000..f30aaaca3d5c4
--- /dev/null
+++ b/srcpkgs/nitroshare/patches/python3.patch
@@ -0,0 +1,13 @@
+--- a/src/dist/nitroshare.py.in
++++ b/src/dist/nitroshare.py.in
+@@ -27,8 +27,8 @@
+ 
+ from json import loads
+ from os import path
+-from urllib import url2pathname
+-from urlparse import urlparse
++from urllib.request import url2pathname
++from urllib.parse import urlparse
+ 
+ import gi
+ gi.require_version('Gtk', '3.0')
diff --git a/srcpkgs/nitroshare/template b/srcpkgs/nitroshare/template
index 50f1a6f62a91c..0850074b28cfd 100644
--- a/srcpkgs/nitroshare/template
+++ b/srcpkgs/nitroshare/template
@@ -1,7 +1,7 @@
 # Template file for 'nitroshare'
 pkgname=nitroshare
 version=0.3.4
-revision=1
+revision=2
 build_style=cmake
 pycompile_dirs="usr/share/nautilus-python/extensions
  usr/share/nemo-python/extensions
@@ -15,7 +15,7 @@ license="MIT"
 homepage="http://nitroshare.net"
 distfiles="https://github.com/nitroshare/nitroshare-desktop/archive/${version}.tar.gz"
 checksum=29874e5909c29211a3c9e13f8c0f49b901ec2996e5d60d80af80d2fb80c3d7ec
-python_version=2 #unverified
+python_version=3
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools"

From db3385604c9b2d51166ee70774b4a8816316d63e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:49:23 -0400
Subject: [PATCH 06/10] tvheadend: compatible with python3

---
 srcpkgs/tvheadend/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tvheadend/template b/srcpkgs/tvheadend/template
index a2004480332b2..9aea7de4ec705 100644
--- a/srcpkgs/tvheadend/template
+++ b/srcpkgs/tvheadend/template
@@ -7,7 +7,7 @@ configure_args="--enable-dvbscan --disable-ffmpeg_static
 --disable-hdhomerun_static --disable-bintray_cache --disable-libx264_static
 --disable-libx265_static --disable-libvpx_static --disable-libtheora_static
 --disable-libvorbis_static --disable-libfdkaac_static"
-hostmakedepends="gettext pkg-config python git which"
+hostmakedepends="gettext pkg-config python3 git which"
 makedepends="avahi-libs-devel openssl-devel zlib-devel libcurl-devel ffmpeg-devel"
 short_desc="TV streaming server"
 maintainer="lemmi <lemmi@nerd2nerd.org>"

From 77bb258370b36cf30d59a97e6a012d44c306379d Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:58:02 -0400
Subject: [PATCH 07/10] skktools: patch for python3

---
 srcpkgs/skktools/patches/python3.patch | 131 +++++++++++++++++++++++++
 srcpkgs/skktools/template              |   4 +-
 2 files changed, 133 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/skktools/patches/python3.patch

diff --git a/srcpkgs/skktools/patches/python3.patch b/srcpkgs/skktools/patches/python3.patch
new file mode 100644
index 0000000000000..efd52da4af257
--- /dev/null
+++ b/srcpkgs/skktools/patches/python3.patch
@@ -0,0 +1,131 @@
+--- a/skk2cdb.py
++++ b/skk2cdb.py
+@@ -16,11 +16,12 @@
+ import sys, os
+ from struct import pack, unpack
+ from array import array
++from functools import reduce
+ 
+ 
+ # calc hash value with a given key
+-def cdbhash(s, n=0L):
+-  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffffL, s, n+5381L)
++def cdbhash(s, n=0):
++  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffff, s, n+5381)
+ 
+ if pack('=i',1) == pack('>i',1):
+   # big endian
+@@ -62,9 +63,9 @@
+   
+   def __init__(self, cdbname, docache=1):
+     self.name = cdbname
+-    self._fp = file(cdbname, 'rb')
++    self._fp = open(cdbname, 'rb')
+     hash0 = decode(self._fp.read(2048))
+-    self._hash0 = [ (hash0[i], hash0[i+1]) for i in xrange(0, 512, 2) ]
++    self._hash0 = [ (hash0[i], hash0[i+1]) for i in range(0, 512, 2) ]
+     self._hash1 = [ None ] * 256
+     (self._eod,_) = self._hash0[0]
+     self._docache = docache
+@@ -93,7 +94,7 @@
+       self._hash1[h1] = hs
+     i = ((h >> 8) % ncells) * 2
+     n = ncells*2
+-    for _ in xrange(ncells):
++    for _ in range(ncells):
+       p1 = hs[i+1]
+       if p1 == 0: raise KeyError(k)
+       if hs[i] == h:
+@@ -122,7 +123,7 @@
+       return False
+ 
+   def __contains__(self, k):
+-    return self.has_key(k)
++    return k in self
+ 
+   def firstkey(self):
+     self._keyiter = None
+@@ -132,7 +133,7 @@
+     if not self._keyiter:
+       self._keyiter = ( k for (k,v) in cdbiter(self._fp, self._eod) )
+     try:
+-      return self._keyiter.next()
++      return next(self._keyiter)
+     except StopIteration:
+       return None
+ 
+@@ -140,7 +141,7 @@
+     if not self._eachiter:
+       self._eachiter = cdbiter(self._fp, self._eod)
+     try:
+-      return self._eachiter.next()
++      return next(self._eachiter)
+     except StopIteration:
+       return None
+   
+@@ -159,9 +160,9 @@
+     self.fn = cdbname
+     self.fntmp = tmpname
+     self.numentries = 0
+-    self._fp = file(tmpname, 'wb')
++    self._fp = open(tmpname, 'wb')
+     self._pos = 2048                    # sizeof((h,p))*256
+-    self._bucket = [ array('I') for _ in xrange(256) ]
++    self._bucket = [ array('I') for _ in range(256) ]
+     return
+ 
+   def __len__(self):
+@@ -197,7 +198,7 @@
+       if not b1: continue
+       blen = len(b1)
+       a = array('I', [0]*blen*2)
+-      for j in xrange(0, blen, 2):
++      for j in range(0, blen, 2):
+         (h,p) = (b1[j],b1[j+1])
+         i = ((h >> 8) % blen)*2
+         while a[i+1]:             # is cell[i] already occupied?
+@@ -238,7 +239,7 @@
+ 
+ # cdbdump
+ def cdbdump(cdbname):
+-  fp = file(cdbname, 'rb')
++  fp = open(cdbname, 'rb')
+   (eor,) = unpack('<I', fp.read(4))
+   return cdbiter(fp, eor)
+ 
+@@ -248,7 +249,7 @@
+   q = []
+   for it in iters:
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       pass
+   k0 = None
+@@ -262,7 +263,7 @@
+     vs.append(v)
+     k0 = k
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       continue
+   if vs: yield (k0,vs)
+@@ -280,7 +281,7 @@
+   import fileinput
+   import os.path
+   def usage():
+-    print 'usage: %s [-f] outfile [infile ...]' % argv[0]
++    print('usage: %s [-f] outfile [infile ...]' % argv[0])
+     return 100
+   try:
+     (opts, args) = getopt.getopt(argv[1:], 'dfo:')
+@@ -292,7 +293,7 @@
+   if not args: return usage()
+   outfile = args.pop(0)
+   if not force and os.path.exists(outfile):
+-    print >>sys.stderr, 'file exists: %r' % outfile
++    print('file exists: %r' % outfile, file=sys.stderr)
+     return 1
+   #
+   maker = CDBMaker(outfile, outfile+'.tmp')
diff --git a/srcpkgs/skktools/template b/srcpkgs/skktools/template
index 4c1ddda99c00e..3cfa8fe3168c5 100644
--- a/srcpkgs/skktools/template
+++ b/srcpkgs/skktools/template
@@ -1,7 +1,7 @@
 # Template file for 'skktools'
 pkgname=skktools
 version=1.3.4
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-gdbm"
 hostmakedepends="pkg-config glib-devel"
@@ -12,7 +12,7 @@ license="GPL-2.0-or-later"
 homepage="http://openlab.ring.gr.jp/skk/"
 distfiles="http://openlab.ring.gr.jp/skk/tools/${pkgname}-${version}.tar.gz"
 checksum=84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168
-python_version=2 #unverified
+python_version=3
 
 post_install() {
 	vmkdir usr/share/${pkgname}

From a04191c68535495cb510fe078cf4e4ca2441624a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:03:37 -0400
Subject: [PATCH 08/10] tacacs: convert script to python3

---
 srcpkgs/tacacs/patches/python3.patch | 98 ++++++++++++++++++++++++++++
 srcpkgs/tacacs/template              |  6 +-
 2 files changed, 101 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/tacacs/patches/python3.patch

diff --git a/srcpkgs/tacacs/patches/python3.patch b/srcpkgs/tacacs/patches/python3.patch
new file mode 100644
index 0000000000000..c8183d69a8b3e
--- /dev/null
+++ b/srcpkgs/tacacs/patches/python3.patch
@@ -0,0 +1,98 @@
+--- a/do_auth.py
++++ b/do_auth.py
+@@ -211,7 +211,7 @@
+ Written by Dan Schmidt - Please visit tacacs.org to check for updates.
+ '''
+ 
+-import sys,re,getopt,ConfigParser
++import sys,re,getopt,configparser
+ from time import strftime
+ 
+ # I really don't want to deal with these exceptions more than once
+@@ -230,23 +230,23 @@
+     #Should not have any exceptions - BUT, just in case
+     try:
+         attributes = config.get(the_section, the_option)
+-    except ConfigParser.NoSectionError:
++    except configparser.NoSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Section '%s' Doesn't Exist!\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.DuplicateSectionError:
++    except configparser.DuplicateSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Duplicate section '%s'\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.NoOptionError:
++    except configparser.NoOptionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                     + "Error: '%s' not found in section '%s\n'" 
+                      % (the_option, the_section))
+         sys.exit(1)
+     #To do: finish exceptions. 
+-    except ConfigParser.ParsingError:
++    except configparser.ParsingError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't parse file '%s'! (You got me)\n" 
+              % (filename))
+@@ -298,9 +298,9 @@
+     argv = sys.argv
+     try:
+         optlist, args = getopt.getopt(sys.argv[1:], 'i:u:f:l:d:?:D', ['fix_crs_bug','?', '-?', 'help', 'Help'])
+-    except getopt.GetoptError, err:
+-        print str(err) 
+-        print __doc__
++    except getopt.GetoptError as err:
++        print(str(err)) 
++        print(__doc__)
+         sys.exit(1)
+     for (i, j) in optlist:
+         if i == '-i':
+@@ -314,15 +314,15 @@
+         elif i == '-d':
+             device = j
+         elif i in ('?', '-?', 'help', 'Help'):
+-            print __doc__
++            print(__doc__)
+             sys.exit(1)
+         elif i == '-D':
+             is_debug = True
+         else:
+-            print 'Unknown option:', i
++            print('Unknown option:', i)
+             sys.exit(1)
+     if len(argv) < 7:
+-        print __doc__
++        print(__doc__)
+         sys.exit(1)
+     log_file = open (log_name, "a")
+ #DEBUG!  We at least got CALLED
+@@ -384,7 +384,7 @@
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: No username entered!\n")
+         sys.exit(1)
+-    config = ConfigParser.SafeConfigParser()
++    config = configparser.SafeConfigParser()
+     if not (filename in config.read(filename)):
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't open/parse '%s'\n" 
+@@ -491,7 +491,7 @@
+                     for item in return_pairs:
+                         #DEBUG
+                         # log_file.write("Returning:%s\n" % item.strip())
+-                        print item.strip('\n')
++                        print(item.strip('\n'))
+                     if want_tac_pairs:
+                         #DEBUG
+                         # log_file.write("Exiting status 2\n")
+@@ -507,7 +507,7 @@
+             for item in return_pairs:
+                 #DEBUG
+                 # log_file.write("Returning:%s\n" % item.strip())
+-                print item.strip('\n')
++                print(item.strip('\n'))
+             log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                  + "User '%s' granted access to device '%s' in group '%s' from '%s'\n"
+                  % (user_name, device, this_group, ip_addr))
diff --git a/srcpkgs/tacacs/template b/srcpkgs/tacacs/template
index 1cb4f17935297..179fc1fa161ee 100644
--- a/srcpkgs/tacacs/template
+++ b/srcpkgs/tacacs/template
@@ -1,7 +1,7 @@
 # Template file for 'tacacs'
 pkgname=tacacs
 version=4.0.4.28
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--with-libwrap=no"
 hostmakedepends="flex perl"
@@ -10,9 +10,9 @@ short_desc="Modified version of Cisco's tacacs+ (tac_plus) developer's kit"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="custom:Cisco"
 homepage="http://www.shrubbery.net/tac_plus/"
-distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/$pkgname-F$version.tar.gz"
+distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/tacacs-F$version.tar.gz"
 checksum=147f2dc98d26d2f93f0aba76c988ced196ffe1c001dc2e91f788a1a2c747219e
-python_version=2
+python_version=3
 disable_parallel_build=yes
 
 pre_configure() {

From 38daeb0c63179d1b712bc322ebb8a2ca049c9e03 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:43:33 -0400
Subject: [PATCH 09/10] vdrift: remove sconscript files

---
 srcpkgs/vdrift/template | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/vdrift/template b/srcpkgs/vdrift/template
index 643cb08847d19..90b702affecbc 100644
--- a/srcpkgs/vdrift/template
+++ b/srcpkgs/vdrift/template
@@ -1,7 +1,7 @@
 # Template file for 'vdrift'
 pkgname=vdrift
 version=2014.10.20
-revision=11
+revision=12
 build_style=scons
 scons_use_destdir=yes
 make_build_args="release=1 force_feedback=1 extbullet=1 datadir=share/${pkgname}"
@@ -16,7 +16,7 @@ license="GPL-3.0-or-later"
 homepage="http://vdrift.net/"
 distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version//./-}.tar.bz2"
 checksum=458d45d59075c2ce943ec6bc271a5bd0eb6bc6ed123670b65038703345020be3
-python_version=2
+python_version=3
 
 post_install() {
 	# install .desktop file
@@ -31,6 +31,9 @@ post_install() {
 	done
 	vinstall data/textures/icons/vdrift-64x64.png 644 \
 		usr/share/pixmaps vdrift.png
+
+	# remove unnecessary build system files
+	find "${DESTDIR}"/usr/share/vdrift -name '*SConscript*' -delete
 }
 
 vdrift-data_package() {

From c29734098aaca82fcbf092a399ca624d82bbd384 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 03:37:04 -0400
Subject: [PATCH 10/10] flightgear: patch for python3

---
 srcpkgs/flightgear/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/flightgear/template b/srcpkgs/flightgear/template
index 9715c576d4e6c..6f4f9ffdfb75b 100644
--- a/srcpkgs/flightgear/template
+++ b/srcpkgs/flightgear/template
@@ -1,7 +1,7 @@
 # Template file for 'flightgear'
 pkgname=flightgear
 version=2020.3.17
-revision=2
+revision=3
 # XXX: always keep in sync with simgear version!
 create_wrksrc=yes
 build_style=cmake
@@ -26,7 +26,6 @@ distfiles="
  $SOURCEFORGE_SITE/project/flightgear/release-${version%.*}/FlightGear-${version}-data.txz"
 checksum="6670dedeaca2683aca77f9f06bf9d1d8062ae32a2a5459dddc8aa0989c5f1854
  2a5eba2b9ae67a3691285833a6ce3f6bbdf3f20229f5871d7c940e151d54d8e8"
-python_version=2
 # the test suite doesn't get built, if enabled it segfaults
 make_check=no
 
@@ -48,5 +47,8 @@ flightgear-data_package() {
 	pkg_install() {
 		vmkdir usr/share/flightgear
 		mv fgdata ${PKGDESTDIR}/usr/share/flightgear
+		# python 2 build scripts
+		rm "${PKGDESTDIR}"/usr/share/flightgear/fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/asi/asi.py \
+			"${PKGDESTDIR}"/usr/share/flightgear/fgdata/Docs/compile_docs.py
 	}
 }

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Updated] py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
                   ` (9 preceding siblings ...)
  2023-10-09 23:36 ` classabbyamp
@ 2023-10-10  1:39 ` classabbyamp
  2023-10-10  1:41 ` [PR PATCH] [Merged]: " classabbyamp
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-10  1:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

There is an updated pull request by classabbyamp against master on the void-packages repository

https://github.com/classabbyamp/void-packages py2
https://github.com/void-linux/void-packages/pull/46515

py2->3 fixes
[ci skip]

A patch file from https://github.com/void-linux/void-packages/pull/46515.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py2-46515.patch --]
[-- Type: text/x-diff, Size: 28146 bytes --]

From 64b464418cd4f6995d581fbe3e86a7ef1874c70f Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:38:21 -0400
Subject: [PATCH 01/10] 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 0000000000000..0a05b38556d66
--- /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 + '<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])
diff --git a/srcpkgs/gtksourceview2/template b/srcpkgs/gtksourceview2/template
index 1ffb434669413..09d1301526530 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

From 8f7978a709bc67e609f485283cfaa27b39098545 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 04:51:37 -0400
Subject: [PATCH 02/10] kcachegrind: patch for python3

---
 srcpkgs/kcachegrind/patches/python3.patch | 77 +++++++++++++++++++++++
 srcpkgs/kcachegrind/template              |  4 +-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kcachegrind/patches/python3.patch

diff --git a/srcpkgs/kcachegrind/patches/python3.patch b/srcpkgs/kcachegrind/patches/python3.patch
new file mode 100644
index 0000000000000..1d701ddf0321c
--- /dev/null
+++ b/srcpkgs/kcachegrind/patches/python3.patch
@@ -0,0 +1,77 @@
+--- a/converters/hotshot2calltree.in
++++ b/converters/hotshot2calltree.in
+@@ -147,8 +147,8 @@
+         if (file_limit > 0) and (filecount > file_limit):
+             break
+     
+-    print
+-    print "total_cost: % d Ticks",total_cost
++    print()
++    print("total_cost: % d Ticks",total_cost)
+     dumpResults(output, call_dict, total_cost, cost_per_pos, cost_per_function)
+ 
+ def convertHandleFilename(inputfilename, caller_stack, call_dict, cost_per_pos, cost_per_function, filecount):
+@@ -234,9 +234,9 @@
+             return_from_call(caller_stack, call_dict, total_cost)
+ 
+     except IOError:
+-        print "could not open inputfile '%s', ignore this." % inputfilename
+-    except EOFError, m:
+-        print "EOF: %s" % (m,)
++        print("could not open inputfile '%s', ignore this." % inputfilename)
++    except EOFError as m:
++        print("EOF: %s" % (m,))
+     return total_cost
+ 
+ def pretty_name(file, function):
+@@ -252,7 +252,7 @@
+         self.last_values = {}
+ 
+     def clearTag(self, tag):
+-        if self.last_values.has_key(tag):
++        if tag in self.last_values.keys():
+             del self.last_values[ tag ]
+     def clear(self):
+         self.last_values = {}
+@@ -316,16 +316,16 @@
+ def run_without_optparse():
+     """parse the options without optparse, use sys.argv"""
+     if  len(sys.argv) < 4 or sys.argv[1] != "-o" :
+-        print "usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]"
++        print("usage: hotshot2cachegrind -o outputfile in1 [in2 [in3 [...]]]")
+         return
+     outputfilename = sys.argv[2]
+     try:
+-        output = file(outputfilename, "w")
++        output = open(outputfilename, "w")
+         args = sys.argv[3:]
+         convertProfFiles(output, args)
+         output.close()
+     except IOError:
+-        print "could not open '%s' for writing." % outputfilename
++        print("could not open '%s' for writing." % outputfilename)
+ 
+ def run_with_optparse():
+     """parse the options with optparse"""
+@@ -346,10 +346,10 @@
+     file_limit = int(options.file_limit)
+     try:
+         if options.outputfilename and options.outputfilename != "-":
+-            output = file(options.outputfilename, "w")
++            output = open(options.outputfilename, "w")
+             close_output = 1
+     except IOError:
+-        print "could not open '%s' for writing." % options.outputfilename
++        print("could not open '%s' for writing." % options.outputfilename)
+     if output:
+         convertProfFiles(output, args)
+         if close_output:
+@@ -364,7 +364,7 @@
+         prof.runcall(run)
+         prof.close()
+     else:
+-        print "not profiling myself, since '%s' exists, running normal" % filename
++        print("not profiling myself, since '%s' exists, running normal" % filename)
+         run()
+ 
+ # check if optparse is available.
diff --git a/srcpkgs/kcachegrind/template b/srcpkgs/kcachegrind/template
index 0d812ba71f46a..6c295a6f5bf07 100644
--- a/srcpkgs/kcachegrind/template
+++ b/srcpkgs/kcachegrind/template
@@ -1,7 +1,7 @@
 # Template file for 'kcachegrind'
 pkgname=kcachegrind
 version=23.08.0
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules gettext kcoreaddons kdoctools
  pkg-config qt5-host-tools qt5-qmake"
@@ -14,4 +14,4 @@ homepage="https://kde.org/applications/development/kcachegrind/"
 changelog="https://kde.org/announcements/changelogs/gear/${version}/#kcachegrind"
 distfiles="${KDE_SITE}/release-service/${version}/src/kcachegrind-${version}.tar.xz"
 checksum=7c577d3d2e7115c1461ca50f1b128996719222a19d4d102376420dcc2b510781
-python_version=2
+python_version=3

From ed0d65a26f3d2584a6d6d301b9eadfeb25498635 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 15:26:01 -0400
Subject: [PATCH 03/10] eclipse: works on python3

---
 srcpkgs/eclipse/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/eclipse/template b/srcpkgs/eclipse/template
index 4108117dabc67..f1b9064b58920 100644
--- a/srcpkgs/eclipse/template
+++ b/srcpkgs/eclipse/template
@@ -1,7 +1,7 @@
 # Template file for 'eclipse'
 pkgname=eclipse
 version=4.28
-revision=1
+revision=2
 #code name of version
 _release=2023-06
 archs="x86_64"
@@ -19,7 +19,7 @@ _edition=java
 _mirror="http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse"
 distfiles="${_mirror}/technology/epp/downloads/release/${_release}/${_patch}/eclipse-${_edition}-${_release}-R-linux-gtk-x86_64.tar.gz"
 checksum=142e33831fbbe52f53255a746b35a038dff0366a04cb4d3be2d8fe0ce76f34e8
-python_version=2
+python_version=3
 
 do_install() {
 	vmkdir usr/lib/eclipse

From 009ddc258c8a2b3947140df0cbf2325c313dd658 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 16:58:44 -0400
Subject: [PATCH 04/10] libdbusmenu-glib: work on python3

---
 .../libdbusmenu-glib/patches/python3.patch    | 60 +++++++++++++++++++
 srcpkgs/libdbusmenu-glib/template             |  3 +-
 2 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/libdbusmenu-glib/patches/python3.patch

diff --git a/srcpkgs/libdbusmenu-glib/patches/python3.patch b/srcpkgs/libdbusmenu-glib/patches/python3.patch
new file mode 100644
index 0000000000000..830a19005be58
--- /dev/null
+++ b/srcpkgs/libdbusmenu-glib/patches/python3.patch
@@ -0,0 +1,60 @@
+--- a/tools/dbusmenu-bench
++++ b/tools/dbusmenu-bench
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -61,7 +61,7 @@
+ 
+ def dump_properties(properties, prepend=""):
+     for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++        print("%s- %s: %s" % (prepend, key, value))
+ 
+ 
+ def run_test_sequence(menu, dump=False):
+@@ -74,9 +74,9 @@
+     revision, layout = menu.GetLayout(dbus.Int32(0))
+     times["GetLayout"] = chrono.elapsed()
+     if dump:
+-        print "revision:", revision
+-        print "layout:"
+-        print layout
++        print("revision:", revision)
++        print("layout:")
++        print(layout)
+ 
+     # Get ids
+     tree = ET.fromstring(layout)
+@@ -89,17 +89,17 @@
+     children = menu.GetChildren(dbus.Int32(root_id), property_names)
+     times["GetChildren"] = chrono.elapsed()
+     if dump:
+-        print "children:"
++        print("children:")
+         for child in children:
+             id, properties = child
+-            print "- %d:" % id
++            print("- %d:" % id)
+             dump_properties(properties, prepend=" ")
+ 
+     chrono.restart()
+     properties = menu.GetProperties(dbus.Int32(child_id), property_names)
+     times["GetProperties"] = chrono.elapsed()
+     if dump:
+-        print "properties:"
++        print("properties:")
+         dump_properties(properties)
+ 
+     return times
+@@ -109,7 +109,7 @@
+ 
+ def print_probe(prefix, name, value, timestamp):
+     value = int(value * 1000000)
+-    print "%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals()
++    print("%(prefix)s.%(name)s:%(value)d@%(timestamp)d" % locals())
+ 
+ def main():
+     parser = OptionParser(usage = "%prog [options]")
diff --git a/srcpkgs/libdbusmenu-glib/template b/srcpkgs/libdbusmenu-glib/template
index 8981401214cba..26c7d3f201f94 100644
--- a/srcpkgs/libdbusmenu-glib/template
+++ b/srcpkgs/libdbusmenu-glib/template
@@ -1,7 +1,7 @@
 # Template file for 'libdbusmenu-glib'
 pkgname=libdbusmenu-glib
 version=16.04.0
-revision=5
+revision=6
 build_style=gnu-configure
 build_helper="gir"
 configure_args="--disable-dumper --disable-static --disable-tests
@@ -15,7 +15,6 @@ license="GPL-3, LGPL-2.1, LGPL-3"
 homepage="https://launchpad.net/libdbusmenu"
 distfiles="${homepage}/${version%.*}/${version}/+download/libdbusmenu-${version}.tar.gz"
 checksum=b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
-python_version=2 #unverified
 
 build_options="gir"
 build_options_default="gir"

From ef4d9095bebc738fddefb559624f54ee72db1629 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 6 Oct 2023 17:12:55 -0400
Subject: [PATCH 05/10] nitroshare: work on python3

---
 srcpkgs/nitroshare/patches/python3.patch | 13 +++++++++++++
 srcpkgs/nitroshare/template              |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/nitroshare/patches/python3.patch

diff --git a/srcpkgs/nitroshare/patches/python3.patch b/srcpkgs/nitroshare/patches/python3.patch
new file mode 100644
index 0000000000000..f30aaaca3d5c4
--- /dev/null
+++ b/srcpkgs/nitroshare/patches/python3.patch
@@ -0,0 +1,13 @@
+--- a/src/dist/nitroshare.py.in
++++ b/src/dist/nitroshare.py.in
+@@ -27,8 +27,8 @@
+ 
+ from json import loads
+ from os import path
+-from urllib import url2pathname
+-from urlparse import urlparse
++from urllib.request import url2pathname
++from urllib.parse import urlparse
+ 
+ import gi
+ gi.require_version('Gtk', '3.0')
diff --git a/srcpkgs/nitroshare/template b/srcpkgs/nitroshare/template
index 50f1a6f62a91c..0850074b28cfd 100644
--- a/srcpkgs/nitroshare/template
+++ b/srcpkgs/nitroshare/template
@@ -1,7 +1,7 @@
 # Template file for 'nitroshare'
 pkgname=nitroshare
 version=0.3.4
-revision=1
+revision=2
 build_style=cmake
 pycompile_dirs="usr/share/nautilus-python/extensions
  usr/share/nemo-python/extensions
@@ -15,7 +15,7 @@ license="MIT"
 homepage="http://nitroshare.net"
 distfiles="https://github.com/nitroshare/nitroshare-desktop/archive/${version}.tar.gz"
 checksum=29874e5909c29211a3c9e13f8c0f49b901ec2996e5d60d80af80d2fb80c3d7ec
-python_version=2 #unverified
+python_version=3
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" qt5-host-tools"

From c2d5cf7c08b4e9b7591d98b5c8a29b5da6380436 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:49:23 -0400
Subject: [PATCH 06/10] tvheadend: compatible with python3

---
 srcpkgs/tvheadend/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tvheadend/template b/srcpkgs/tvheadend/template
index a2004480332b2..9aea7de4ec705 100644
--- a/srcpkgs/tvheadend/template
+++ b/srcpkgs/tvheadend/template
@@ -7,7 +7,7 @@ configure_args="--enable-dvbscan --disable-ffmpeg_static
 --disable-hdhomerun_static --disable-bintray_cache --disable-libx264_static
 --disable-libx265_static --disable-libvpx_static --disable-libtheora_static
 --disable-libvorbis_static --disable-libfdkaac_static"
-hostmakedepends="gettext pkg-config python git which"
+hostmakedepends="gettext pkg-config python3 git which"
 makedepends="avahi-libs-devel openssl-devel zlib-devel libcurl-devel ffmpeg-devel"
 short_desc="TV streaming server"
 maintainer="lemmi <lemmi@nerd2nerd.org>"

From 7120d37ffc4e1bde2e9cd54d132a1e23523f8971 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sat, 7 Oct 2023 21:58:02 -0400
Subject: [PATCH 07/10] skktools: patch for python3

---
 srcpkgs/skktools/patches/python3.patch | 131 +++++++++++++++++++++++++
 srcpkgs/skktools/template              |   4 +-
 2 files changed, 133 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/skktools/patches/python3.patch

diff --git a/srcpkgs/skktools/patches/python3.patch b/srcpkgs/skktools/patches/python3.patch
new file mode 100644
index 0000000000000..efd52da4af257
--- /dev/null
+++ b/srcpkgs/skktools/patches/python3.patch
@@ -0,0 +1,131 @@
+--- a/skk2cdb.py
++++ b/skk2cdb.py
+@@ -16,11 +16,12 @@
+ import sys, os
+ from struct import pack, unpack
+ from array import array
++from functools import reduce
+ 
+ 
+ # calc hash value with a given key
+-def cdbhash(s, n=0L):
+-  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffffL, s, n+5381L)
++def cdbhash(s, n=0):
++  return reduce(lambda h,c: ((h*33) ^ ord(c)) & 0xffffffff, s, n+5381)
+ 
+ if pack('=i',1) == pack('>i',1):
+   # big endian
+@@ -62,9 +63,9 @@
+   
+   def __init__(self, cdbname, docache=1):
+     self.name = cdbname
+-    self._fp = file(cdbname, 'rb')
++    self._fp = open(cdbname, 'rb')
+     hash0 = decode(self._fp.read(2048))
+-    self._hash0 = [ (hash0[i], hash0[i+1]) for i in xrange(0, 512, 2) ]
++    self._hash0 = [ (hash0[i], hash0[i+1]) for i in range(0, 512, 2) ]
+     self._hash1 = [ None ] * 256
+     (self._eod,_) = self._hash0[0]
+     self._docache = docache
+@@ -93,7 +94,7 @@
+       self._hash1[h1] = hs
+     i = ((h >> 8) % ncells) * 2
+     n = ncells*2
+-    for _ in xrange(ncells):
++    for _ in range(ncells):
+       p1 = hs[i+1]
+       if p1 == 0: raise KeyError(k)
+       if hs[i] == h:
+@@ -122,7 +123,7 @@
+       return False
+ 
+   def __contains__(self, k):
+-    return self.has_key(k)
++    return k in self
+ 
+   def firstkey(self):
+     self._keyiter = None
+@@ -132,7 +133,7 @@
+     if not self._keyiter:
+       self._keyiter = ( k for (k,v) in cdbiter(self._fp, self._eod) )
+     try:
+-      return self._keyiter.next()
++      return next(self._keyiter)
+     except StopIteration:
+       return None
+ 
+@@ -140,7 +141,7 @@
+     if not self._eachiter:
+       self._eachiter = cdbiter(self._fp, self._eod)
+     try:
+-      return self._eachiter.next()
++      return next(self._eachiter)
+     except StopIteration:
+       return None
+   
+@@ -159,9 +160,9 @@
+     self.fn = cdbname
+     self.fntmp = tmpname
+     self.numentries = 0
+-    self._fp = file(tmpname, 'wb')
++    self._fp = open(tmpname, 'wb')
+     self._pos = 2048                    # sizeof((h,p))*256
+-    self._bucket = [ array('I') for _ in xrange(256) ]
++    self._bucket = [ array('I') for _ in range(256) ]
+     return
+ 
+   def __len__(self):
+@@ -197,7 +198,7 @@
+       if not b1: continue
+       blen = len(b1)
+       a = array('I', [0]*blen*2)
+-      for j in xrange(0, blen, 2):
++      for j in range(0, blen, 2):
+         (h,p) = (b1[j],b1[j+1])
+         i = ((h >> 8) % blen)*2
+         while a[i+1]:             # is cell[i] already occupied?
+@@ -238,7 +239,7 @@
+ 
+ # cdbdump
+ def cdbdump(cdbname):
+-  fp = file(cdbname, 'rb')
++  fp = open(cdbname, 'rb')
+   (eor,) = unpack('<I', fp.read(4))
+   return cdbiter(fp, eor)
+ 
+@@ -248,7 +249,7 @@
+   q = []
+   for it in iters:
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       pass
+   k0 = None
+@@ -262,7 +263,7 @@
+     vs.append(v)
+     k0 = k
+     try:
+-      q.append((it.next(),it))
++      q.append((next(it),it))
+     except StopIteration:
+       continue
+   if vs: yield (k0,vs)
+@@ -280,7 +281,7 @@
+   import fileinput
+   import os.path
+   def usage():
+-    print 'usage: %s [-f] outfile [infile ...]' % argv[0]
++    print('usage: %s [-f] outfile [infile ...]' % argv[0])
+     return 100
+   try:
+     (opts, args) = getopt.getopt(argv[1:], 'dfo:')
+@@ -292,7 +293,7 @@
+   if not args: return usage()
+   outfile = args.pop(0)
+   if not force and os.path.exists(outfile):
+-    print >>sys.stderr, 'file exists: %r' % outfile
++    print('file exists: %r' % outfile, file=sys.stderr)
+     return 1
+   #
+   maker = CDBMaker(outfile, outfile+'.tmp')
diff --git a/srcpkgs/skktools/template b/srcpkgs/skktools/template
index 4c1ddda99c00e..3cfa8fe3168c5 100644
--- a/srcpkgs/skktools/template
+++ b/srcpkgs/skktools/template
@@ -1,7 +1,7 @@
 # Template file for 'skktools'
 pkgname=skktools
 version=1.3.4
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-gdbm"
 hostmakedepends="pkg-config glib-devel"
@@ -12,7 +12,7 @@ license="GPL-2.0-or-later"
 homepage="http://openlab.ring.gr.jp/skk/"
 distfiles="http://openlab.ring.gr.jp/skk/tools/${pkgname}-${version}.tar.gz"
 checksum=84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168
-python_version=2 #unverified
+python_version=3
 
 post_install() {
 	vmkdir usr/share/${pkgname}

From c8382f9a4cbfd9a0e14e4f769c9bec3ff22c6b63 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:03:37 -0400
Subject: [PATCH 08/10] tacacs: convert script to python3

---
 srcpkgs/tacacs/patches/python3.patch | 98 ++++++++++++++++++++++++++++
 srcpkgs/tacacs/template              |  6 +-
 2 files changed, 101 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/tacacs/patches/python3.patch

diff --git a/srcpkgs/tacacs/patches/python3.patch b/srcpkgs/tacacs/patches/python3.patch
new file mode 100644
index 0000000000000..c8183d69a8b3e
--- /dev/null
+++ b/srcpkgs/tacacs/patches/python3.patch
@@ -0,0 +1,98 @@
+--- a/do_auth.py
++++ b/do_auth.py
+@@ -211,7 +211,7 @@
+ Written by Dan Schmidt - Please visit tacacs.org to check for updates.
+ '''
+ 
+-import sys,re,getopt,ConfigParser
++import sys,re,getopt,configparser
+ from time import strftime
+ 
+ # I really don't want to deal with these exceptions more than once
+@@ -230,23 +230,23 @@
+     #Should not have any exceptions - BUT, just in case
+     try:
+         attributes = config.get(the_section, the_option)
+-    except ConfigParser.NoSectionError:
++    except configparser.NoSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Section '%s' Doesn't Exist!\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.DuplicateSectionError:
++    except configparser.DuplicateSectionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Duplicate section '%s'\n" 
+                 % (the_section))
+         sys.exit(1)
+-    except ConfigParser.NoOptionError:
++    except configparser.NoOptionError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                     + "Error: '%s' not found in section '%s\n'" 
+                      % (the_option, the_section))
+         sys.exit(1)
+     #To do: finish exceptions. 
+-    except ConfigParser.ParsingError:
++    except configparser.ParsingError:
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't parse file '%s'! (You got me)\n" 
+              % (filename))
+@@ -298,9 +298,9 @@
+     argv = sys.argv
+     try:
+         optlist, args = getopt.getopt(sys.argv[1:], 'i:u:f:l:d:?:D', ['fix_crs_bug','?', '-?', 'help', 'Help'])
+-    except getopt.GetoptError, err:
+-        print str(err) 
+-        print __doc__
++    except getopt.GetoptError as err:
++        print(str(err)) 
++        print(__doc__)
+         sys.exit(1)
+     for (i, j) in optlist:
+         if i == '-i':
+@@ -314,15 +314,15 @@
+         elif i == '-d':
+             device = j
+         elif i in ('?', '-?', 'help', 'Help'):
+-            print __doc__
++            print(__doc__)
+             sys.exit(1)
+         elif i == '-D':
+             is_debug = True
+         else:
+-            print 'Unknown option:', i
++            print('Unknown option:', i)
+             sys.exit(1)
+     if len(argv) < 7:
+-        print __doc__
++        print(__doc__)
+         sys.exit(1)
+     log_file = open (log_name, "a")
+ #DEBUG!  We at least got CALLED
+@@ -384,7 +384,7 @@
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: No username entered!\n")
+         sys.exit(1)
+-    config = ConfigParser.SafeConfigParser()
++    config = configparser.SafeConfigParser()
+     if not (filename in config.read(filename)):
+         log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                 + "Error: Can't open/parse '%s'\n" 
+@@ -491,7 +491,7 @@
+                     for item in return_pairs:
+                         #DEBUG
+                         # log_file.write("Returning:%s\n" % item.strip())
+-                        print item.strip('\n')
++                        print(item.strip('\n'))
+                     if want_tac_pairs:
+                         #DEBUG
+                         # log_file.write("Exiting status 2\n")
+@@ -507,7 +507,7 @@
+             for item in return_pairs:
+                 #DEBUG
+                 # log_file.write("Returning:%s\n" % item.strip())
+-                print item.strip('\n')
++                print(item.strip('\n'))
+             log_file.write(strftime("%Y-%m-%d %H:%M:%S: ")
+                  + "User '%s' granted access to device '%s' in group '%s' from '%s'\n"
+                  % (user_name, device, this_group, ip_addr))
diff --git a/srcpkgs/tacacs/template b/srcpkgs/tacacs/template
index 1cb4f17935297..179fc1fa161ee 100644
--- a/srcpkgs/tacacs/template
+++ b/srcpkgs/tacacs/template
@@ -1,7 +1,7 @@
 # Template file for 'tacacs'
 pkgname=tacacs
 version=4.0.4.28
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--with-libwrap=no"
 hostmakedepends="flex perl"
@@ -10,9 +10,9 @@ short_desc="Modified version of Cisco's tacacs+ (tac_plus) developer's kit"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="custom:Cisco"
 homepage="http://www.shrubbery.net/tac_plus/"
-distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/$pkgname-F$version.tar.gz"
+distfiles="ftp://ftp.shrubbery.net/pub/tac_plus/tacacs-F$version.tar.gz"
 checksum=147f2dc98d26d2f93f0aba76c988ced196ffe1c001dc2e91f788a1a2c747219e
-python_version=2
+python_version=3
 disable_parallel_build=yes
 
 pre_configure() {

From 9f76e7767e39ca3ef03ca0711122ec1ce7e1f102 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 02:43:33 -0400
Subject: [PATCH 09/10] vdrift: remove sconscript files

---
 srcpkgs/vdrift/template | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/vdrift/template b/srcpkgs/vdrift/template
index 643cb08847d19..90b702affecbc 100644
--- a/srcpkgs/vdrift/template
+++ b/srcpkgs/vdrift/template
@@ -1,7 +1,7 @@
 # Template file for 'vdrift'
 pkgname=vdrift
 version=2014.10.20
-revision=11
+revision=12
 build_style=scons
 scons_use_destdir=yes
 make_build_args="release=1 force_feedback=1 extbullet=1 datadir=share/${pkgname}"
@@ -16,7 +16,7 @@ license="GPL-3.0-or-later"
 homepage="http://vdrift.net/"
 distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version//./-}.tar.bz2"
 checksum=458d45d59075c2ce943ec6bc271a5bd0eb6bc6ed123670b65038703345020be3
-python_version=2
+python_version=3
 
 post_install() {
 	# install .desktop file
@@ -31,6 +31,9 @@ post_install() {
 	done
 	vinstall data/textures/icons/vdrift-64x64.png 644 \
 		usr/share/pixmaps vdrift.png
+
+	# remove unnecessary build system files
+	find "${DESTDIR}"/usr/share/vdrift -name '*SConscript*' -delete
 }
 
 vdrift-data_package() {

From 20bda2ec67f684ca0be997237adeeb9d88fd417e Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Sun, 8 Oct 2023 03:37:04 -0400
Subject: [PATCH 10/10] flightgear: patch for python3

---
 srcpkgs/flightgear/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/flightgear/template b/srcpkgs/flightgear/template
index 9715c576d4e6c..6f4f9ffdfb75b 100644
--- a/srcpkgs/flightgear/template
+++ b/srcpkgs/flightgear/template
@@ -1,7 +1,7 @@
 # Template file for 'flightgear'
 pkgname=flightgear
 version=2020.3.17
-revision=2
+revision=3
 # XXX: always keep in sync with simgear version!
 create_wrksrc=yes
 build_style=cmake
@@ -26,7 +26,6 @@ distfiles="
  $SOURCEFORGE_SITE/project/flightgear/release-${version%.*}/FlightGear-${version}-data.txz"
 checksum="6670dedeaca2683aca77f9f06bf9d1d8062ae32a2a5459dddc8aa0989c5f1854
  2a5eba2b9ae67a3691285833a6ce3f6bbdf3f20229f5871d7c940e151d54d8e8"
-python_version=2
 # the test suite doesn't get built, if enabled it segfaults
 make_check=no
 
@@ -48,5 +47,8 @@ flightgear-data_package() {
 	pkg_install() {
 		vmkdir usr/share/flightgear
 		mv fgdata ${PKGDESTDIR}/usr/share/flightgear
+		# python 2 build scripts
+		rm "${PKGDESTDIR}"/usr/share/flightgear/fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/asi/asi.py \
+			"${PKGDESTDIR}"/usr/share/flightgear/fgdata/Docs/compile_docs.py
 	}
 }

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PR PATCH] [Merged]: py2->3 fixes
  2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
                   ` (10 preceding siblings ...)
  2023-10-10  1:39 ` classabbyamp
@ 2023-10-10  1:41 ` classabbyamp
  11 siblings, 0 replies; 13+ messages in thread
From: classabbyamp @ 2023-10-10  1:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

There's a merged pull request on the void-packages repository

py2->3 fixes
https://github.com/void-linux/void-packages/pull/46515

Description:
[ci skip]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-10-10  1:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-08  1:36 [PR PATCH] py2->3 fixes classabbyamp
2023-10-08  1:58 ` [PR PATCH] [Updated] " classabbyamp
2023-10-08  6:03 ` classabbyamp
2023-10-08  6:04 ` classabbyamp
2023-10-08  6:43 ` classabbyamp
2023-10-08  7:37 ` classabbyamp
2023-10-08 10:28 ` [PR REVIEW] " r-ricci
2023-10-08 10:30 ` r-ricci
2023-10-08 14:30 ` classabbyamp
2023-10-08 19:56 ` [PR PATCH] [Updated] " classabbyamp
2023-10-09 23:36 ` classabbyamp
2023-10-10  1:39 ` classabbyamp
2023-10-10  1:41 ` [PR PATCH] [Merged]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).