Cope with configparser changes in Python 3.12

Signed-off-by: Nils Philippsen <nils@tiptoe.de>
This commit is contained in:
Nils Philippsen 2023-09-29 01:23:53 +02:00
parent 8ac0d478c1
commit ca7b59712d
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,25 @@
diff -up libffado-2.4.7/support/mixer-qt4/ffado/registration.py.configparser libffado-2.4.7/support/mixer-qt4/ffado/registration.py
--- libffado-2.4.7/support/mixer-qt4/ffado/registration.py.configparser 2022-02-25 13:25:10.000000000 +0100
+++ libffado-2.4.7/support/mixer-qt4/ffado/registration.py 2023-09-29 01:20:30.771066060 +0200
@@ -27,9 +27,9 @@ import os
# Python3 renamed ConfigParser to configparser. Deal with this in a way
# which maintains compatibility with python2.
try:
- from configparser import SafeConfigParser
-except:
- from ConfigParser import SafeConfigParser
+ from configparser import ConfigParser
+except ImportError:
+ from ConfigParser import SafeConfigParser as ConfigParser
# The urlopen()/urlencode() functions from urllib in python2 are in
# urllib.request and urllib.parse respectively under python2.
@@ -76,7 +76,7 @@ class ffado_registration:
# parse the ini file
self.config_filename = os.path.expanduser(INI_FILE_PATH)
- self.parser = SafeConfigParser()
+ self.parser = ConfigParser()
self.parser.read(self.config_filename)
self.section_name = "%s:%X" % (self.ffado_version, self.guid)
self.email = "(optional)"

View File

@ -20,6 +20,8 @@ Patch1: libffado-2.4.4-icon-name.patch
Patch2: libffado-2.4.4-scons-quirk.patch
# Patch for python3.12 imp module removal
Patch3: libffado-2.4.7-python312-imp-removal.patch
# Patch for Python 3.12 configparser changes
Patch4: libffado-2.4.7-configparser.patch
BuildRequires: alsa-lib-devel
BuildRequires: dbus-c++-devel
@ -83,6 +85,7 @@ Applications and utilities for use with libffado.
%patch -P2 -p1 -b .scons-quirk
%endif
%patch -P3 -p1 -b .py312
%patch -P4 -p1 -b .configparser
# Fix Python shebangs
sed -i 's|/usr/bin/.*python$|/usr/bin/python3|' \