added automatic version stamping

This commit is contained in:
Overwatch 2014-08-20 11:09:27 +02:00
parent 0fb3276b9f
commit 4f2d42e74a
4 changed files with 36 additions and 2 deletions

20
version-tool.py Executable file
View file

@ -0,0 +1,20 @@
#! /bin/env python3
# encoding: utf-8
import re
import sys
REPLACEMENT = "_version = (%s, '%s') # OVER_VERSION_IDENTIFIER"
MARKER = "_version = \((\d+), '([0-9a-f]{8})'\) # OVER_VERSION_IDENTIFIER"
SUBMARKER = 'OVER_VERSION_IDENTIFIER'
if __name__ == "__main__":
action = sys.argv[1]
data = (sys.argv[2], sys.argv[3][:8]) if action == '--set' else ('0', '00000000')
for line in sys.stdin.readlines():
if SUBMARKER in line:
if re.match(MARKER, line):
line = re.sub(MARKER, REPLACEMENT %data, line)
sys.stdout.write(line)