worktree_subdir = os.path.join(worktree_dir, "subprojects")
meson = get_meson()
- installed_s = subprocess.check_output([sys.executable, meson, 'introspect',
- options.builddir, '--projectinfo'])
+ installed_s = subprocess.check_output(meson + ['introspect', options.builddir, '--projectinfo'])
for subproj in json.loads(installed_s.decode())["subprojects"]:
repo_name = subproj["name"]
if not repo_name.startswith("gst"):
command = shutil.which(command)
if command:
return command
-
return None
def get_meson():
meson = os.path.join(ROOTDIR, 'meson', 'meson.py')
if os.path.exists(meson):
- return meson
+ return [sys.executable, meson]
mesonintrospect = os.environ.get('MESONINTROSPECT', '')
for comp in shlex.split (mesonintrospect):
# let's not get tricked
if 'python' in os.path.basename (comp):
continue
- if os.path.exists (comp):
- mesondir = os.path.dirname(comp)
- if mesonintrospect.endswith('.py') or mesonintrospect.endswith('.py introspect'):
- meson = os.path.join(mesondir, 'meson.py')
+ if os.path.exists(comp):
+ if comp.endswith('.py'):
+ return [sys.executable, comp]
else:
- meson = os.path.join(mesondir, 'meson')
- if os.path.exists (meson):
- return meson
-
- meson = accept_command(["meson.py", "meson"])
-
- return meson
+ return [comp]
+
+ meson = accept_command(['meson.py'])
+ if meson:
+ return [sys.executable, meson]
+ meson = accept_command(['meson'])
+ if meson:
+ return [meson]
+ raise RuntimeError('Could not find Meson')
setup_python_env(options, env)
meson = get_meson()
- targets_s = subprocess.check_output([sys.executable, meson, 'introspect', options.builddir, '--targets'])
+ targets_s = subprocess.check_output(meson + ['introspect', options.builddir, '--targets'])
targets = json.loads(targets_s.decode())
paths = set()
mono_paths = set()
presets = set()
encoding_targets = set()
pkg_dirs = set()
- if '--installed' in subprocess.check_output([sys.executable, meson, 'introspect', '-h']).decode():
- installed_s = subprocess.check_output([sys.executable, meson, 'introspect',
- options.builddir, '--installed'])
+ if '--installed' in subprocess.check_output(meson + ['introspect', '-h']).decode():
+ installed_s = subprocess.check_output(meson + ['introspect', options.builddir, '--installed'])
for path, installpath in json.loads(installed_s.decode()).items():
if path.endswith('.prs'):
presets.add(os.path.dirname(path))
print("Not reconfiguring")
return True
- meson = get_meson()
- if not meson:
+ try:
+ meson = get_meson()
+ except RuntimeError:
print("Install mesonbuild to build %s: http://mesonbuild.com/\n"
"You can simply install it with:\n"
" $ sudo pip3 install meson" % PROJECTNAME)
os.mkdir(build_dir)
try:
- subprocess.check_call(
- [sys.executable, meson, "../"] + self.args + self.get_configs(), cwd=build_dir)
+ subprocess.check_call(meson + ["../"] + self.args + self.get_configs(),
+ cwd=build_dir)
print("\nYou can now build GStreamer and its various subprojects running:\n"
" $ {} -C {!r}".format(os.path.basename(ninja), build_dir))
except subprocess.CalledProcessError: