File size: 745 Bytes
29ed697
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""Report the tooling required by the preservation/setup stage."""
import shutil
import subprocess
import sys


def main():
    missing = []
    for tool in ("git", "git-lfs", "git-xet", "python3", "nix", "direnv", "rustc", "cargo"):
        path = shutil.which(tool)
        if not path:
            missing.append(tool)
            print(f"{tool}: missing")
            continue
        result = subprocess.run([path, "--version"], capture_output=True, text=True)
        lines = (result.stdout or result.stderr).splitlines()
        print(f"{tool}: {lines[0] if lines else path}")
        if result.returncode:
            missing.append(tool)
    return bool(missing)


if __name__ == "__main__":
    sys.exit(main())