Skip to content

Commit fde8c6f

Browse files
authored
Properly ignore updates when there is no internet (#407)
1 parent c406dd4 commit fde8c6f

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

.idea/ephys-link.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ dependencies = [
7575
# "cov-report",
7676
#]
7777

78-
#[[tool.hatch.envs.all.matrix]]
79-
#python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
80-
8178
[tool.hatch.envs.exe]
8279
python = "3.13"
8380
dependencies = [

src/ephys_link/back_end/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def launch(self) -> None:
5050
server_preamble()
5151

5252
# Check for updates.
53-
check_for_updates()
53+
if not self._options.ignore_updates:
54+
check_for_updates()
5455

5556
# List platform and available manipulators.
5657
self._console.info_print("PLATFORM", self._platform_handler.get_platform_type())

src/ephys_link/util/common.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66

77
from packaging.version import parse
8-
from requests import get
8+
from requests import ConnectionError, ConnectTimeout, get
99
from vbl_aquarium.models.unity import Vector4
1010

1111
from ephys_link.__about__ import __version__
@@ -43,11 +43,14 @@ def server_preamble() -> None:
4343

4444
def check_for_updates() -> None:
4545
"""Check for updates to the Ephys Link."""
46-
response = get("https://api.github.com/repos/VirtualBrainLab/ephys-link/tags", timeout=10)
47-
latest_version = response.json()[0]["name"]
48-
if parse(latest_version) > parse(__version__):
49-
print(f"Update available: {latest_version} !")
50-
print("Download at: https://github.com/VirtualBrainLab/ephys-link/releases/latest")
46+
try:
47+
response = get("https://api.github.com/repos/VirtualBrainLab/ephys-link/tags", timeout=10)
48+
latest_version = response.json()[0]["name"]
49+
if parse(latest_version) > parse(__version__):
50+
print(f"Update available: {latest_version} !")
51+
print("Download at: https://github.com/VirtualBrainLab/ephys-link/releases/latest")
52+
except (ConnectionError, ConnectTimeout):
53+
print("Unable to check for updates. Ignore updates or use the the -i flag to disable checks.\n")
5154

5255

5356
# Unit conversions

0 commit comments

Comments
 (0)