summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2018-12-02 15:42:14 (GMT)
committerLzu Tao <taolzu@gmail.com>2018-12-03 12:19:21 (GMT)
commit4fe675af1cc8eb65f843e06962763dab8c920ce5 (patch)
tree53909aecc7ced970e7fb396fcab3b3ba41051906 /contrib
parenta9e96d5c5a110e95bef9613ea41fcf26c4254546 (diff)
downloadlz4-4fe675af1cc8eb65f843e06962763dab8c920ce5.zip
lz4-4fe675af1cc8eb65f843e06962763dab8c920ce5.tar.gz
lz4-4fe675af1cc8eb65f843e06962763dab8c920ce5.tar.bz2
Use argparse instead of manually parsing [skip ci]
Diffstat (limited to 'contrib')
-rw-r--r--contrib/meson/GetLz4LibraryVersion.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/contrib/meson/GetLz4LibraryVersion.py b/contrib/meson/GetLz4LibraryVersion.py
index e929f95..80b09c9 100644
--- a/contrib/meson/GetLz4LibraryVersion.py
+++ b/contrib/meson/GetLz4LibraryVersion.py
@@ -11,11 +11,6 @@ import re
import sys
-def usage():
- print('usage: python3 GetLz4LibraryVersion.py <path/to/lz4.h>')
- sys.exit(1)
-
-
def find_version(filepath):
version_file_data = None
with open(filepath) as fd:
@@ -33,10 +28,11 @@ def find_version(filepath):
def main():
- if len(sys.argv) < 2:
- usage()
-
- filepath = sys.argv[1]
+ 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()
+ filepath = args.file
version_tup = find_version(filepath)
print('.'.join(version_tup))