added build-all.py script

This commit is contained in:
Zander Thannhauser 2024-12-02 16:38:42 -06:00
parent dcc4c1b65a
commit 139a065f2c
2 changed files with 61 additions and 0 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
bin/
examples/sandbox.txt
copy+paste.txt
.*.db

59
build-all.py Executable file
View file

@ -0,0 +1,59 @@
#!/usr/bin/env python3
import subprocess;
import time;
import atexit;
import os;
import pickle;
PICKLEFILE = ".build-all.db"
try:
with open(PICKLEFILE, "rb") as stream:
ftimes = pickle.load(stream);
except:
ftimes = dict();
def dumpftimes():
with open(PICKLEFILE, "wb") as stream:
pickle.dump(ftimes, stream);
atexit.register(dumpftimes);
buildtypes = set();
for x in os.listdir("buildtypes"):
buildtype = x[:-4];
if buildtype not in ftimes:
ftimes[buildtype] = time.time();
buildtypes.add(buildtype);
for buildtype in sorted(buildtypes, key = lambda x: -ftimes[x]):
print("\033[32m" f"$ make buildtype={buildtype}" "\033[0m");
result = subprocess.run(["make", f"buildtype={buildtype}"]);
if result.returncode:
ftimes[buildtype] = time.time();
print("subcommand failed!");
exit(1);