Skip to content

PEP517 in-tree build backend-path support in get-build-requires #1654

@nizox

Description

@nizox

Using tox 3.19, in-tree build with backend-path fails with:

.package start: get-build-requires /Users/nicolas/Workspaces/proj/.tox/.package
setting PATH=/Users/nicolas/Workspaces/proj/.tox/.package/bin:/Users/nicolas/.virtualenvs/proj-python3.8/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
[15159] /Users/nicolas/Workspaces/proj$ /Users/nicolas/Workspaces/proj/.tox/.package/bin/python /Users/nicolas/.virtualenvs/proj-python3.8/lib/python3.8/site-packages/tox/helper/build_requires.py build_package '' >.tox/.package/log/.package-0.log
ERROR: invocation failed (exit code 1), logfile: /Users/nicolas/Workspaces/proj/.tox/.package/log/.package-0.log
=================================================================================== log start ====================================================================================
Traceback (most recent call last):
  File "/Users/nicolas/.virtualenvs/proj-python3.8/lib/python3.8/site-packages/tox/helper/build_requires.py", line 7, in <module>
    backend = __import__(backend_spec, fromlist=["_trash"])
ModuleNotFoundError: No module named 'build_package'

pyproject.toml content is:

[build-system]
requires = [
  "setuptools >= 40.9.0",
  "wheel",
]
build-backend = "build_package"
backend-path = ["scripts"]

A quick patch of tox/helper/build_requires.py to use the backend paths similarly to tox/helper/build_isolated.py fixes the issue. I can do a PR but the patch duplicates the _ensure_module_in_paths function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:normalaffects many people or has quite an impactpr-merged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions