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
|
@ -6,7 +6,7 @@ import re
|
||||||
|
|
||||||
from . import file
|
from . import file
|
||||||
from . import textui
|
from . import textui
|
||||||
from ..version import _revision
|
from ..version import _version
|
||||||
|
|
||||||
prefix = textui.prefix
|
prefix = textui.prefix
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ def _print_help(main, help_texts, chapter=None, list_options=False):
|
||||||
# dirty as fuck :-)
|
# dirty as fuck :-)
|
||||||
if not chapter and not main.version is None:
|
if not chapter and not main.version is None:
|
||||||
if help_texts == _over_help_texts:
|
if help_texts == _over_help_texts:
|
||||||
_output(">>> §yover.core§/ version §y%d§/ (%s), licensed under the §yAO-JSL§/" %_revision, newlines=2)
|
_output(">>> §yover.core§/ version §y%d§/ (%s), licensed under the §yAO-JSL§/" %_version, newlines=2)
|
||||||
else:
|
else:
|
||||||
_output("§y%s§/ version §y%s§/, licensed under the §y%s§/" %(main.name, main.version, main.license), newlines=2)
|
_output("§y%s§/ version §y%s§/, licensed under the §y%s§/" %(main.name, main.version, main.license), newlines=2)
|
||||||
|
|
||||||
|
|
7
deploy-versioning.sh
Executable file
7
deploy-versioning.sh
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#! /bin/bash
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
echo "*.py filter=version" >> .git/info/attributes
|
||||||
|
ln -fs ../version-tool.py .git/version-tool.py
|
||||||
|
git config --local filter.version.clean "python3 ./.git/version-tool.py --clean"
|
||||||
|
git config --local filter.version.smudge "python3 ./.git/version-tool.py --set \$(git rev-list HEAD --count) \$(git rev-parse HEAD)"
|
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)
|
|
@ -1,4 +1,4 @@
|
||||||
#! /bin/env python3
|
#! /bin/env python3
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
_revision = (0, '00000000') # GIT_REVISION_IDENTIFIER
|
_version = (0, '00000000') # OVER_VERSION_IDENTIFIER
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue