diff options
author | lf <lf-@users.noreply.github.com> | 2018-10-27 08:44:38 -0600 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2018-10-27 10:44:38 -0400 |
commit | a33792f07e4d3f1f3c79c16d893b9193ef57e09d (patch) | |
tree | 0771dca6a0209b0429b5879c37f916ce2c77eb25 /scripts | |
parent | f57c29442cac6b110937af8960c9375192bb645e (diff) | |
download | kutter-a33792f07e4d3f1f3c79c16d893b9193ef57e09d.tar.gz kutter-a33792f07e4d3f1f3c79c16d893b9193ef57e09d.tar.xz kutter-a33792f07e4d3f1f3c79c16d893b9193ef57e09d.zip |
util: Fix versioning when gitdir is absent (#809)
The gitdir previously could be absent and produce a version of "" in
spite of checks for it. Fixed.
Parent directories with shlex-interpreted characters in their names
could be misinterpreted. Removed shlex parsing.
Packagers may want to remove the git history to slim down the package
size, so add an option for using a file 'version' in the klippy
directory to set version without using git.
Signed-Off-By: Lucas Fink <software@lfcode.ca>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/make_version.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/make_version.py b/scripts/make_version.py new file mode 100644 index 00000000..47422500 --- /dev/null +++ b/scripts/make_version.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python2 +# Get the version number for klippy +# +# Copyright (C) 2018 Lucas Fink <software@lfcode.ca> +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +from __future__ import print_function + +import argparse +import os +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), '../klippy')) + +import util + + +def main(argv): + p = argparse.ArgumentParser() + p.add_argument( + 'distroname', + help='Name of distro this package is intended for' + ) + args = p.parse_args() + print(util.get_git_version(from_file=False), + args.distroname.replace(' ', ''), sep='-') + + +if __name__ == '__main__': + main(sys.argv[1:]) |