From d86e1c3d7b7055fbf4f5ecc9d67e858322ab00e3 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Wed, 30 Oct 2024 21:16:06 -0400 Subject: [PATCH] Exclude prereleases when checking for updates --- robotpy_installer/installer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/robotpy_installer/installer.py b/robotpy_installer/installer.py index 374cd2c..e7c1e1d 100755 --- a/robotpy_installer/installer.py +++ b/robotpy_installer/installer.py @@ -656,7 +656,14 @@ def get_pypi_version(self, package: str, use_certifi: bool) -> Version: # Sort the versions maxv = Version(str(int(_WPILIB_YEAR) + 1)) - versions = sorted(v for v in versions if v < maxv) + + def _version_ok(v: Version) -> bool: + ok = v < maxv and not v.is_devrelease + if ok and not _IS_BETA: + ok = not v.is_prerelease + return ok + + versions = sorted(v for v in versions if _version_ok(v)) if not versions: raise InstallerException(f"could not find {package} version on pypi")