Rizin
unix-like reverse engineering framework and cli tools
GetLz4LibraryVersion Namespace Reference

Functions

def find_version_tuple (filepath)
 
def main ()
 

Function Documentation

◆ find_version_tuple()

def GetLz4LibraryVersion.find_version_tuple (   filepath)

Definition at line 13 of file GetLz4LibraryVersion.py.

13 def find_version_tuple(filepath):
14  version_file_data = None
15  with open(filepath) as fd:
16  version_file_data = fd.read()
17 
18  patterns = r"""#\s*define\s+LZ4_VERSION_MAJOR\s+([0-9]+).*$
19 #\s*define\s+LZ4_VERSION_MINOR\s+([0-9]+).*$
20 #\s*define\s+LZ4_VERSION_RELEASE\s+([0-9]+).*$
21 """
22  regex = re.compile(patterns, re.MULTILINE)
23  version_match = regex.search(version_file_data)
24  if version_match:
25  return version_match.groups()
26  raise Exception("Unable to find version string.")
27 
28 
def find_version_tuple(filepath)

Referenced by main().

◆ main()

def GetLz4LibraryVersion.main ( void  )

Definition at line 29 of file GetLz4LibraryVersion.py.

29 def main():
30  import argparse
31  parser = argparse.ArgumentParser(description='Print lz4 version from lib/lz4.h')
32  parser.add_argument('file', help='path to lib/lz4.h')
33  args = parser.parse_args()
34  version_tuple = find_version_tuple(args.file)
35  print('.'.join(version_tuple))
36 
37 

References find_version_tuple().