From 6f75f512dd7f3272475c508fd055d664d466edbcbea88401aa2e6e054d3a608f Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Thu, 18 Jan 2024 11:17:29 +0000 Subject: [PATCH] - Add update-wcwidth.patch to make it work with newer wcwidth, gh#rspeer/python-ftfy@5d975c6bb183 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-ftfy?expand=0&rev=18 --- python-ftfy.changes | 6 ++++++ python-ftfy.spec | 16 ++++++++++------ update-wcwidth.patch | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 update-wcwidth.patch diff --git a/python-ftfy.changes b/python-ftfy.changes index 0c07671..6744335 100644 --- a/python-ftfy.changes +++ b/python-ftfy.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jan 18 11:16:51 UTC 2024 - Daniel Garcia + +- Add update-wcwidth.patch to make it work with newer wcwidth, + gh#rspeer/python-ftfy@5d975c6bb183 + ------------------------------------------------------------------- Sat Jan 15 17:46:05 UTC 2022 - Dirk Müller diff --git a/python-ftfy.spec b/python-ftfy.spec index e11572d..f73eec4 100644 --- a/python-ftfy.spec +++ b/python-ftfy.spec @@ -1,7 +1,7 @@ # # spec file for package python-ftfy # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,7 +16,6 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-ftfy Version: 6.0.3 @@ -25,7 +24,11 @@ Summary: Python module for repairing mis-decoded Unicode text License: MIT URL: https://github.com/rspeer/python-ftfy Source: https://github.com/rspeer/python-ftfy/archive/refs/tags/v%{version}.tar.gz +# PATCH-FIX-UPSTREAM update-wcwidth.patch gh#rspeer/python-ftfy@5d975c6bb183 +Patch1: update-wcwidth.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-wcwidth @@ -43,13 +46,13 @@ Ftfy attempts to repair Unicode text that has been erroneously put through an encode/decode cycle with different encodings. %prep -%setup -q -n python-ftfy-%{version} +%autosetup -p1 -n python-ftfy-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/ftfy %python_expand %fdupes %{buildroot}%{$python_sitelib} @@ -71,6 +74,7 @@ export PATH="build/testbin:$PATH" %doc CHANGELOG.md README.md %license LICENSE.txt %python_alternative %{_bindir}/ftfy -%{python_sitelib}/* +%{python_sitelib}/ftfy +%{python_sitelib}/ftfy-%{version}*-info %changelog diff --git a/update-wcwidth.patch b/update-wcwidth.patch new file mode 100644 index 0000000..05e44ba --- /dev/null +++ b/update-wcwidth.patch @@ -0,0 +1,40 @@ +From 5d975c6bb1836d4a1abf0e44675a08f1a9321be9 Mon Sep 17 00:00:00 2001 +From: Elia Robyn Lake +Date: Tue, 21 Nov 2023 18:40:17 -0500 +Subject: [PATCH] update wcwidth + +--- + ftfy/formatting.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +Index: python-ftfy-6.0.3/ftfy/formatting.py +=================================================================== +--- python-ftfy-6.0.3.orig/ftfy/formatting.py ++++ python-ftfy-6.0.3/ftfy/formatting.py +@@ -28,7 +28,7 @@ def character_width(char: str) -> int: + >>> character_width('\n') + -1 + """ +- return wcwidth(char) ++ return int(wcwidth(char)) + + + def monospaced_width(text: str) -> int: +@@ -47,7 +47,7 @@ def monospaced_width(text: str) -> int: + >>> len('ちゃぶ台返し') + 6 + >>> monospaced_width('owl\N{SOFT HYPHEN}flavored') +- 12 ++ 11 + >>> monospaced_width('example\x80') + -1 + +@@ -70,7 +70,7 @@ def monospaced_width(text: str) -> int: + # + # Remove terminal escapes before calculating width, because if they are + # displayed as intended, they will have zero width. +- return wcswidth(remove_terminal_escapes(normalize('NFC', text))) ++ return int(wcswidth(remove_terminal_escapes(normalize("NFC", text)))) + + + def display_ljust(text, width, fillchar=' '):