Rizin
unix-like reverse engineering framework and cli tools
version.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # SPDX-FileCopyrightText: 2021 ret2libc <sirmy15@gmail.com>
4 # SPDX-License-Identifier: LGPL-3.0-only
5 
6 """ Portable python script to read version from meson.build until meson provides a proper way """
7 
8 import os
9 import sys
10 
11 meson_file = "meson.build"
12 if len(sys.argv) > 1:
13  meson_file = os.path.join(sys.argv[1], meson_file)
14 
15 with open(meson_file, "r", encoding="utf8") as f:
16  # Read only first 10 lines of the meson file, looking for 'version: ' string
17  for i in range(10):
18  fields = [x.strip() for x in f.readline().strip().split(":")]
19  if fields[0] == "version":
20  fields = fields[1].split("'")
21  sys.stdout.write(fields[1] + "\n")
22  sys.exit(0)
23 
24 sys.exit(1)
size_t len
Definition: 6502dis.c:15