- Add patch support-pip-23.patch:

* pip 23 also colorizes output, confusing the test.
- Add patch support-tarfile-data-filter.patch:
  * Set tarfile.data_filter if available.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-build?expand=0&rev=19
This commit is contained in:
Steve Kowalik 2023-05-02 08:05:44 +00:00 committed by Git OBS Bridge
parent c855ac5788
commit 014ebb2a4a
4 changed files with 60 additions and 1 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue May 2 08:04:24 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-pip-23.patch:
* pip 23 also colorizes output, confusing the test.
- Add patch support-tarfile-data-filter.patch:
* Set tarfile.data_filter if available.
-------------------------------------------------------------------
Fri Apr 21 12:22:56 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -34,13 +34,16 @@ Version: 0.10.0
Release: 0
Summary: Simple PEP517 package builder
License: MIT
Group: Development/Languages/Python
URL: https://github.com/pypa/build
Source0: https://github.com/pypa/build/archive/%{version}.tar.gz#/build-%{version}.tar.gz
# Needs the wheels for wheel, flit-core, pytoml, and tomli for testing
Source10: https://files.pythonhosted.org/packages/py2.py3/w/wheel/wheel-0.37.1-py2.py3-none-any.whl
Source11: https://files.pythonhosted.org/packages/py3/f/flit-core/flit_core-3.8.0-py3-none-any.whl
Source12: https://files.pythonhosted.org/packages/py3/t/tomli/tomli-2.0.1-py3-none-any.whl
# PATCH-FIX-UPSTREAM gh#pypa/build#b52fdbd70550a9ef58e65b3376cec1e9951d2114
Patch0: support-pip-23.patch
# PATCH-FIX-OPENSUSE Support new tarfile data_filter
Patch1: support-tarfile-data-filter.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module flit-core >= 3.4}
BuildRequires: %{python_module pip}

36
support-pip-23.patch Normal file
View File

@ -0,0 +1,36 @@
From b52fdbd70550a9ef58e65b3376cec1e9951d2114 Mon Sep 17 00:00:00 2001
From: Henry Schreiner <henryschreineriii@gmail.com>
Date: Wed, 15 Mar 2023 09:33:53 -0400
Subject: [PATCH] tests: strip formatting from stderr (pip 23)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
---
tests/test_main.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/test_main.py b/tests/test_main.py
index e924d8bd..456ff749 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -20,6 +20,8 @@
cwd = os.getcwd()
out = os.path.join(cwd, 'dist')
+ANSI_STRIP = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
+
@pytest.mark.parametrize(
('cli_args', 'build_args', 'hook'),
@@ -368,8 +370,10 @@ def test_output_env_subprocess_error(
assert stdout[:4] == stdout_body
assert stdout[-1].startswith(stdout_error)
- assert len(stderr) == 1
- assert stderr[0].startswith('ERROR: Invalid requirement: ')
+ # Newer versions of pip also color stderr - strip them if present
+ cleaned_stderr = ANSI_STRIP.sub('', '\n'.join(stderr)).strip()
+ assert len(cleaned_stderr.splitlines()) == 1
+ assert cleaned_stderr.startswith('ERROR: Invalid requirement: ')
@pytest.mark.parametrize(

View File

@ -0,0 +1,12 @@
Index: build-0.10.0/src/build/__main__.py
===================================================================
--- build-0.10.0.orig/src/build/__main__.py
+++ build-0.10.0/src/build/__main__.py
@@ -239,6 +239,7 @@ def build_package_via_sdist(
built: list[str] = []
# extract sdist
with tarfile.open(sdist) as t:
+ t.extraction_filter = getattr(tarfile, 'data_filter', (lambda m, path: m))
t.extractall(sdist_out)
try:
builder = _ProjectBuilder(os.path.join(sdist_out, sdist_name[: -len('.tar.gz')]))