- VERSION bevat het versienummer, config.py leest het daaruit (werkt ook in Docker, waar config.ini niet meegaat) - verhoog_versie.py: laatste cijfer +1 tot 99, dan het middelste; het middelste ook tot 99, dan het eerste - CLAUDE.md: Claude verhoogt de versie voor elke commit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
859 B
Python
34 lines
859 B
Python
"""
|
|
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}")
|