""" Verhoogt het versienummer in VERSION met één stap. Uitvoeren vóór elke commit: python verhoog_versie.py Regels: het laatste cijfer gaat telkens één omhoog, tot 99. 1.1.0 -> 1.1.1 1.1.99 -> 1.2.0 1.99.99 -> 2.0.0 (het eerste cijfer heeft geen maximum) """ import os PAD = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'VERSION') MAX = 99 def volgende(versie): hoofd, sub, patch = (int(x) for x in versie.strip().split('.')) patch += 1 if patch > MAX: patch, sub = 0, sub + 1 if sub > MAX: sub, hoofd = 0, hoofd + 1 return f"{hoofd}.{sub}.{patch}" if __name__ == '__main__': with open(PAD, encoding='utf-8') as f: oud = f.read().strip() nieuw = volgende(oud) with open(PAD, 'w', encoding='utf-8') as f: f.write(nieuw + '\n') print(f"{oud} -> {nieuw}")