Skip to content

Instantly share code, notes, and snippets.

@rstms
Last active April 29, 2020 20:15
Show Gist options
  • Save rstms/3bd133959cf71c396d26123cbb0ab500 to your computer and use it in GitHub Desktop.
Save rstms/3bd133959cf71c396d26123cbb0ab500 to your computer and use it in GitHub Desktop.
sed 's/^\(BIN = """#!\).*$/\1{SHEBANG}/;s/u(BIN)/u(BIN.replace("{SHEBANG}", sys.executable))/'
@rstms
Copy link
Author

rstms commented Mar 18, 2020

The install script for poetry (currently at v1.0.5) is not PEP394 compliant, which causes problems on various systems where running python scripts with the shebang #!/usr/bin/env python fails or is undesirable. There are a number of open issues and PRs in the poetry github repo addressing this, and I'm sure they'll get it sorted eventually.

In the meantime, on systems where #!/usr/bin/env python would fail or use python2: (I'm looking at you, Debian buster)
Use this command to install poetry using python3 on a such a system:

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | eval $(curl -sSL https://git.io/JvXVq) | python3

Security note: only do this kind of thing if you trust the author implicitly. A very sane thing to do would be:

curl -sSL https://git.io/JvXVq >fixit

Then examine fixit and satisfy yourself that it isn't doing anything evil, followed by:

chmod +x fixit
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | ./fixit | python3

@rstms
Copy link
Author

rstms commented Mar 18, 2020

Compatibility note: This assumes your system is unix-like and has sed on the path.

@darrenjl0
Copy link

Thanks for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment