Commit f89cec94 by Sébastien Eustace

Update get-poetry.py

parent dad75f6c
...@@ -36,27 +36,37 @@ Open a new shell and type the following: ...@@ -36,27 +36,37 @@ Open a new shell and type the following:
poetry --version poetry --version
``` ```
If you see something like `Poetry 0.11.4` then you are ready to use Poetry. If you see something like `Poetry 0.12.0` then you are ready to use Poetry.
If you decide Poetry isn't your thing, you can completely remove it from your system If you decide Poetry isn't your thing, you can completely remove it from your system
by running the installer again with the `--uninstall` option. by running the installer again with the `--uninstall` option or by setting
the `POETRY_UNINSTALL` environment variable before executing the installer.
```bash
python get-poetry.py --uninstall
POETRY_UNINSTALL=1 python get-poetry.py
```
!!!note !!!note
Alternatively, you can download the `get-poetry.py` file and execute it separately. Alternatively, you can download the `get-poetry.py` file and execute it separately.
If you want to install prerelease versions, you can do so by passing `--preview` to `get-poetry.py`: If you want to install prerelease versions, you can do so by passing `--preview` to `get-poetry.py`
or by using the `POETRY_PREVIEW` environement variable:
```bash ```bash
python get-poetry.py --preview python get-poetry.py --preview
POETRY_PREVIEW=1 python get-poetry.py
``` ```
Similarly, if you want to install a specific version, you can use `--version`: Similarly, if you want to install a specific version, you can use `--version` or the `POETRY_VERSION`
environment variable:
```bash ```bash
python get-poetry.py --version 0.7.0 python get-poetry.py --version 0.12.0
POETRY_VERSION=0.12.0 python get-poetry.py
``` ```
Note that the installer does not support Poetry releases < 12.0. Note that the installer does not support Poetry releases < 0.12.0.
### Alternative installation methods (not recommended) ### Alternative installation methods (not recommended)
......
...@@ -153,6 +153,12 @@ def temporary_directory(*args, **kwargs): ...@@ -153,6 +153,12 @@ def temporary_directory(*args, **kwargs):
shutil.rmtree(name) shutil.rmtree(name)
def string_to_bool(value):
value = value.lower()
return value in {"true", "1", "y", "yes"}
def expanduser(path): def expanduser(path):
""" """
Expand ~ and ~user constructions. Expand ~ and ~user constructions.
...@@ -809,12 +815,12 @@ def main(): ...@@ -809,12 +815,12 @@ def main():
installer = Installer( installer = Installer(
version=args.version or os.getenv("POETRY_VERSION"), version=args.version or os.getenv("POETRY_VERSION"),
preview=args.preview or os.getenv("POETRY_PREVIEW"), preview=args.preview or string_to_bool(os.getenv("POETRY_PREVIEW", "0")),
force=args.force, force=args.force,
accept_all=args.accept_all, accept_all=args.accept_all or string_to_bool(os.getenv("POETRY_ACCEPT", "0")),
) )
if args.uninstall: if args.uninstall or string_to_bool(os.getenv("POETRY_UNINSTALL", "0")):
return installer.uninstall() return installer.uninstall()
return installer.run() return installer.run()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment