I have a simple script that first cleans a directory(deletes stale binaries) and then builds a bunch of files using make and then go on to do few other things. I want to print indicative messages as the script is about to execute each step as in: print deleting, delete, print building, make ... The script always prints the indicative messages after executing delete and make. Here is the my script.
def build():
print("deleting stale binaries ...")
os.system("make clean")
print("starting build ..")
os.system("make")
return;
def main():
build()
if __name__=="__main__":
main()
Here is the output I see:
rm -rf *.so *.a
gcc -Wall -other options file1.c file2.c ... ... the rest of the build output ...
And then it prints all the print statements
deleting stale binaries ...
starting build ...
I have moved around the print statements by putting them in different order, inside main but nothing works. Can someone please help me understand what is going on here?