added basic build env checks

This commit is contained in:
Erik Örtenberg 2025-02-10 23:54:48 +01:00
parent 6b6eaaa7cf
commit e0e4345a31

25
scripts/build_env.py Normal file
View File

@ -0,0 +1,25 @@
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()