From 29a0e49131a576111e853676da571d7f7b35cddf Mon Sep 17 00:00:00 2001 From: tjquillan Date: Tue, 20 Aug 2024 19:32:09 -0700 Subject: [PATCH 1/3] Fix parsing remote versions Version.parse was backed by a regex anyways so lets use that. This should make sure all versions are valid. --- poetry_plugin_pyenv/pyenv.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/poetry_plugin_pyenv/pyenv.py b/poetry_plugin_pyenv/pyenv.py index 789934d..6dc771a 100644 --- a/poetry_plugin_pyenv/pyenv.py +++ b/poetry_plugin_pyenv/pyenv.py @@ -9,16 +9,7 @@ if TYPE_CHECKING: - from re import Match - from re import Pattern from subprocess import CompletedProcess - from typing import Iterator - - -# See: https://regex101.com/r/Bz2g17/1 -PYTHON_VERSION_REGEX: Pattern[str] = re.compile( - r"^\s*(\d+\S*)\s*$", re.IGNORECASE | re.MULTILINE -) def is_installed(version: Version) -> bool: @@ -59,5 +50,11 @@ def get_remote_versions() -> list[Version]: ["pyenv", "install", "--list"], check=True, capture_output=True ) output: str = result.stdout.decode("utf-8") - matched_versions: Iterator[Match[str]] = re.finditer(PYTHON_VERSION_REGEX, output) - return [Version.parse(v.group(1)) for v in matched_versions] + + versions: list[Version] = [] + for line in output.splitlines(): + try: + versions.append(Version.parse(line)) + except: + pass + return versions From 1f99b7e7ef3fd2156c8ddab935fdd1ccd112c350 Mon Sep 17 00:00:00 2001 From: Mauricio Date: Mon, 23 Sep 2024 10:13:37 -0700 Subject: [PATCH 2/3] fix: strip whitespace from pyenv output --- poetry_plugin_pyenv/pyenv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poetry_plugin_pyenv/pyenv.py b/poetry_plugin_pyenv/pyenv.py index 6dc771a..bfb89df 100644 --- a/poetry_plugin_pyenv/pyenv.py +++ b/poetry_plugin_pyenv/pyenv.py @@ -54,7 +54,7 @@ def get_remote_versions() -> list[Version]: versions: list[Version] = [] for line in output.splitlines(): try: - versions.append(Version.parse(line)) + versions.append(Version.parse(line.strip())) except: pass return versions From c667d4ee891f8be47556fc6486a3578fcdcaf90a Mon Sep 17 00:00:00 2001 From: tjquillan Date: Wed, 25 Sep 2024 06:57:45 -0700 Subject: [PATCH 3/3] Update GitHub Runners for CI --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7ece06a..3ad0a9d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,9 +22,9 @@ jobs: - os: Ubuntu image: ubuntu-latest - os: Windows - image: windows-2022 + image: windows-latest - os: macOS - image: macos-11 + image: macos-latest fail-fast: false defaults: run: