Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 of 3 tasks
tueda opened this issue Feb 23, 2021 · 2 comments · Fixed by #7812
Closed
2 of 3 tasks

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

tueda opened this issue Feb 23, 2021 · 2 comments · Fixed by #7812
Labels
area/cli Related to the command line kind/bug Something isn't working as expected status/accepted Feature request accepted for the roadmap

Comments

@tueda
Copy link

tueda commented Feb 23, 2021

  • 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.

@tueda tueda added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Feb 23, 2021
@logan-bobo logan-bobo added area/cli Related to the command line status/accepted Feature request accepted for the roadmap and removed status/triage This issue needs to be triaged labels Oct 5, 2022
@logan-bobo
Copy link
Member

Looking over this and in the latest version of poetry (1.2.1) and its looks as if you are correct a failure or the file not existing does not produce an exit code 1 with the following config.

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

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/cli Related to the command line kind/bug Something isn't working as expected status/accepted Feature request accepted for the roadmap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants