diff options
Diffstat (limited to 'contrib/meson/GetLz4LibraryVersion.py')
-rw-r--r-- | contrib/meson/GetLz4LibraryVersion.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/contrib/meson/GetLz4LibraryVersion.py b/contrib/meson/GetLz4LibraryVersion.py index e929f95..d8abfcb 100644 --- a/contrib/meson/GetLz4LibraryVersion.py +++ b/contrib/meson/GetLz4LibraryVersion.py @@ -8,15 +8,9 @@ # in the COPYING file in the root directory of this source tree). # ############################################################################# import re -import sys -def usage(): - print('usage: python3 GetLz4LibraryVersion.py <path/to/lz4.h>') - sys.exit(1) - - -def find_version(filepath): +def find_version_tuple(filepath): version_file_data = None with open(filepath) as fd: version_file_data = fd.read() @@ -33,12 +27,12 @@ def find_version(filepath): def main(): - if len(sys.argv) < 2: - usage() - - filepath = sys.argv[1] - version_tup = find_version(filepath) - print('.'.join(version_tup)) + import argparse + parser = argparse.ArgumentParser(description='Print lz4 version from lib/lz4.h') + parser.add_argument('file', help='path to lib/lz4.h') + args = parser.parse_args() + version_tuple = find_version_tuple(args.file) + print('.'.join(version_tuple)) if __name__ == '__main__': |