Accepting request 993301 from home:mcepl:branches:hardware

- Add no-pkg-resources.patch to fix the crash with missing Python
  pkg_resources pacakge (removd in Python 3.10).

OBS-URL: https://build.opensuse.org/request/show/993301
OBS-URL: https://build.opensuse.org/package/show/hardware/libgusb?expand=0&rev=39
This commit is contained in:
Dominique Leuenberger 2022-08-05 12:39:42 +00:00 committed by Git OBS Bridge
parent a93fd3666e
commit 5da6cffbbf
3 changed files with 53 additions and 1 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Aug 5 11:30:24 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add no-pkg-resources.patch to fix the crash with missing Python
pkg_resources pacakge (removd in Python 3.10).
-------------------------------------------------------------------
Mon May 9 07:58:08 UTC 2022 - Paolo Stivanin <info@paolostivanin.com>

View File

@ -25,9 +25,14 @@ Group: Development/Libraries/GNOME
URL: https://github.com/hughsie/libgusb
Source0: http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.xz
Source99: baselibs.conf
# PATCH-FIX-UPSTREAM no-pkg-resources.patch gh#hughsie/libgusb#61 mcepl@suse.com
# Don't rely on the obsolete version of pkg_resources
Patch0: no-pkg-resources.patch
BuildRequires: gtk-doc
BuildRequires: meson
BuildRequires: pkgconfig
BuildRequires: python3-base
BuildRequires: python3-packaging
BuildRequires: vala
BuildRequires: pkgconfig(glib-2.0) >= 2.44.0
BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.29
@ -69,7 +74,7 @@ asynchronous control, bulk and interrupt transfers with proper
cancellation and integration into a mainloop.
%prep
%setup -q
%autosetup -p1
%build
%meson

41
no-pkg-resources.patch Normal file
View File

@ -0,0 +1,41 @@
---
contrib/generate-version-script.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/contrib/generate-version-script.py
+++ b/contrib/generate-version-script.py
@@ -7,7 +7,7 @@
import sys
import xml.etree.ElementTree as ET
-from pkg_resources import parse_version
+from packaging.version import parse
XMLNS = '{http://www.gtk.org/introspection/core/1.0}'
XMLNS_C = '{http://www.gtk.org/introspection/c/1.0}'
@@ -54,14 +54,14 @@ class LdVersionScript:
for node in cls.findall(XMLNS + 'method'):
version_tmp = self._add_node(node)
if version_tmp:
- if not version_lowest or parse_version(version_tmp) < parse_version(version_lowest):
+ if not version_lowest or parse(version_tmp) < parse(version_lowest):
version_lowest = version_tmp
# add the constructor
for node in cls.findall(XMLNS + 'constructor'):
version_tmp = self._add_node(node)
if version_tmp:
- if not version_lowest or parse_version(version_tmp) < parse_version(version_lowest):
+ if not version_lowest or parse(version_tmp) < parse(version_lowest):
version_lowest = version_tmp
if '{http://www.gtk.org/introspection/glib/1.0}get-type' not in cls.attrib:
@@ -93,7 +93,7 @@ class LdVersionScript:
# output the version data to a file
verout = '# generated automatically, do not edit!\n'
oldversion = None
- for version in sorted(versions, key=parse_version):
+ for version in sorted(versions, key=parse):
symbols = sorted(self.releases[version])
verout += '\n%s_%s {\n' % (self.library_name, version)
verout += ' global:\n'