diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2020-06-03 17:05:55 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2020-09-20 12:57:44 +0100 |
commit | c72625c2a74b198721c6e1f0cb0b653a4cd9addc (patch) | |
tree | cbf0ed5f0c65e80335905060c5280822d965f3fe /mesonbuild/backend/backends.py | |
parent | 007ece4659bba1f3b0aaa4dd5b9cacf0bbb205db (diff) | |
download | meson-c72625c2a74b198721c6e1f0cb0b653a4cd9addc.zip meson-c72625c2a74b198721c6e1f0cb0b653a4cd9addc.tar.gz meson-c72625c2a74b198721c6e1f0cb0b653a4cd9addc.tar.bz2 |
Improve description of meson wrapped custom commands
I've always found ninja reporting 'a meson_exe.py custom command'
unclear and confusing. Instead say we are invoking a custom command,
wrapped by meson, and why.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r-- | mesonbuild/backend/backends.py | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 85d5eb6..156f3bd 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -395,13 +395,30 @@ class Backend: exe_cmd = ['mono'] + exe_cmd exe_wrapper = None - force_serialize = force_serialize or extra_paths or workdir or \ - exe_wrapper or any('\n' in c for c in cmd_args) + reasons = [] + if extra_paths: + reasons.append('to set PATH') + + if exe_wrapper: + reasons.append('to use exe_wrapper') + + if workdir: + reasons.append('to set workdir') + + if any('\n' in c for c in cmd_args): + reasons.append('because command contains newlines') + + force_serialize = force_serialize or bool(reasons) + + if capture: + reasons.append('to capture output') + if not force_serialize: if not capture: - return None - return (self.environment.get_build_command() + - ['--internal', 'exe', '--capture', capture, '--'] + exe_cmd + cmd_args) + return None, '' + return ((self.environment.get_build_command() + + ['--internal', 'exe', '--capture', capture, '--'] + exe_cmd + cmd_args), + ', '.join(reasons)) workdir = workdir or self.environment.get_build_dir() env = {} @@ -425,7 +442,8 @@ class Backend: exe_wrapper, workdir, extra_paths, capture) pickle.dump(es, f) - return self.environment.get_build_command() + ['--internal', 'exe', '--unpickle', exe_data] + return (self.environment.get_build_command() + ['--internal', 'exe', '--unpickle', exe_data], + ', '.join(reasons)) def serialize_tests(self): test_data = os.path.join(self.environment.get_scratch_dir(), 'meson_test_setup.dat') |