Skip to content

Commit 37d33e8

Browse files
committed
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
1 parent c57a2ba commit 37d33e8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

meson.build

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,13 @@ if not python_version.version_compare(python_version_req)
4848
endif
4949

5050
# Do we build from a git repository?
51-
# Suppose we do if and only if a .git directory exists.
51+
# Suppose we do if and only if a '.git' directory or file exists.
5252
cmd_py = '''
5353
import os
5454
import sys
55-
sys.exit(0 if os.path.isdir("@0@") else 1)
55+
sys.exit(os.path.isdir("@0@") or os.path.isfile("@0@"))
5656
'''.format(project_source_root / '.git')
57-
is_git_build = run_command(python3, '-c', cmd_py).returncode() == 0
58-
# In Unix-like system, an alternative is
59-
# is_git_build = run_command('test', '-d', project_source_root / '.git').returncode() == 0
60-
# Python code can be used in all operating sytems where Meson can run.
57+
is_git_build = run_command(python3, '-c', cmd_py).returncode() != 0
6158

6259
# Options.
6360
maintainer_mode_opt = get_option('maintainer-mode')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy