[pangomm/pangomm-2-42] meson.build: Check if .git is a directory or file
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm/pangomm-2-42] meson.build: Check if .git is a directory or file
- Date: Fri, 27 Dec 2019 10:21:56 +0000 (UTC)
commit ebd724be9acf54e1fccf12c4036704e175e97ecb
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Fri Dec 27 11:01:17 2019 +0100
meson.build: Check if .git is a directory or file
In a git worktree, .git is a regular file.
See MR !8 (Ting-Wei Lan)
meson.build | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/meson.build b/meson.build
index 6b7c964..5b1c3e4 100644
--- a/meson.build
+++ b/meson.build
@@ -47,17 +47,13 @@ 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 exists.
+# Suppose we do if and only if a '.git' directory or file exists.
cmd_py = '''
import os
import sys
-sys.exit(0 if os.path.isdir("@0@") else 1)
+sys.exit(os.path.isdir("@0@") or os.path.isfile("@0@"))
'''.format(project_source_root / '.git')
-is_git_build = run_command(python3, '-c', cmd_py).returncode() == 0
-
-# In Unix-like system, an alternative is
-# is_git_build = run_command('test', '-d', project_source_root / '.git').returncode() == 0
-# Python code can be used in all operating sytems where Meson can run.
+is_git_build = run_command(python3, '-c', cmd_py).returncode() != 0
# Unfortunately due to m4 requirements, we cannot support MSVC builds
# directly from GIT checkouts
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]