diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2019-12-27 12:41:10 +0100 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2019-12-27 12:41:10 +0100 |
commit | eca90ecd12278b5ebc9b7288c1a9dbfeb09f6dff (patch) | |
tree | 843fe6d37924feadb7fe05be9a7d97b444a02b1c | |
parent | e276bf1260045851b663612d4b49134ab5ec64a9 (diff) | |
download | mm-common-eca90ecd12278b5ebc9b7288c1a9dbfeb09f6dff.tar.gz |
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
-rw-r--r-- | skeletonmm/meson.build | 9 |
1 files 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') |