summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2019-12-29 18:53:40 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2019-12-29 18:53:40 +0100
commit45b957ac2fd284a322ad7253c36a395cb841b31c (patch)
tree7e9ba0e1688925ce0eb599c8a60dd4c62e4e3bdc
parentcdda4bd7b1a039ea84e855bf16deee820bea04b6 (diff)
downloadsigc++-45b957ac2fd284a322ad7253c36a395cb841b31c.tar.gz
meson.build: Check if .git is a directory or a file
In a git worktree, .git is a regular file. See https://gitlab.gnome.org/GNOME/pangomm/merge_requests/8
-rw-r--r--meson.build9
1 files changed, 3 insertions, 6 deletions
diff --git a/meson.build b/meson.build
index f05c8a0..cd941da 100644
--- a/meson.build
+++ b/meson.build
@@ -48,16 +48,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')