aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-02-05 14:21:30 -0500
committerXavier Claessens <xavier.claessens@collabora.com>2021-02-05 18:17:08 -0500
commitf63e168685c22a749502161355a7ea98a6c5344a (patch)
tree85642d39e70c827d697a1a059b965b2fcdd5f980 /mesonbuild/backend/backends.py
parentb52794b24b61dbd39f4bacf7374ec9337caf89ff (diff)
downloadmeson-f63e168685c22a749502161355a7ea98a6c5344a.zip
meson-f63e168685c22a749502161355a7ea98a6c5344a.tar.gz
meson-f63e168685c22a749502161355a7ea98a6c5344a.tar.bz2
ninjabackend: Remove useless call to replace_paths()
Replacements are already done by eval_custom_target_command() and must be done BEFORE calling as_meson_exe_cmdline() anyway. replace_paths() is still used by generators. Make eval_custom_target_command() more readable by handling error in the final else case instead of in the middle of elif.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index a29cac8..d96ac9a 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -1124,10 +1124,7 @@ class Backend:
i = os.path.join(self.environment.get_build_dir(), i)
# FIXME: str types are blindly added ignoring 'target.absolute_paths'
# because we can't know if they refer to a file or just a string
- elif not isinstance(i, str):
- err_msg = 'Argument {0} is of unknown type {1}'
- raise RuntimeError(err_msg.format(str(i), str(type(i))))
- else:
+ elif isinstance(i, str):
if '@SOURCE_ROOT@' in i:
i = i.replace('@SOURCE_ROOT@', source_root)
if '@BUILD_ROOT@' in i:
@@ -1157,6 +1154,9 @@ class Backend:
else:
lead_dir = self.environment.get_build_dir()
i = i.replace(source, os.path.join(lead_dir, outdir))
+ else:
+ err_msg = 'Argument {0} is of unknown type {1}'
+ raise RuntimeError(err_msg.format(str(i), str(type(i))))
cmd.append(i)
# Substitute the rest of the template strings
values = mesonlib.get_filenames_templates_dict(inputs, outputs)