50 lines
1.7 KiB
Diff
50 lines
1.7 KiB
Diff
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
|
|
|