From 170058e25d61a741b8a14f1343cd4463de4db16f Mon Sep 17 00:00:00 2001 From: Shawn Wang Date: Sat, 8 Apr 2023 23:22:27 +0800 Subject: [PATCH] Optimize the spec file Signed-off-by: Shawn Wang --- python-wcwidth.spec | 74 ++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/python-wcwidth.spec b/python-wcwidth.spec index 21ee3e3..326e614 100644 --- a/python-wcwidth.spec +++ b/python-wcwidth.spec @@ -1,46 +1,62 @@ -%define anolis_release 1 +%define anolis_release 2 %bcond_without tests - %global pypi_name wcwidth Name: python-%{pypi_name} Version: 0.2.6 Release: %{anolis_release}%{?dist} -Summary: Measures number of Terminal column cells of wide-character codes - +Summary: Python library that measures the width of unicode strings rendered to a terminal License: MIT URL: https://github.com/jquast/wcwidth Source0: %pypi_source BuildArch: noarch %description -This API is mainly for Terminal Emulator implementors, or those writing programs -that expect to interpreted by a terminal emulator and wish to determine the -printable width of a string on a Terminal. +This library is mainly for CLI programs that carefully produce output for +Terminals, or make pretend to be an emulator. + +Problem Statement: The printable length of most strings are equal to the number +of cells they occupy on the screen 1 character : 1 cell. However, there are +categories of characters that occupy 2 cells (full-wide), and others that +occupy 0 cells (zero-width). + +Solution: POSIX.1-2001 and POSIX.1-2008 conforming systems provide wcwidth(3) +and wcswidth(3) C functions of which this python module’s functions precisely +copy. These functions return the number of cells a unicode string is expected +to occupy. -%package -n python3-%{pypi_name} +%package -n python%{python3_pkgversion}-%{pypi_name} Summary: %{summary} -BuildRequires: python3-devel -BuildRequires: python3-setuptools +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools %if %{with tests} -BuildRequires: python3-pytest +BuildRequires: python%{python3_pkgversion}-pytest %endif -%{?python_provide:%python_provide python3-%{pypi_name}} +%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} -%description -n python3-%{pypi_name} -This API is mainly for Terminal Emulator implementors, or those writing programs -that expect to interpreted by a terminal emulator and wish to determine the -printable width of a string on a Terminal. +%description -n python%{python3_pkgversion}-%{pypi_name} +This library is mainly for CLI programs that carefully produce output for +Terminals, or make pretend to be an emulator. -%package -n python3-%{pypi_name}-doc -Summary: doc files for python3-%{pypi_name}. -Requires: python3-%{pypi_name} = %{version}-%{release} +Problem Statement: The printable length of most strings are equal to the number +of cells they occupy on the screen 1 character : 1 cell. However, there are +categories of characters that occupy 2 cells (full-wide), and others that +occupy 0 cells (zero-width). -%description -n python3-%{pypi_name}-doc -doc files for python3-%{pypi_name}. +Solution: POSIX.1-2001 and POSIX.1-2008 conforming systems provide wcwidth(3) +and wcswidth(3) C functions of which this python module’s functions precisely +copy. These functions return the number of cells a unicode string is expected +to occupy. + +%package -n python%{python3_pkgversion}-%{pypi_name}-doc +Summary: Documentation files for python%{python3_pkgversion}-%{pypi_name}. +Requires: python%{python3_pkgversion}-%{pypi_name} = %{version}-%{release} + +%description -n python%{python3_pkgversion}-%{pypi_name}-doc +Documentation files for python%{python3_pkgversion}-%{pypi_name}. %prep -%setup -q -n %{pypi_name}-%{version} +%autosetup -n %{pypi_name}-%{version} %generate_buildrequires %pyproject_buildrequires @@ -50,21 +66,23 @@ doc files for python3-%{pypi_name}. %install %pyproject_install +%pyproject_save_files %{pypi_name} %if %{with tests} %check -%{__python3} -m pytest -v +%pytest %endif -%files -n python3-%{pypi_name} +%files -n python%{python3_pkgversion}-%{pypi_name} -f %{pyproject_files} %license LICENSE -%{python3_sitelib}/%{pypi_name} -%{python3_sitelib}/%{pypi_name}-%{version}.dist-info/ -%files -n python3-%{pypi_name}-doc -%doc README.rst +%files -n python%{python3_pkgversion}-%{pypi_name}-doc +%doc README.rst DESIGN.rst %changelog +* Sat Apr 08 2023 Shawn Wang - 0.2.6-2 +- Optimize the spec file + * Thu Feb 23 2023 mgb01105731 - 0.2.6-1 - update to version 0.2.6 -- Gitee