[gtkmm: 2/3] Fix meson.build .git check
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm: 2/3] Fix meson.build .git check
- Date: Mon, 26 Sep 2022 12:54:16 +0000 (UTC)
commit 93c8131c2c449f9c7694d8e079040ae8a5359b2b
Author: William Roy <wroy proton me>
Date: Sun Sep 25 16:10:38 2022 +0000
Fix meson.build .git check
Co-authored-by: Kjell Ahlstedt <kjellahlstedt gmail com>
meson.build | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index a8cdf866..6330e403 100644
--- a/meson.build
+++ b/meson.build
@@ -56,13 +56,21 @@ if not python_version.version_compare(python_version_req)
endif
# Do we build from a git repository?
-# Suppose we do if and only if a '.git' directory or file exists.
+# Suppose we do if and only if the meson.build file is tracked by git.
cmd_py = '''
import os
import sys
-sys.exit(os.path.isdir("@0@") or os.path.isfile("@0@") or os.path.dirname("@0@"))
-'''.format(project_source_root / '.git')
-is_git_build = run_command(python3, '-c', cmd_py, check: false).returncode() != 0
+import subprocess
+import shutil
+
+if not shutil.which('git'):
+ 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
# 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]