Skip to content

Commit b9dcf7e

Browse files
committed
meson.build: Simplify if-file-exists test
and use meson.project_[build,source]_root(), new in meson 0.56.0.
1 parent a7d457e commit b9dcf7e

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

meson.build

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ macos_darwin_versions = [
3737
'@0@.@1@'.format(libtool_soversion[0] + 1, libtool_soversion[1])
3838
]
3939

40-
# Use these instead of meson.source_root() and meson.build_root() in subdirectories.
41-
# source_root() and build_root() are not useful, if this is a subproject.
42-
project_source_root = meson.current_source_dir()
43-
project_build_root = meson.current_build_dir()
40+
# Source and build root directories of the current (sub)project.
41+
project_source_root = meson.project_source_root()
42+
project_build_root = meson.project_build_root()
4443

4544
cpp_compiler = meson.get_compiler('cpp')
4645
is_msvc = cpp_compiler.get_id() == 'msvc'
@@ -237,17 +236,9 @@ if maintainer_mode
237236
project_source_root / 'untracked' / 'docs',
238237
check: true,
239238
)
240-
else
241-
cmd_py = '''
242-
import os
243-
import sys
244-
sys.exit(os.path.isfile("@0@"))
245-
'''.format(doc_reference_py)
246-
file_exists = run_command(python3, '-c', cmd_py, check: false).returncode() != 0
247-
if not file_exists
248-
warning('Missing files in untracked/. ' + \
249-
'Enable maintainer-mode if you want to build documentation or create a dist tarball.')
250-
endif
239+
elif not import('fs').is_file(doc_reference_py)
240+
warning('Missing files in untracked/.\n ' + \
241+
'Enable maintainer-mode if you want to build documentation or create a dist tarball.')
251242
endif
252243

253244
# Check if perl is required and available.

0 commit comments

Comments
 (0)