mac support
This commit is contained in:
@@ -8,7 +8,12 @@ from tkinter import filedialog, messagebox, ttk
|
||||
from typing import Any
|
||||
|
||||
from copienator import ExitCode
|
||||
from copienator.platform import WindowsLabelError, open_path, validate_windows_labels
|
||||
from copienator.platform import (
|
||||
WindowsLabelError,
|
||||
add_platform_executable_paths,
|
||||
open_path,
|
||||
validate_windows_labels,
|
||||
)
|
||||
|
||||
from .diagnostics import collect_diagnostics
|
||||
from .runner import ProcessRunner
|
||||
@@ -95,7 +100,7 @@ def plotting_shortcut_lines() -> list[str]:
|
||||
def build_runner_environment(
|
||||
base: dict[str, str], api_key: str, proxy: str, use_proxy: bool
|
||||
) -> dict[str, str]:
|
||||
environment = dict(base)
|
||||
environment = add_platform_executable_paths(base)
|
||||
environment["PYTHONUNBUFFERED"] = "1"
|
||||
environment["PYTHONIOENCODING"] = "utf-8"
|
||||
if api_key.strip():
|
||||
|
||||
@@ -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