Skip to content

Commit

Permalink
Add support for PEP-660
Browse files Browse the repository at this point in the history
As with PEP-517 support, this is simply a shim over the setuptools
implementation added in setuptools v64.0.0 [1].

[1] pypa/setuptools#3488

Change-Id: I32f974db37e364cf634b050b40bf0820dce0a3a3
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
  • Loading branch information
stephenfin authored and cboylan committed Nov 1, 2023
1 parent 6df1643 commit 457a89f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
3 changes: 1 addition & 2 deletions doc/source/user/using.rst
Expand Up @@ -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``.

Expand Down
49 changes: 43 additions & 6 deletions pbr/build.py
Expand Up @@ -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
Expand All @@ -31,9 +31,14 @@
'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)

Expand All @@ -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,
)
5 changes: 5 additions & 0 deletions pbr/tests/test_packaging.py
Expand Up @@ -1023,6 +1023,11 @@ def test_pep_517_support(self):
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"]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml.future
Expand Up @@ -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 = ["."]

Expand Down

0 comments on commit 457a89f

Please sign in to comment.