tuir: adjust for python 3.12 method removal

This commit is contained in:
Piotr Wójcik 2024-03-02 20:19:54 +01:00 committed by classabbyamp
parent 44156f322a
commit 1dfad07e73
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 02ab9bade680d7c50c7d5988a75ff928ba1a8cbd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Fri, 27 Oct 2023 20:54:13 +0200
Subject: [PATCH 1/7] Adjust for python 3.12 method removal
---
tuir/config.py | 7 ++++++-
tuir/theme.py | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/tuir/config.py b/tuir/config.py
index 7a8a4d5..4fea785 100644
--- a/tuir/config.py
+++ b/tuir/config.py
@@ -131,7 +131,12 @@ class Config(object):
config = configparser.RawConfigParser()
if os.path.exists(filename):
with codecs.open(filename, encoding='utf-8') as fp:
- config.readfp(fp)
+ try:
+ read_method = config.read_file
+ except AttributeError:
+ # deprecated since 3.2, removed in 3.12
+ read_method = config.readfp
+ read_method(fp)
return cls._parse_tuir_file(config)
diff --git a/tuir/theme.py b/tuir/theme.py
index 57b3288..c44b222 100644
--- a/tuir/theme.py
+++ b/tuir/theme.py
@@ -399,7 +399,12 @@ class Theme(object):
config = configparser.ConfigParser()
config.optionxform = six.text_type # Preserve case
with codecs.open(filename, encoding='utf-8') as fp:
- config.readfp(fp)
+ try:
+ read_method = config.read_file
+ except AttributeError:
+ # deprecated since 3.2, removed in 3.12
+ read_method = config.readfp
+ read_method(fp)
except configparser.ParsingError as e:
raise ConfigError(e.message)
--
2.43.0

View File

@ -1,7 +1,7 @@
# Template file for 'tuir' # Template file for 'tuir'
pkgname=tuir pkgname=tuir
version=1.29.0 version=1.29.0
revision=6 revision=7
build_style=python3-module build_style=python3-module
hostmakedepends="python3-setuptools" hostmakedepends="python3-setuptools"
depends="ncurses python3-BeautifulSoup4 python3-decorator python3-kitchen depends="ncurses python3-BeautifulSoup4 python3-decorator python3-kitchen
@ -12,6 +12,7 @@ license="MIT"
homepage="https://gitlab.com/ajak/tuir" homepage="https://gitlab.com/ajak/tuir"
distfiles="${homepage}/-/archive/v${version}/tuir-v${version}.tar.bz2" distfiles="${homepage}/-/archive/v${version}/tuir-v${version}.tar.bz2"
checksum=501ba4e6b24f20116ccfac39cdf16b6a5c89411b4928371d5c2314d0da57d80d checksum=501ba4e6b24f20116ccfac39cdf16b6a5c89411b4928371d5c2314d0da57d80d
make_check=no # python3-vcrpy required
post_install() { post_install() {
vlicense LICENSE vlicense LICENSE