Skip to content

Bundle breaks when using relative path #97

@ClementPinard

Description

@ClementPinard

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())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions