diff options
author | Matt Clay <matt@mystile.com> | 2023-03-21 09:20:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 09:20:30 -0700 |
commit | 9f723d71230730a051f1a312fe4e7d0a43cd279c (patch) | |
tree | d1a107ba845d6cdcf2f1bc361257d77de2751ee7 /packaging | |
parent | 1f480324375d35328addd1e377635f370c3985e4 (diff) | |
download | ansible-9f723d71230730a051f1a312fe4e7d0a43cd279c.tar.gz |
[stable-2.14] 📦 Switch sdist build-system to pure setuptools (#80255) (#80261)
* [stable-2.14] 📦 Switch sdist build-system to pure setuptools (#80255)
This patch modifies the in-tree build backend to build sdists that swap
out pointers to it in the `pyproject.toml`'s `[build-system]` section.
The effect of this is that the first build from source (for example,
from a Git checkout) uses our PEP 517 in-tree build backend. But the
produced tarball has `build-backend` set to `setuptools.build_meta`
which is the native build backend of `setuptools`. So any following
builds from that sdist will skip using the in-tree build backend,
calling the setuptools' one.
The good news is that if the first build generated the manpages, they
will be included and won't go anywhere even though, a different build
system is in place.
Combined with #80253, this will make sure not to modify the current
source checkout on that first build.
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 7097df3eed979446830fc579613ffb9b7e7c19bf)
Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
* Make PEP 517 mutation tests use pinned old setuptools (#80262)
* Pin setuptools to lowest supported @ PEP 517 test
This allows catching the behavior of builds under old setuptools.
* Stop invoking `setup.py install` in tests
This is not the part we care about since it involves dealing with the
external runtime dependencies rather than building our source
distribution.
(cherry picked from commit eebfd71a6da396b011e664604c9991543205d780)
---------
Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/pep517_backend/_backend.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packaging/pep517_backend/_backend.py b/packaging/pep517_backend/_backend.py index 9c253296ff..d4d10f2364 100644 --- a/packaging/pep517_backend/_backend.py +++ b/packaging/pep517_backend/_backend.py @@ -3,6 +3,7 @@ from __future__ import annotations import os +import re import subprocess import sys import typing as t @@ -131,6 +132,19 @@ def build_sdist( # noqa: WPS210, WPS430 ) rst_in.unlink() + Path('pyproject.toml').write_text( + re.sub( + r"""(?x) + backend-path\s=\s\[ # value is a list of double-quoted strings + [^]]+ + ].*\n + build-backend\s=\s"[^"]+".*\n # value is double-quoted + """, + 'build-backend = "setuptools.build_meta"\n', + Path('pyproject.toml').read_text(), + ) + ) + built_sdist_basename = _setuptools_build_sdist( sdist_directory=sdist_directory, config_settings=config_settings, |