Add support for PEP-660

As with PEP-517 support, this is simply a shim over the setuptools
implementation added in setuptools v64.0.0 [1].

[1] https://github.com/pypa/setuptools/pull/3488

Change-Id: I32f974db37e364cf634b050b40bf0820dce0a3a3
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2023-11-01 11:12:50 +00:00 committed by Clark Boylan
parent 6df16432aa
commit 457a89ffda
4 changed files with 50 additions and 9 deletions

View File

@ -46,10 +46,9 @@ Your build-system block in ``pyproject.toml`` will need to look something
like this::
[build-system]
requires = ["pbr>=5.7.0", "setuptools>=36.6.0"]
requires = ["pbr>=6.0.0", "setuptools>=64.0.0"]
build-backend = "pbr.build"
Eventually PBR may grow its own direct support for PEP517 build hooks, but
until then it will continue to need setuptools and ``setup.py``.

View File

@ -12,15 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
"""pep-517 support
"""PEP-517 / PEP-660 support
Add::
[build-system]
requires = ["pbr>=5.7.0", "setuptools>=36.6.0", "wheel"]
build-backend = "pbr.build"
[build-system]
requires = ["pbr>=6.0.0", "setuptools>=64.0.0"]
build-backend = "pbr.build"
to pyproject.toml to use this
to ``pyproject.toml`` to use this.
"""
from setuptools import build_meta
@ -31,9 +31,14 @@ __all__ = [
'prepare_metadata_for_build_wheel',
'build_wheel',
'build_sdist',
'build_editable',
'get_requires_for_build_editable',
'prepare_metadata_for_build_editable',
]
# PEP-517
def get_requires_for_build_wheel(config_settings=None):
return build_meta.get_requires_for_build_wheel(config_settings)
@ -53,9 +58,41 @@ def build_wheel(
metadata_directory=None,
):
return build_meta.build_wheel(
wheel_directory, config_settings, metadata_directory,
wheel_directory,
config_settings=config_settings,
metadata_directory=metadata_directory,
)
def build_sdist(sdist_directory, config_settings=None):
return build_meta.build_sdist(sdist_directory, config_settings)
# PEP-660
def build_editable(
wheel_directory,
config_settings=None,
metadata_directory=None,
):
return build_meta.build_editable(
wheel_directory,
config_settings=config_settings,
metadata_directory=metadata_directory,
)
def get_requires_for_build_editable(config_settings=None):
return build_meta.get_requires_for_build_editable(
config_settings=config_settings,
)
def prepare_metadata_for_build_editable(
metadata_directory,
config_settings=None,
):
return build_meta.prepare_metadata_for_build_editable(
metadata_directory,
config_settings=config_settings,
)

View File

@ -1023,6 +1023,11 @@ class TestPEP517Support(base.BaseTestCase):
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
"""),
# note that we use 36.6.0 rather than 64.0.0 since the
# latter doesn't support Python < 3.8 and we run our tests
# against Python 2.7 still. That's okay since we're not
# testing PEP-660 functionality here (which requires the
# newer setuptools)
'pyproject.toml': textwrap.dedent("""\
[build-system]
requires = ["pbr", "setuptools>=36.6.0", "wheel"]

View File

@ -4,7 +4,7 @@
# once we are more confident it works generally.
[build-system]
requires = ["setuptools>=36.6.0"]
requires = ["setuptools>=64.0.0"]
build-backend = "pbr.build"
backend-path = ["."]