-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
50 lines (37 loc) · 1.3 KB
/
install.py
File metadata and controls
50 lines (37 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import os
import platform
import shutil
import subprocess
def _run(cmd):
try:
return subprocess.run(cmd, check=False)
except Exception as e:
print("Command failed:", e)
return None
def main():
if shutil.which("exiftool"):
print("exiftool already available in PATH")
return
if os.environ.get("EXIFTOOL_AUTO_INSTALL", "1").lower() in {"0", "false", "no"}:
print("EXIFTOOL_AUTO_INSTALL disabled. Please install exiftool manually.")
return
system = platform.system().lower()
if system == "linux":
print("Attempting to install exiftool via apt-get...")
_run(["apt-get", "update", "-y"])
_run(["apt-get", "install", "-y", "libimage-exiftool-perl"])
if shutil.which("exiftool"):
print("exiftool installed successfully")
else:
print("exiftool install failed. Please install manually.")
return
if system == "darwin":
print("Please install exiftool with: brew install exiftool")
return
if system == "windows":
print("Please install exiftool and add it to PATH.")
print("Example (Chocolatey): choco install exiftool")
return
print("Unsupported OS. Please install exiftool manually.")
if __name__ == "__main__":
main()