fixup! test it on macOS

This commit is contained in:
Alexis Métaireau 2024-11-28 17:59:11 +01:00
parent 90c2e8569a
commit a2bc07537b
No known key found for this signature in database
GPG key ID: C65C7A89A8FFC56E
2 changed files with 5 additions and 6 deletions

View file

@ -500,8 +500,8 @@ class WaitingWidgetContainer(WaitingWidget):
error: Optional[str] = None
try:
is_available, version = self.dangerzone.isolation_provider.check_runtime_version()
if not is_available:
is_greater, version = self.dangerzone.isolation_provider.check_docker_desktop_version()
if not is_greater:
error = f"Your Docker version is too old ({version})."
print(error)
self.dangerzone.isolation_provider.is_runtime_available()

View file

@ -201,11 +201,11 @@ class Container(IsolationProvider):
return True
@staticmethod
def check_runtime_version() -> Tuple[bool, str]:
def check_docker_desktop_version() -> Tuple[bool, str]:
# On windows and darwin, check that the minimum version is met
if platform.system() != "Linux":
with subprocess.Popen(
["docker", "version", "--format", "'{{.Server.Platform.Name}}'"],
["docker", "version", "--format", "{{.Server.Platform.Name}}"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
startupinfo=get_subprocess_startupinfo(),
@ -214,8 +214,7 @@ class Container(IsolationProvider):
if p.returncode != 0:
raise NotAvailableContainerTechException("docker", stderr.decode())
# The output is like "Docker Desktop 4.35.1 (173168)"
version = stdout.replace("Docker Desktop", "").split()[0]
version = stdout.decode().replace("Docker Desktop", "").split()[0]
if version < MINIMUM_DOCKER_VERSION[platform.system()]:
return False, version
return True, ""