mac support
This commit is contained in:
@@ -7,7 +7,7 @@ import sys
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from copienator.platform import windows_filename_problems
|
||||
from copienator.platform import find_executable, windows_filename_problems
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -33,8 +33,10 @@ def collect_diagnostics(
|
||||
checks = [
|
||||
DiagnosticCheck(
|
||||
"Système",
|
||||
os.name == "nt" or sys.platform.startswith("linux"),
|
||||
f"{sys.platform} — Linux et Windows sont pris en charge",
|
||||
os.name == "nt"
|
||||
or sys.platform.startswith("linux")
|
||||
or sys.platform == "darwin",
|
||||
f"{sys.platform} — Linux, Windows et macOS sont pris en charge",
|
||||
),
|
||||
DiagnosticCheck("Python", True, sys.executable),
|
||||
]
|
||||
@@ -65,7 +67,13 @@ def collect_diagnostics(
|
||||
("PDF Arranger", ("pdf-arranger", "pdfarranger"), False),
|
||||
)
|
||||
for label, candidates, required in programs:
|
||||
executable = next((shutil.which(candidate) for candidate in candidates if shutil.which(candidate)), None)
|
||||
executable = find_executable(*candidates)
|
||||
if label == "PDF Arranger" and not executable and sys.platform == "darwin":
|
||||
system_open = Path("/usr/bin/open")
|
||||
opener = find_executable("open") or (
|
||||
str(system_open) if system_open.is_file() else None
|
||||
)
|
||||
executable = f"{opener} (Aperçu)" if opener else None
|
||||
detail = executable or "Introuvable dans PATH"
|
||||
checks.append(DiagnosticCheck(label, executable is not None, detail, required))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user