forked from pool/python-ftfy
- 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
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 18 11:16:51 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
|
||||
|
||||
- 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 <dmueller@suse.com>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
40
update-wcwidth.patch
Normal file
40
update-wcwidth.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From 5d975c6bb1836d4a1abf0e44675a08f1a9321be9 Mon Sep 17 00:00:00 2001
|
||||
From: Elia Robyn Lake <elial@ec.ai>
|
||||
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=' '):
|
||||
Reference in New Issue
Block a user