1+ # not all test dependencies are included in RHEL: filelock, pytest-mock
2+ %bcond tests %{undefined rhel}
3+ # uv has many build dependencies which are not included in RHEL;
4+ # virtualenv is not included in RHEL
5+ %bcond extras %{undefined rhel}
6+
7+ %global pypi_name build
8+
9+ Name: python-%{pypi_name }
10+ Version: 1.4.2
11+ Release: 1%{?dist }
12+ Summary: A simple, correct PEP517 package builder
13+ Vendor: Microsoft Corporation
14+ Distribution: Azure Linux
15+
16+ License: MIT
17+ URL: https://github.com/pypa/build
18+ Source0: %{url }/archive/%{version }/%{pypi_name }-%{version }.tar.gz
19+
20+ # downstream-only
21+ #Patch: 0001-fedora-disable-some-build-requirements.patch
22+
23+ BuildArch: noarch
24+
25+ BuildRequires: python3-devel
26+ BuildRequires: python3-pip
27+ BuildRequires: python3-flit-core
28+ BuildRequires: python3-wheel
29+ BuildRequires: python3-pyproject-hooks
30+ BuildRequires: pyproject-rpm-macros >= 0-41
31+ %if %{with tests }
32+ BuildRequires: python3dist(pytest)
33+ BuildRequires: python3dist(pytest-mock)
34+ BuildRequires: python3dist(filelock)
35+ %endif
36+
37+ %description
38+ A simple, correct PEP517 package builder.
39+
40+
41+ %package -n python3-%{pypi_name }
42+ Summary: %{summary }
43+
44+ %description -n python3-%{pypi_name }
45+ A simple, correct PEP517 package builder.
46+
47+
48+ # Even --without extras, we still build the extras in ELN
49+ # to make it available in ELN Extras (e.g. tox).
50+ # Note that due to technical limitations,
51+ # we must *not* generate their runtime deps as BuildRequires
52+ # or else they are pulled into ELN proper (not ELN Extras).
53+ # https://github.com/fedora-eln/eln/issues/309
54+ %if %{with extras } || %{defined eln }
55+ %pyproject_extras_subpkg -n python3-%{pypi_name } virtualenv uv
56+ %endif
57+
58+ %prep
59+ %autosetup -p1 -n %{pypi_name }-%{version }
60+
61+ # flit-core in this buildroot expects PEP 621 license as a table.
62+ if grep -qE '^license *= *"[^"]+"' pyproject.toml; then
63+ sed -E -i 's/^license *= *"([^"]+)"/license = {text = "\1"}/' pyproject.toml
64+ fi
65+
66+ # Add the 'flaky' marker used in upstream tests but not declared in pyproject.toml.
67+ sed -i '/^markers = \[/a\ "flaky",' pyproject.toml
68+
69+ # When building as root, file-permission checks are bypassed; skip the
70+ # PermissionError branch of test_init to avoid a spurious DID NOT RAISE failure.
71+ sed -i "s/if not sys.platform.startswith('win'):/if not sys.platform.startswith('win') and os.getuid() != 0:/" \
72+ tests/test_projectbuilder.py
73+
74+ %generate_buildrequires
75+ %if %{with tests }
76+ %pyproject_buildrequires -R
77+ %else
78+ %pyproject_buildrequires
79+ %endif
80+
81+ %build
82+ %pyproject_wheel
83+ %install
84+ %pyproject_install
85+ %pyproject_save_files %{pypi_name }
86+
87+ %check
88+ %pyproject_check_import
89+ %if %{with tests }
90+ # Upstream has integration tests that can be run with the --run-integration
91+ # flag, but currently that only includes one network test and one test that is
92+ # xfail when flit-core is installed (which it will be during our package
93+ # build), so including that flag doesn't run any additional tests.
94+ %pytest -v -m " not network"
95+ %endif
96+
97+ %files -n python3-%{pypi_name } -f %{pyproject_files }
98+ %license LICENSE
99+ %doc README.md
100+ %{_bindir }/pyproject-build
101+
102+ %changelog
103+ * Sat Apr 4 2026 Akarsh Chaudhary < v-akarshc@microsoft.com> - 1.4.2-1
104+ - Initial CBL-Mariner import from Fedora 44 (license: MIT).
105+ - License verified
0 commit comments