commit fa281e32f02f0d5dc076375e622d75427fe416a6
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Thu Apr 4 02:36:39 2024 +0100
Fix python-3.12 issue
ldoce5viewer.spec | 6 +++-
py312_fix.patch | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+), 1 deletion(-)
---
diff --git a/ldoce5viewer.spec b/ldoce5viewer.spec
index 1d934df..ee899eb 100644
--- a/ldoce5viewer.spec
+++ b/ldoce5viewer.spec
@@ -4,7 +4,7 @@
Name: ldoce5viewer
Version: 0
-Release: 26.%{date}git%{shortcommit0}%{?dist}
+Release: 27.%{date}git%{shortcommit0}%{?dist}
Summary: Viewer Application for the Longman Dictionary (LDOCE 5)
License: GPLv3+ and Public Domain
URL:
https://forward-backward.co.jp/ldoce5viewer/
@@ -23,6 +23,7 @@ Patch3:
https://github.com/dwrobel/ldoce5viewer/commit/e17a19a86c5f7a02c
# Inkscape 1.0.2 changed argument from --export-file= to --export-filename=
# Not sent upstream as it's read-only now.
Patch4:
https://github.com/dwrobel/ldoce5viewer/commit/6bb1cc5a3df2f72b590e923034...
+Patch5: py312_fix.patch
BuildArch: noarch
@@ -145,6 +146,9 @@ appstream-util validate-relax --nonet
%{buildroot}/%{_datadir}/appdata/*.appdata
%changelog
+* Thu Apr 04 2024 Leigh Scott <leigh123linux(a)gmail.com> - 0-27.20180309git377ff48
+- Fix python-3.12 issue
+
* Sat Feb 03 2024 RPM Fusion Release Engineering <sergiomb(a)rpmfusion.org> -
0-26.20180309git377ff48
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
diff --git a/py312_fix.patch b/py312_fix.patch
new file mode 100644
index 0000000..7cb89af
--- /dev/null
+++ b/py312_fix.patch
@@ -0,0 +1,85 @@
+diff -uNrp a/ldoce5viewer/ldoce5/extract.py b/ldoce5viewer/ldoce5/extract.py
+--- a/ldoce5viewer/ldoce5/extract.py 2018-03-09 07:31:10.000000000 +0000
++++ b/ldoce5viewer/ldoce5/extract.py 2024-04-04 01:46:43.391462108 +0100
+@@ -6,7 +6,7 @@ from __future__ import absolute_import
+ from __future__ import unicode_literals
+
+ import re
+-from cgi import escape
++from html import escape
+ from itertools import chain
+
+ import lxml.etree as et
+diff -uNrp a/ldoce5viewer/ldoce5/idmreader.py b/ldoce5viewer/ldoce5/idmreader.py
+--- a/ldoce5viewer/ldoce5/idmreader.py 2018-03-09 07:31:10.000000000 +0000
++++ b/ldoce5viewer/ldoce5/idmreader.py 2024-04-04 02:27:26.733504457 +0100
+@@ -6,7 +6,7 @@ import os.path
+ from struct import unpack
+ from zlib import decompress
+ try:
+- from configparser import SafeConfigParser
++ from configparser import ConfigParser
+ except:
+ from ConfigParser import SafeConfigParser
+
+@@ -82,9 +82,9 @@ def is_ldoce5_dir(path):
+ def list_files(data_root, archive_name):
+
+ def _parse_cft(path):
+- cp = SafeConfigParser()
++ cp = ConfigParser()
+ with open(path, 'r') as f:
+- cp.readfp(f)
++ cp.read_file(f)
+ r = {}
+ r['offsets'] = {}
+ offset = 0
+diff -uNrp a/ldoce5viewer/ldoce5/transform.py b/ldoce5viewer/ldoce5/transform.py
+--- a/ldoce5viewer/ldoce5/transform.py 2018-03-09 07:31:10.000000000 +0000
++++ b/ldoce5viewer/ldoce5/transform.py 2024-04-04 01:47:09.961908140 +0100
+@@ -6,7 +6,7 @@ This module generates HTML data from LDO
+ from __future__ import absolute_import
+ from __future__ import unicode_literals
+
+-from cgi import escape
++from html import escape
+
+ import lxml.etree as et
+
+diff -uNrp a/ldoce5viewer/qtgui/indexer.py b/ldoce5viewer/qtgui/indexer.py
+--- a/ldoce5viewer/qtgui/indexer.py 2018-03-09 07:31:10.000000000 +0000
++++ b/ldoce5viewer/qtgui/indexer.py 2024-04-04 01:46:04.610811106 +0100
+@@ -10,7 +10,7 @@ try:
+ import cPickle as pickle
+ except:
+ import pickle
+-from cgi import escape
++from html import escape
+ from struct import Struct
+ import traceback
+
+diff -uNrp a/ldoce5viewer/qtgui/ui/custom.py b/ldoce5viewer/qtgui/ui/custom.py
+--- a/ldoce5viewer/qtgui/ui/custom.py 2018-03-09 07:31:10.000000000 +0000
++++ b/ldoce5viewer/qtgui/ui/custom.py 2024-04-04 02:04:45.003621642 +0100
+@@ -83,10 +83,10 @@ class LineEdit(QLineEdit):
+ rect = self.rect()
+ self._buttonFind.move(
+ framewidth + 3 - 1,
+- (rect.height() - ICONSIZE) / 2 - 1)
++ (rect.height() - ICONSIZE) // 2 - 1)
+ self._buttonClear.move(
+ rect.width() - framewidth - 3 - ICONSIZE - 1,
+- (rect.height() - ICONSIZE) / 2 - 1)
++ (rect.height() - ICONSIZE) // 2 - 1)
+
+ def __onTextChanged(self, text):
+ self._buttonClear.setVisible(bool(text))
+@@ -147,7 +147,7 @@ class HtmlListWidget(QListWidget):
+ doc = self._doc
+ doc.setDefaultFont(option.font)
+ doc.setHtml('<body>MNmn012<span
class="p">012</span></body>')
+- height = doc.size().height() + self.MARGIN_V * 2
++ height = int(doc.size().height() + self.MARGIN_V * 2)
+ s = self._item_size = QSize(0, height)
+ return s
+