Something went wrong. Try again.
My course files for the Online Computer Science degree
Something went wrong. Try again.
Online-Computer-Science-degree commit.py
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152#!/usr/bin/python3
import globimport subprocessimport os.pathimport time
version = "1.2"print("Version " + version)# Time Difference between PDF and NB in secmaxTimeDifference = 900
# Check if every Notebook is converted to PDFallAsPdf = Truenbs = glob.glob("Calculus/*/*.nb")pdfs = glob.glob("Calculus/*/*.pdf")for nbfile in nbs: nameAsPdf = nbfile.replace(".nb", ".pdf") if nameAsPdf in pdfs: mTimeNb = os.path.getmtime(nbfile) mTimePdf = os.path.getmtime(nameAsPdf) diff = mTimeNb - mTimePdf if diff > maxTimeDifference: print(nameAsPdf + " needs to be updated") allAsPdf = False else: print(nameAsPdf + " was not found") allAsPdf = False
if not allAsPdf: print("Please save notebooks as PDF's") input() exit(1)
# Update gitsubprocess.run(["git", "pull"])subprocess.run(["git", "add", "."])subprocess.run(["git", "status"])
message = input("Commit Message: ")
# Commitsubprocess.run(["git", "commit", "-a", "-m", message, "-m", "from script v" + version])
# Uploadsubprocess.run(["git", "push"])
# Don't Autocloseprint("Success! Closing in 3 seconds.")time.sleep(3)