7 ROOTDIR = os.path.abspath(os.path.dirname(__file__))
34 cls.HEADER = '\033[95m'
35 cls.OKBLUE = '\033[94m'
36 cls.OKGREEN = '\033[92m'
37 cls.WARNING = '\033[93m'
43 def git(*args, repository_path='.'):
44 return subprocess.check_output(["git"] + list(args), cwd=repository_path,
45 stderr=subprocess.STDOUT).decode()
47 def accept_command(commands):
48 """Search @commands and returns the first found absolute path."""
49 for command in commands:
50 command = shutil.which(command)
57 meson = os.path.join(ROOTDIR, 'meson', 'meson.py')
58 if os.path.exists(meson):
59 mesonconf = os.path.join(ROOTDIR, 'meson', 'mesonconf.py')
60 mesonintrospect = os.path.join(ROOTDIR, 'meson', 'mesonintrospect.py')
61 return meson, mesonconf, mesonintrospect
63 return accept_command(["meson.py", "meson"]), accept_command(["mesonconf.py", "mesonconf"]), \
64 accept_command(["mesonintrospect.py", "mesonintrospect"])