Skip to content

"poetry install" returns a zero exit status when build.py failed #3717

@tueda

Description

@tueda
  • 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).

Issue

If I use the "build.py" feature without generating setup.py (though it has not been stabilized yet, #2740), namely,

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

then poetry install gives a zero exit status even when build.py failed:

$ cat build.py
raise AssertionError("Failed!")

$ poetry install -vvv; echo $?

...

Installing the current project: example (0.1.0)
  - Building package example in editable mode
  - Executing build script: build.py
Traceback (most recent call last):
  File "/home/tueda/tmp/test-poetry-build-failure/build.py", line 1, in <module>
    raise AssertionError("Failed!")
AssertionError: Failed!
  - Adding example.pth to /home/tueda/tmp/test-poetry-build-failure/.venv/lib/python3.9/site-packages for /home/tueda/tmp/test-poetry-build-failure
  - Removing existing example-0.1.0.dist-info directory from /home/tueda/tmp/test-poetry-build-failure/.venv/lib/python3.9/site-packages
  - Adding the example-0.1.0.dist-info directory to /home/tueda/tmp/test-poetry-build-failure/.venv/lib/python3.9/site-packages
0

The same thing occurs even when build.py does not exist:

$ cat build.py
cat: build.py: No such file or directory

$ poetry install -vvv; echo $?

...

Installing the current project: example (0.1.0)
  - Building package example in editable mode
  - Executing build script: build.py
/home/tueda/tmp/test-poetry-build-failure/.venv/bin/python: can't open file '/home/tueda/tmp/test-poetry-build-failure/build.py': [Errno 2] No such file or directory
  - Adding example.pth to /home/tueda/tmp/test-poetry-build-failure/.venv/lib/python3.9/site-packages for /home/tueda/tmp/test-poetry-build-failure
  - Removing existing example-0.1.0.dist-info directory from /home/tueda/tmp/test-poetry-build-failure/.venv/lib/python3.9/site-packages
  - Adding the example-0.1.0.dist-info directory to /home/tueda/tmp/test-poetry-build-failure/.venv/lib/python3.9/site-packages
0

In these cases, Poetry should report a build error with returning a non-zero exit status.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliRelated to the command linekind/bugSomething isn't working as expectedstatus/acceptedFeature request accepted for the roadmap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions