[mm-common] skeletonmm/meson.build: Check if .git is a directory or a file
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mm-common] skeletonmm/meson.build: Check if .git is a directory or a file
- Date: Fri, 27 Dec 2019 11:47:32 +0000 (UTC)
commit eca90ecd12278b5ebc9b7288c1a9dbfeb09f6dff
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Fri Dec 27 12:41:10 2019 +0100
skeletonmm/meson.build: Check if .git is a directory or a file
In a git worktree, .git is a regular file.
See MR pangomm!8
skeletonmm/meson.build | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/skeletonmm/meson.build b/skeletonmm/meson.build
index 558b8b4..2274d32 100644
--- a/skeletonmm/meson.build
+++ b/skeletonmm/meson.build
@@ -44,16 +44,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
# Options.
maintainer_mode_opt = get_option('maintainer-mode')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]