Skip to content

build-system.requires ignored for tool.poetry.build.script #8807

@cavedon

Description

@cavedon
  • Poetry version: 1.7.1

  • Python version: 3.10.12

  • OS version and name: Ubuntu 22.04

  • pyproject.toml: pyproject.toml

  • build.py: build.py

  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • I have consulted the FAQ and blog for any relevant entries or release notes.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

In my pyproject.toml I have

[tool.poetry.build]
script = "build.py"
generate-setup-file = false

[build-system]
requires = ["poetry-core", "protoc-exe"]
build-backend = "poetry.core.masonry.api"

and my build.py invokes the protoc command, which is provided by the protoc-exe module, listed in [build-system].

This works fine with poetry install --sync:

 % poetry install --sync
Installing dependencies from lock file

Preparing build environment with build-system requirements poetry-core, protoc-exe
Installing the current project: mypoetrytest (0.1.0)

But it fails with poetry build:

 % poetry build     
Preparing build environment with build-system requirements poetry-core, protoc-exe
Building mypoetrytest (0.1.0)
Traceback (most recent call last):
  File "/home/cavedon/mypoetrytest/build.py", line 27, in <module>
    build()
  File "/home/cavedon/mypoetrytest/build.py", line 17, in build
    subprocess.check_call(
  File "/usr/lib/python3.10/subprocess.py", line 364, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.10/subprocess.py", line 345, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'protoc'

Command '['/tmp/tmp0g_4j74h/.venv/bin/python', 'build.py']' returned non-zero exit status 1.

(full output with -vvv)

In the case of poetry build, the command protoc is in the bin directory of the virtualenv, but the bin directory is not added to the PATH environment variable.

Setting generate-setup-file = true does not help.

Metadata

Metadata

Assignees

Labels

area/build-systemRelated to PEP 517 packaging (see poetry-core)kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions