Skip to content

poetry install ignore build script failure #6182

@touilleMan

Description

@touilleMan
  • I am on the latest Poetry version.

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

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: all

  • Poetry version: 1.2.0b3

Issue

When using a build script in the pyproject.toml (i.e. the script = "build.py" in [tool.poetry.build]), the return status from the build script is ignored by the poetry install command:

$ poetry install -E backend -E core
Installing dependencies from lock file

No dependencies to install or update

Preparing build environment with build-system requirements poetry-core>=1.0.0, setuptools, maturin~=0.13, PyQt5~=5.15, Babel~=2.10, docutils~=0.17
PYTHON_EXECUTABLE_PATH=/tmp/tmp44hka6ee/.venv/bin/python
Launching poetry build.py script
Traceback (most recent call last):
  File "/mnt/c/Users/gbleu/source/repos/parsec-cloud/parsec-cloud/build.py", line 74, in <module>
    build()
  File "/mnt/c/Users/gbleu/source/repos/parsec-cloud/parsec-cloud/build.py", line 39, in build
    raise SystemError("D'oh !")
SystemError: D'oh !
Installing the current project: parsec-cloud (v2.11.1+dev)
$ echo $?
0

The expected behavior would be to have the poetry install command stopped and return an error status, this is for instance the behavior of poetry build --wheel

$ poetry build --format wheel
Preparing build environment with build-system requirements poetry-core>=1.0.0, setuptools, maturin~=0.13, PyQt5~=5.15, Babel~=2.10, docutils~=0.17
Building parsec-cloud (v2.11.1+dev)
PYTHON_EXECUTABLE_PATH=/tmp/tmp5ef_ve_y/.venv/bin/python
Launching poetry build.py script
Traceback (most recent call last):
  File "/mnt/c/Users/gbleu/source/repos/parsec-cloud/parsec-cloud/build.py", line 74, in <module>
    build()
  File "/mnt/c/Users/gbleu/source/repos/parsec-cloud/parsec-cloud/build.py", line 39, in build
    raise SystemError("D'oh !")
SystemError: D'oh !

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

The issue comes from env.run being called with call=True (with this option the subprocess return status is not checked)

env.run("python", str(self._path.joinpath(build_script)), call=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/duplicateDuplicate issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions