From 116fc440348c0b3e9123ebb3060fb9b7e82b5de8 Mon Sep 17 00:00:00 2001 From: gnikit Date: Fri, 25 Mar 2022 00:46:50 +0000 Subject: [PATCH] Disable PyPi autoupdate for prereleases and dev --- CHANGELOG.md | 6 ++++++ fortls/langserver.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 219273a0..2a971d98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELONG +## 2.2.8 + +### Changed + +- Disable PyPi autoupdating for pre-releases and dev versions + ## 2.2.7 ### Changed diff --git a/fortls/langserver.py b/fortls/langserver.py index 023b4580..f66ed1d8 100644 --- a/fortls/langserver.py +++ b/fortls/langserver.py @@ -1664,8 +1664,12 @@ def _update_version_pypi(self, test: bool = False): request = urllib.request.Request("https://pypi.org/pypi/fortls/json") with urllib.request.urlopen(request) as resp: info = json.loads(resp.read().decode("utf-8")) + remote_v = version.parse(info["info"]["version"]) + # Do not update from remote if it is a prerelease + if remote_v.is_prerelease: + return False # This is the only reliable way to compare version semantics - if version.parse(info["info"]["version"]) > v or test: + if remote_v > v or test: self.post_message( "A newer version of fortls is available for download", 3 )