-
Notifications
You must be signed in to change notification settings - Fork 0
/
envm_generator.py
28 lines (24 loc) · 979 Bytes
/
envm_generator.py
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
import os
import sys
def check_path(target):
if (os.path.exists(target)):
return target
else:
return None
if __name__ == "__main__":
opt_path = sys.argv[1]
out = []
if bin_path := check_path(os.path.join(opt_path, "bin")):
out.append(f"prepend-path PATH {bin_path}")
if sbin_path := check_path(os.path.join(opt_path, "sbin")):
out.append(f"prepend-path PATH {sbin_path}")
if lib_path := check_path(os.path.join(opt_path, "lib")):
out.append(f"prepend-path LIBRARY_PATH {lib_path}")
out.append(f"prepend-path LD_LIBRARY_PATH {lib_path}")
if lib64_path := check_path(os.path.join(opt_path, "lib64")):
out.append(f"prepend-path LIBRARY_PATH {lib64_path}")
out.append(f"prepend-path LD_LIBRARY_PATH {lib64_path}")
if inc_path := check_path(os.path.join(opt_path, "include")):
out.append(f"prepend-path CPATH {inc_path}")
print("#%Module\n")
print("\n".join(out))