Skip to content

Commit ef8511c

Browse files
committed
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
1 parent 0ab3fa9 commit ef8511c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

install-poetry.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,24 @@ def run(self) -> int:
413413
self.display_pre_message()
414414
self.ensure_directories()
415415

416+
def _is_self_upgrade_supported(x):
417+
mx = self.VERSION_REGEX.match(x)
418+
vx = tuple(int(p) for p in mx.groups()[:3]) + (mx.group(5),)
419+
return vx >= (1, 2, 0)
420+
421+
if not _is_self_upgrade_supported(version):
422+
self._write(
423+
colorize(
424+
"warning",
425+
f"You are installing {version}. When using the current installer, this version does not support "
426+
f"updating using the 'self update' command. Please use 1.2.0a1 or later.",
427+
)
428+
)
429+
if not self._accept_all:
430+
continue_install = input("Do you want to continue? ([y]/n) ") or "y"
431+
if continue_install.lower() in {"n", "no"}:
432+
return 0
433+
416434
try:
417435
self.install(version)
418436
except subprocess.CalledProcessError as e:

0 commit comments

Comments
 (0)