-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils_system.py
More file actions
22 lines (21 loc) · 882 Bytes
/
utils_system.py
File metadata and controls
22 lines (21 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import sys
import shutil
import subprocess
import os
def get_potrace_path():
if sys.platform == "win32":
# chemin local dans l’exe
return os.path.join(sys._MEIPASS, "bin/potrace-bin/potrace.exe") if getattr(sys, 'frozen', False) else "bin/potrace-bin/potrace.exe"
else:
# Si l'app est packagée, on fournit notre propre binaire
if getattr(sys, 'frozen', False):
return os.path.join(sys._MEIPASS, "bin/potrace-1.16.linux-x86_64/potrace")
# En développement, on utilise le binaire local s’il existe
local_path = "bin/potrace-1.16.linux-x86_64/potrace"
if os.path.exists(local_path):
return local_path
# Sinon, on cherche dans le PATH
potrace = shutil.which("potrace")
if not potrace:
raise FileNotFoundError("potrace non trouvé")
return potrace