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

Bundle breaks when using relative path #97

Open
ClementPinard opened this issue Apr 8, 2024 · 0 comments
Open

Bundle breaks when using relative path #97

ClementPinard opened this issue Apr 8, 2024 · 0 comments

Comments

@ClementPinard
Copy link

The following command succeeds, but then calling an entrypoint from this bundle fails because the shebangs stores the python exectuable path as a relative with respect to the directory we launched the first command from.

In the example, we install black in order to have an executable entrypoint, but any other entrypoint would work

poetry new -n issute_test
cd issue_test
poetry add black
poetry bundle venv ../issue_test_bundle
../issue_test_bundle/bin/black -h   # this works
cd .. && ./issue_test_bundle/bin/black -h  # this fails

The error message :

zsh: ./issue_test_bundle/bin/black: bad interpreter: ../issue_test_bundle/bin/python: aucun fichier ou dossier de ce nom

The created black file in issue_test_bundle/black :

#!../issue_test_bundle/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from black import patched_main
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(patched_main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant