Skip to content

Commit e1c33c6

Browse files
mceplbmwiedemann
authored andcommitted
Update python-build to version 0.10.0 / rev 9 via SR 1085246
https://build.opensuse.org/request/show/1085246 by user mcepl + dimstar_suse - Renamed patches support-pip-23.patch and support-tarfile-data-filter.patch to 589-colorized-pip23.patch (gh#pypa/build#589) and 609-filter-out-malicious.patch (gh#pypa/build#609), respectively. - 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.
1 parent 6d00dcd commit e1c33c6

File tree

6 files changed

+152
-4
lines changed

6 files changed

+152
-4
lines changed

packages/p/python-build/.files

131 Bytes
Binary file not shown.

packages/p/python-build/.rev

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,19 @@
7272
<comment></comment>
7373
<requestid>1081973</requestid>
7474
</revision>
75+
<revision rev="9" vrev="3">
76+
<srcmd5>e9492ccd1f3bf09e87b432b88d3e99f0</srcmd5>
77+
<version>0.10.0</version>
78+
<time>1684490108</time>
79+
<user>dimstar_suse</user>
80+
<comment>- Renamed patches support-pip-23.patch and
81+
support-tarfile-data-filter.patch to 589-colorized-pip23.patch
82+
(gh#pypa/build#589) and 609-filter-out-malicious.patch
83+
(gh#pypa/build#609), respectively.
84+
- Add patch support-pip-23.patch:
85+
* pip 23 also colorizes output, confusing the test.
86+
- Add patch support-tarfile-data-filter.patch:
87+
* Set tarfile.data_filter if available.</comment>
88+
<requestid>1085246</requestid>
89+
</revision>
7590
</revisionlist>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From 4f5362fccc908820574fdbac2f6b6871c0f371c5 Mon Sep 17 00:00:00 2001
2+
From: Henry Schreiner <[email protected]>
3+
Date: Wed, 15 Mar 2023 09:33:53 -0400
4+
Subject: [PATCH] tests: strip formatting from stderr (pip 23)
5+
6+
Signed-off-by: Henry Schreiner <[email protected]>
7+
---
8+
tests/test_main.py | 8 ++++++--
9+
1 file changed, 6 insertions(+), 2 deletions(-)
10+
11+
diff --git a/tests/test_main.py b/tests/test_main.py
12+
index e924d8bd..456ff749 100644
13+
--- a/tests/test_main.py
14+
+++ b/tests/test_main.py
15+
@@ -20,6 +20,8 @@
16+
cwd = os.getcwd()
17+
out = os.path.join(cwd, 'dist')
18+
19+
+ANSI_STRIP = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
20+
+
21+
22+
@pytest.mark.parametrize(
23+
('cli_args', 'build_args', 'hook'),
24+
@@ -368,8 +370,10 @@ def test_output_env_subprocess_error(
25+
assert stdout[:4] == stdout_body
26+
assert stdout[-1].startswith(stdout_error)
27+
28+
- assert len(stderr) == 1
29+
- assert stderr[0].startswith('ERROR: Invalid requirement: ')
30+
+ # Newer versions of pip also color stderr - strip them if present
31+
+ cleaned_stderr = ANSI_STRIP.sub('', '\n'.join(stderr)).strip()
32+
+ assert len(cleaned_stderr.splitlines()) == 1
33+
+ assert cleaned_stderr.startswith('ERROR: Invalid requirement: ')
34+
35+
36+
@pytest.mark.parametrize(
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
From 083fde33e7593d8ff9add04bd4d237a3ddcbfe44 Mon Sep 17 00:00:00 2001
2+
From: layday <[email protected]>
3+
Date: Fri, 28 Apr 2023 15:22:53 +0300
4+
Subject: [PATCH] main: filter out malicious files when extracting tar archives
5+
6+
See https://peps.python.org/pep-0706/.
7+
---
8+
src/build/__main__.py | 5 +++--
9+
src/build/util.py | 14 +++++++++++++-
10+
2 files changed, 16 insertions(+), 3 deletions(-)
11+
12+
--- a/src/build/__main__.py
13+
+++ b/src/build/__main__.py
14+
@@ -9,7 +9,6 @@ import platform
15+
import shutil
16+
import subprocess
17+
import sys
18+
-import tarfile
19+
import tempfile
20+
import textwrap
21+
import traceback
22+
@@ -228,6 +227,8 @@ def build_package_via_sdist(
23+
:param isolation: Isolate the build in a separate environment
24+
:param skip_dependency_check: Do not perform the dependency check
25+
"""
26+
+ from .util import TarFile
27+
+
28+
if 'sdist' in distributions:
29+
raise ValueError('Only binary distributions are allowed but sdist was specified')
30+
31+
@@ -238,7 +239,7 @@ def build_package_via_sdist(
32+
sdist_out = tempfile.mkdtemp(prefix='build-via-sdist-')
33+
built: list[str] = []
34+
# extract sdist
35+
- with tarfile.open(sdist) as t:
36+
+ with TarFile.open(sdist) as t:
37+
t.extractall(sdist_out)
38+
try:
39+
builder = _ProjectBuilder(os.path.join(sdist_out, sdist_name[: -len('.tar.gz')]))
40+
--- a/src/build/util.py
41+
+++ b/src/build/util.py
42+
@@ -5,6 +5,7 @@ from __future__ import annotations
43+
import os
44+
import pathlib
45+
import sys
46+
+import tarfile
47+
import tempfile
48+
49+
import pyproject_hooks
50+
@@ -56,6 +57,17 @@ def project_wheel_metadata(
51+
return _project_wheel_metadata(builder)
52+
53+
54+
+# Per https://peps.python.org/pep-0706/, the "data" filter will become
55+
+# the default in Python 3.14.
56+
+if sys.version_info >= (3, 12) and sys.version_info < (3, 14):
57+
+
58+
+ class TarFile(tarfile.TarFile):
59+
+ extraction_filter = tarfile.data_filter
60+
+
61+
+else:
62+
+ TarFile = tarfile.TarFile
63+
+
64+
+
65+
__all__ = [
66+
- 'project_wheel_metadata',
67+
+ 'project_wheel_metadata', 'TarFile',
68+
]

packages/p/python-build/python-build.changes

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
-------------------------------------------------------------------
2+
Sat May 6 16:59:52 UTC 2023 - Matej Cepl <[email protected]>
3+
4+
- Renamed patches support-pip-23.patch and
5+
support-tarfile-data-filter.patch to 589-colorized-pip23.patch
6+
and 609-filter-out-malicious.patch, respectively.
7+
8+
-------------------------------------------------------------------
9+
Tue May 2 10:52:23 UTC 2023 - Ben Greiner <[email protected]>
10+
11+
- Remove support-tarfile-data-filter.patch: better documentation
12+
required, preferable supported through upstream
13+
* gh#pypa/build#609
14+
* ignore the DeprecationWarning instead
15+
16+
-------------------------------------------------------------------
17+
Tue May 2 08:04:24 UTC 2023 - Steve Kowalik <[email protected]>
18+
19+
- Add patch support-pip-23.patch:
20+
* pip 23 also colorizes output, confusing the test.
21+
- Add patch support-tarfile-data-filter.patch:
22+
* Set tarfile.data_filter if available.
23+
124
-------------------------------------------------------------------
225
Fri Apr 21 12:22:56 UTC 2023 - Dirk Müller <[email protected]>
326

packages/p/python-build/python-build.spec

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,24 @@
2727
# wheeldir of name build does not work well with this packagename gh#openSUSE/python-rpm-macros#157
2828
%define _pyproject_wheeldir distwheel
2929

30-
%define skip_python2 1
3130
%{?sle15_python_module_pythons}
3231
Name: python-build%{psuffix}
3332
Version: 0.10.0
3433
Release: 0
3534
Summary: Simple PEP517 package builder
3635
License: MIT
37-
Group: Development/Languages/Python
3836
URL: https://github.com/pypa/build
3937
Source0: https://github.com/pypa/build/archive/%{version}.tar.gz#/build-%{version}.tar.gz
4038
# Needs the wheels for wheel, flit-core, pytoml, and tomli for testing
4139
Source10: https://files.pythonhosted.org/packages/py2.py3/w/wheel/wheel-0.37.1-py2.py3-none-any.whl
4240
Source11: https://files.pythonhosted.org/packages/py3/f/flit-core/flit_core-3.8.0-py3-none-any.whl
4341
Source12: https://files.pythonhosted.org/packages/py3/t/tomli/tomli-2.0.1-py3-none-any.whl
42+
# PATCH-FIX-UPSTREAM 589-colorized-pip23.patch gh#pypa/build#587 [email protected]
43+
# Different style of colouring in pip 23 (actually I see it even with pip 22)
44+
Patch0: 589-colorized-pip23.patch
45+
# PATCH-FIX-UPSTREAM 609-filter-out-malicious.patch gh#pypa/build!609 [email protected]
46+
# With new tarfile filters, there is now new warning
47+
Patch1: 609-filter-out-malicious.patch
4448
BuildRequires: %{python_module base >= 3.7}
4549
BuildRequires: %{python_module flit-core >= 3.4}
4650
BuildRequires: %{python_module pip}
@@ -75,6 +79,8 @@ It is a simple build tool and does not perform any dependency management.
7579

7680
%prep
7781
%autosetup -p1 -n build-%{version}
82+
# until we have gh#pypa/build#609
83+
sed -i '/"error",/ a \ "ignore::DeprecationWarning:tarfile",' pyproject.toml
7884

7985
%if !%{with test}
8086
%build
@@ -92,7 +98,7 @@ mkdir -p wheels
9298
cp %{SOURCE10} %{SOURCE11} %{SOURCE12} wheels/
9399
export PIP_FIND_LINKS="%{python3_sitelib}/../wheels $PWD/wheels"
94100
pushd tests
95-
%pytest -n auto -x
101+
%pytest -n auto
96102
popd
97103
%endif
98104

@@ -108,7 +114,7 @@ popd
108114
%license LICENSE
109115
%python_alternative %{_bindir}/pyproject-build
110116
%{python_sitelib}/build
111-
%{python_sitelib}/build-%{version}*-info
117+
%{python_sitelib}/build-%{version}.dist-info
112118
%endif
113119

114120
%changelog

0 commit comments

Comments
 (0)