exjobb-public/scripts/build_env.py

26 lines
668 B
Python

import os
def buildEnvExists():
try:
result = os.lstat("work")
except FileNotFoundError:
result = "-1"
except e:
result = "-2"
if result == "-2":
print(f"Encountered an unexpected error {e}")
print("exiting...")
return
if result == "-1":
print("Work doesn't exist, initializing build environment")
return
print("Work exists, no filesystem things to do")
if os.access("work", os.W_OK):
print("write access checked inside work, nothing to do")
else:
print("work is not writable, change permissions of dir")
if __name__ == "__main__":
buildEnvExists()