From 37440c2336b911a48e83f43f277620cb83d7bf6c Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Wed, 4 Jan 2023 13:13:59 +0100 Subject: meson.build: Fix the evaluation of is_git_build on Windows See gtkmm#131 --- meson.build | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 8f7950d..44e2f9c 100644 --- a/meson.build +++ b/meson.build @@ -57,12 +57,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 -- cgit v1.2.3