summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2023-01-04 13:13:59 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2023-01-04 14:39:52 +0100
commit3f8be4e8a3384eef635196db1a1a83da970e15b9 (patch)
treedd1f743e2ba45af2fad49505ca1f132dfcf20316
parentf740338520a691bb962a2e8d21b28a7f0a086ce1 (diff)
downloadglibmm-3f8be4e8a3384eef635196db1a1a83da970e15b9.tar.gz
meson.build: Fix the evaluation of is_git_build on Windows
See gtkmm#131
-rw-r--r--meson.build15
1 files changed, 10 insertions, 5 deletions
diff --git a/meson.build b/meson.build
index 7c5a5a23..cb78ef16 100644
--- a/meson.build
+++ b/meson.build
@@ -60,12 +60,17 @@ endif
# Suppose we do if and only if the meson.build file is tracked by git.
cmd_py = '''
import shutil, subprocess, sys
-if not shutil.which('git'):
+git_exe = shutil.which('git')
+if not git_exe:
sys.exit(1)
-cmd = [ 'git', 'ls-files', '--error-unmatch', 'meson.build' ]
-sys.exit(subprocess.run(cmd, cwd="@0@", stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode)
-'''.format(project_source_root)
-is_git_build = run_command(python3, '-c', cmd_py, check: false).returncode() == 0
+cmd = [ git_exe, 'ls-files', '--error-unmatch', 'meson.build' ]
+sys.exit(subprocess.run(cmd, cwd=sys.argv[1], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode)
+'''
+is_git_build = run_command(
+ python3, '-c', cmd_py,
+ project_source_root,
+ check: false,
+).returncode() == 0
# Are we testing a dist tarball while it's being built?
# There ought to be a better way. https://github.com/mesonbuild/meson/issues/6866