Skip to content

Commit

Permalink
Merge pull request #83 from gnikit/feature/remote-update
Browse files Browse the repository at this point in the history
Disable PyPi autoupdate for prereleases and dev
  • Loading branch information
gnikit authored Mar 25, 2022
2 parents 02ea94a + 116fc44 commit 4e0bb5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELONG

## 2.2.8

### Changed

- Disable PyPi autoupdating for pre-releases and dev versions

## 2.2.7

### Changed
Expand Down
6 changes: 5 additions & 1 deletion fortls/langserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 4e0bb5d

Please sign in to comment.