1
0
Fork 0
mirror of https://github.com/python-poetry/install.python-poetry.org.git synced 2024-09-13 13:17:11 -04:00

install-poetry: add warning for < 1.2.0a1

When installing poetry < 1.2.0a1 add a warning indicating the breakage
of `self update` command usage.

Relates-to: #4040
This commit is contained in:
Arun Babu Neelicattu 2021-05-23 22:07:27 +02:00
parent 0ab3fa97c8
commit ef8511c1de

View file

@ -413,6 +413,24 @@ class Installer:
self.display_pre_message()
self.ensure_directories()
def _is_self_upgrade_supported(x):
mx = self.VERSION_REGEX.match(x)
vx = tuple(int(p) for p in mx.groups()[:3]) + (mx.group(5),)
return vx >= (1, 2, 0)
if not _is_self_upgrade_supported(version):
self._write(
colorize(
"warning",
f"You are installing {version}. When using the current installer, this version does not support "
f"updating using the 'self update' command. Please use 1.2.0a1 or later.",
)
)
if not self._accept_all:
continue_install = input("Do you want to continue? ([y]/n) ") or "y"
if continue_install.lower() in {"n", "no"}:
return 0
try:
self.install(version)
except subprocess.CalledProcessError as e: