- Add patch remove-pkg_resources.patch:

* Use importlib.metadata rather than pkg_resources.
- Since importlib.metadata is not as a stickler as pkg_resources is, remove
  multibuild.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-wcwidth?expand=0&rev=35
This commit is contained in:
Steve Kowalik 2022-07-18 13:41:20 +00:00 committed by Git OBS Bridge
parent 608e598ab1
commit 0faec7d1b8
4 changed files with 66 additions and 25 deletions

View File

@ -1,3 +0,0 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Jul 18 13:40:16 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch remove-pkg_resources.patch:
* Use importlib.metadata rather than pkg_resources.
- Since importlib.metadata is not as a stickler as pkg_resources is, remove
multibuild.
-------------------------------------------------------------------
Wed Jun 2 08:42:23 UTC 2021 - Christophe Giboudeaux <christophe@krop.fr>

View File

@ -1,7 +1,7 @@
#
# spec file for package python
# spec file for package python-wcwidth
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,33 +17,24 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -%{flavor}
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%bcond_without python2
Name: python-wcwidth%{psuffix}
Name: python-wcwidth
Version: 0.2.5
Release: 0
Summary: Number of Terminal column cells of wide-character codes
License: MIT
URL: https://github.com/jquast/wcwidth
Source: https://github.com/jquast/wcwidth/archive/%{version}.tar.gz#/wcwidth-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#jquast/wcwidth#62
Patch0: remove-pkg_resources.patch
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module wcwidth >= %{version}}
%if %{with python2}
BuildRequires: python-backports.functools_lru_cache >= 1.2.1
%endif
%endif
%ifpython2
Requires: python-backports.functools_lru_cache >= 1.2.1
%endif
@ -63,7 +54,7 @@ commonly many releases older than the most current Unicode Standard
release files, which this project aims to track.
%prep
%setup -q -n wcwidth-%{version}
%autosetup -p1 -n wcwidth-%{version}
sed -i 's/--cov[-=a-z]*//g' tox.ini
# this option is nonsense
sed -i 's/looponfailroots.*//' tox.ini
@ -72,21 +63,15 @@ sed -i 's/looponfailroots.*//' tox.ini
%python_build
%install
%if ! %{with test}
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%check
%if %{with test}
%pytest tests
%endif
%if ! %{with test}
%files %{python_files}
%license LICENSE
%doc docs/intro.rst
%{python_sitelib}/*
%endif
%changelog

View File

@ -0,0 +1,51 @@
Index: wcwidth-0.2.5/tests/test_core.py
===================================================================
--- wcwidth-0.2.5.orig/tests/test_core.py
+++ wcwidth-0.2.5/tests/test_core.py
@@ -1,7 +1,10 @@
# coding: utf-8
"""Core tests for wcwidth module."""
# 3rd party
-import pkg_resources
+try:
+ import importlib.metadata as importmeta
+except ImportError:
+ import importlib_metadata as importmeta
# local
import wcwidth
@@ -10,7 +13,7 @@ import wcwidth
def test_package_version():
"""wcwidth.__version__ is expected value."""
# given,
- expected = pkg_resources.get_distribution('wcwidth').version
+ expected = importmeta.version('wcwidth')
# exercise,
result = wcwidth.__version__
Index: wcwidth-0.2.5/tests/test_ucslevel.py
===================================================================
--- wcwidth-0.2.5.orig/tests/test_ucslevel.py
+++ wcwidth-0.2.5/tests/test_ucslevel.py
@@ -6,7 +6,6 @@ import warnings
# 3rd party
import pytest
-import pkg_resources
# local
import wcwidth
Index: wcwidth-0.2.5/setup.py
===================================================================
--- wcwidth-0.2.5.orig/setup.py
+++ wcwidth-0.2.5/setup.py
@@ -52,7 +52,8 @@ def main():
author='Jeff Quast',
author_email='contact@jeffquast.com',
install_requires=('backports.functools-lru-cache>=1.2.1;'
- 'python_version < "3.2"'),
+ 'python_version < "3.2"',
+ 'importlib_metadata;python_version < "3.8"'),
license='MIT',
packages=['wcwidth'],
url='https://github.com/jquast/wcwidth',