automatic version stamping implemented (using git filters)
This commit is contained in:
parent
5e655c8e06
commit
8f317dc7dd
4 changed files with 30 additions and 3 deletions
20
version-tool.py
Executable file
20
version-tool.py
Executable 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)
|
Loading…
Add table
Add a link
Reference in a new issue