diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2019-12-29 19:00:52 +0100 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2019-12-29 19:00:52 +0100 |
commit | 37d33e89546aa2d4b9c51bc60555364d9e1fe26b (patch) | |
tree | 149a0d6cf9b13773c165c45d6da33697a2a4806c | |
parent | c57a2baab6ffd69dd1b27e52303d0777b75aec29 (diff) | |
download | sigc++-37d33e89546aa2d4b9c51bc60555364d9e1fe26b.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.build | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/meson.build b/meson.build index 7589a33..8fab891 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') |