From 646c68d5a9732041953037c10b2cd8c69ca9fc11b4110ce8b8b6ffcb65e3c297 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 17 Dec 2020 22:07:37 +0000 Subject: [PATCH] Accepting request 856709 from home:bnavigator:branches:devel:languages:python - Add remove-unused-import.patch to work with importlib_metadata OBS-URL: https://build.opensuse.org/request/show/856709 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-build?expand=0&rev=3 --- python-build.changes | 5 +++++ python-build.spec | 25 +++++++++++++++++++------ remove-unused-import.patch | 20 ++++++++++++++++++++ 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 remove-unused-import.patch diff --git a/python-build.changes b/python-build.changes index e8fc2fc..b5dd6aa 100644 --- a/python-build.changes +++ b/python-build.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Dec 17 14:52:54 UTC 2020 - Benjamin Greiner + +- Add remove-unused-import.patch to work with importlib_metadata + ------------------------------------------------------------------- Fri Nov 13 11:14:24 UTC 2020 - John Vandenberg diff --git a/python-build.spec b/python-build.spec index 6346f64..5819d98 100644 --- a/python-build.spec +++ b/python-build.spec @@ -17,6 +17,8 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +# TW defined --without python2 +%bcond_without python2 Name: python-build Version: 0.1.0 Release: 0 @@ -25,25 +27,36 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/pypa/build Source: https://github.com/pypa/build/archive/%{version}.tar.gz#/build-%{version}.tar.gz +# PATCH-FIX-UPSTREAM remove-unused-import.patch -- remove unused import https://github.com/pypa/build/commit/efa3710 +Patch0: remove-unused-import.patch +BuildRequires: %{python_module packaging} +BuildRequires: %{python_module pep517 >= 0.9} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module toml} BuildRequires: fdupes BuildRequires: python-rpm-macros +%if %{with python2} +BuildRequires: python-typing +BuildRequires: python-virtualenv >= 20.0.35 +%endif +BuildRequires: (python3-importlib_metadata if python3-base < 3.8) +BuildRequires: (python36-importlib_metadata if python36-base) Requires: python-packaging Requires: python-pep517 >= 0.9 Requires: python-toml +Requires: (python-importlib_metadata if python-base < 3.8) +%ifpython2 Requires: python-typing +Requires: python-virtualenv >= 20.0.35 +%endif Requires(post): update-alternatives Requires(postun): update-alternatives BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module filelock} -BuildRequires: %{python_module packaging} -BuildRequires: %{python_module pep517 >= 0.9} BuildRequires: %{python_module pytest-mock} +BuildRequires: %{python_module pytest-xdist} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module toml} -BuildRequires: %{python_module typing} -BuildRequires: %{python_module virtualenv} # /SECTION %python_subpackages @@ -51,7 +64,7 @@ BuildRequires: %{python_module virtualenv} Simple PEP517 package builder. %prep -%setup -q -n build-%{version} +%autosetup -p1 -n build-%{version} %build %python_build diff --git a/remove-unused-import.patch b/remove-unused-import.patch new file mode 100644 index 0000000..a533dbe --- /dev/null +++ b/remove-unused-import.patch @@ -0,0 +1,20 @@ +Index: build-0.1.0/tests/test_projectbuilder.py +=================================================================== +--- build-0.1.0.orig/tests/test_projectbuilder.py ++++ build-0.1.0/tests/test_projectbuilder.py +@@ -13,15 +13,10 @@ import pytest + import build + + if sys.version_info >= (3, 8): # pragma: no cover +- import email + from importlib import metadata as importlib_metadata +- +- email_message_from_string = email.message_from_string + else: # pragma: no cover + import importlib_metadata + +- email_message_from_string = importlib_metadata._compat.email_message_from_string +- + if sys.version_info >= (3,): # pragma: no cover + build_open_owner = 'builtins' + else: # pragma: no cover