diff --git a/core/app.py b/core/app.py index ce0ab6c..4ac6e00 100644 --- a/core/app.py +++ b/core/app.py @@ -6,7 +6,7 @@ import re from . import file from . import textui -from ..version import _revision +from ..version import _version prefix = textui.prefix @@ -73,7 +73,7 @@ def _print_help(main, help_texts, chapter=None, list_options=False): # dirty as fuck :-) if not chapter and not main.version is None: 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: _output("§y%s§/ version §y%s§/, licensed under the §y%s§/" %(main.name, main.version, main.license), newlines=2) diff --git a/deploy-versioning.sh b/deploy-versioning.sh new file mode 100755 index 0000000..dbf73da --- /dev/null +++ b/deploy-versioning.sh @@ -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)" diff --git a/version-tool.py b/version-tool.py new file mode 100755 index 0000000..77b5184 --- /dev/null +++ b/version-tool.py @@ -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) diff --git a/version.py b/version.py index 7f5fc19..91b177c 100644 --- a/version.py +++ b/version.py @@ -1,4 +1,4 @@ #! /bin/env python3 # encoding: utf-8 -_revision = (0, '00000000') # GIT_REVISION_IDENTIFIER +_version = (0, '00000000') # OVER_VERSION_IDENTIFIER