From 014ebb2a4a011bc0e56a9329d547aa8b25cc5c8f55a94213966fee9748796120 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 2 May 2023 08:05:44 +0000 Subject: [PATCH] - 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 --- python-build.changes | 8 +++++++ python-build.spec | 5 ++++- support-pip-23.patch | 36 +++++++++++++++++++++++++++++++ support-tarfile-data-filter.patch | 12 +++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 support-pip-23.patch create mode 100644 support-tarfile-data-filter.patch diff --git a/python-build.changes b/python-build.changes index 03d2a49..e012442 100644 --- a/python-build.changes +++ b/python-build.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue May 2 08:04:24 UTC 2023 - Steve Kowalik + +- 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 diff --git a/python-build.spec b/python-build.spec index 7af6423..651671a 100644 --- a/python-build.spec +++ b/python-build.spec @@ -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} diff --git a/support-pip-23.patch b/support-pip-23.patch new file mode 100644 index 0000000..0089f10 --- /dev/null +++ b/support-pip-23.patch @@ -0,0 +1,36 @@ +From b52fdbd70550a9ef58e65b3376cec1e9951d2114 Mon Sep 17 00:00:00 2001 +From: Henry Schreiner +Date: Wed, 15 Mar 2023 09:33:53 -0400 +Subject: [PATCH] tests: strip formatting from stderr (pip 23) + +Signed-off-by: Henry Schreiner +--- + 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( diff --git a/support-tarfile-data-filter.patch b/support-tarfile-data-filter.patch new file mode 100644 index 0000000..c9d98c6 --- /dev/null +++ b/support-tarfile-data-filter.patch @@ -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')]))