[packages/libdbusmenu] - port dbusmenu-bench to python3 (patch from Debian, rediffed)

hawk hawk at pld-linux.org
Tue Apr 23 01:55:28 CEST 2024


commit e4a6fb741cdd1823669e95f33052b64f80945e7e
Author: Marcin Krol <hawk at tld-linux.org>
Date:   Mon Apr 22 23:57:32 2024 +0200

    - port dbusmenu-bench to python3 (patch from Debian, rediffed)

 libdbusmenu.spec |  6 ++--
 python3.patch    | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+), 3 deletions(-)
---
diff --git a/libdbusmenu.spec b/libdbusmenu.spec
index ac3c2ba..3c71300 100644
--- a/libdbusmenu.spec
+++ b/libdbusmenu.spec
@@ -11,11 +11,12 @@ Summary:	DBus Menu Library
 Summary(pl.UTF-8):	Biblioteka DBus Menu
 Name:		libdbusmenu
 Version:	16.04.0
-Release:	1
+Release:	2
 License:	GPL v3, LGPL v2.1, LGPL v3
 Group:		Libraries
 Source0:	https://launchpad.net/libdbusmenu/16.04/%{version}/+download/%{name}-%{version}.tar.gz
 # Source0-md5:	3c05d53053b3ea69384b5f93d7a4c7c4
+Patch0:		python3.patch
 URL:		https://launchpad.net/libdbusmenu
 BuildRequires:	atk-devel
 BuildRequires:	autoconf >= 2.62
@@ -269,6 +270,7 @@ Dokumentacja API biblioteki libdbusmenu-gtk (zarówno w wersji dla GTK+
 
 %prep
 %setup -q
+%patch0 -p1
 
 %{__sed} -i -e 's/-Werror//' \
 	libdbusmenu-glib/Makefile.am \
@@ -276,8 +278,6 @@ Dokumentacja API biblioteki libdbusmenu-gtk (zarówno w wersji dla GTK+
 	tools/Makefile.am \
 	tools/testapp/Makefile.am
 
-%{__sed} -i -e '1s,/usr/bin/env python$,%{__python},' tools/dbusmenu-bench
-
 %build
 %{__intltoolize}
 %{__libtoolize}
diff --git a/python3.patch b/python3.patch
new file mode 100644
index 0000000..9089f77
--- /dev/null
+++ b/python3.patch
@@ -0,0 +1,90 @@
+diff -ur libdbusmenu-16.04.0.orig/tools/dbusmenu-bench libdbusmenu-16.04.0/tools/dbusmenu-bench
+--- libdbusmenu-16.04.0.orig/tools/dbusmenu-bench	2016-02-27 19:58:43.000000000 +0100
++++ libdbusmenu-16.04.0/tools/dbusmenu-bench	2024-04-22 23:54:25.748827260 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python3
+ # encoding: utf-8
+ """
+ A library to communicate a menu object set accross DBus and
+@@ -60,8 +60,8 @@
+ 
+ 
+ def dump_properties(properties, prepend=""):
+-    for key, value in properties.items():
+-        print "%s- %s: %s" % (prepend, key, value)
++    for key, value in list(properties.items()):
++        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,27 +89,27 @@
+     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
+ 
+ def create_timing_dict():
+-    return dict(zip(PROBES, itertools.repeat(0)))
++    return dict(list(zip(PROBES, itertools.repeat(0))))
+ 
+ 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]")
+@@ -134,7 +134,7 @@
+     max_timings = create_timing_dict()
+     for x in range(options.count):
+         timings = run_test_sequence(menu)
+-        for name, timing in timings.items():
++        for name, timing in list(timings.items()):
+             cumulated_timings[name] += timing
+             if min_timings[name] == 0 or min_timings[name] > timing:
+                 min_timings[name] = timing
+@@ -142,11 +142,11 @@
+                 max_timings[name] = timing
+ 
+     timestamp = int(time.time())
+-    for name, timing in cumulated_timings.items():
++    for name, timing in list(cumulated_timings.items()):
+         print_probe("average", name, timing / options.count, timestamp)
+-    for name, timing in min_timings.items():
++    for name, timing in list(min_timings.items()):
+         print_probe("min", name, timing, timestamp)
+-    for name, timing in max_timings.items():
++    for name, timing in list(max_timings.items()):
+         print_probe("max", name, timing, timestamp)
+ 
+     return 0
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libdbusmenu.git/commitdiff/e4a6fb741cdd1823669e95f33052b64f80945e7e



More information about the pld-cvs-commit mailing list