From ef8511c1de7b20a3907cfa26936cd552af4ccf3f Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Sun, 23 May 2021 22:07:27 +0200 Subject: [PATCH] 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 --- install-poetry.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/install-poetry.py b/install-poetry.py index ba67d3d..22e1ee7 100644 --- a/install-poetry.py +++ b/install-poetry.py @@ -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: