aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2017-06-13 05:44:25 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2017-08-14 22:47:35 -0400
commit879770ccf00f875618960f2063faaeb387377f88 (patch)
treead813625206c7498ed4d3e9df2eafda38e8cadb5 /mesonbuild/backend/ninjabackend.py
parentba6fdb996a56c10ce1517c2b97051619ea083f91 (diff)
downloadmeson-879770ccf00f875618960f2063faaeb387377f88.zip
meson-879770ccf00f875618960f2063faaeb387377f88.tar.gz
meson-879770ccf00f875618960f2063faaeb387377f88.tar.bz2
Only calculate absolute source path when necessary.
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r--mesonbuild/backend/ninjabackend.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 4283896..e9f5acc 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2102,19 +2102,15 @@ rule FORTRAN_DEP_HACK
self.target_arg_cache[key] = commands
commands = CompilerArgs(commands.compiler, commands)
+ build_dir = self.environment.get_build_dir()
if isinstance(src, File):
- source_dir = self.environment.get_source_dir()
- build_dir = self.environment.get_build_dir()
- abs_src = src.absolute_path(source_dir, build_dir)
rel_src = src.rel_to_builddir(self.build_to_src)
- if src.is_built:
- assert abs_src.startswith(build_dir)
- if os.path.isabs(rel_src):
- rel_src = rel_src[len(build_dir) + 1:]
- else:
+ if os.path.isabs(rel_src):
# Source files may not be from the source directory if they originate in source-only libraries,
# so we can't assert that the absolute path is anywhere in particular.
- pass
+ if src.is_built:
+ assert rel_src.startswith(build_dir)
+ rel_src = rel_src[len(build_dir) + 1:]
elif is_generated:
raise AssertionError('BUG: broken generated source file handling for {!r}'.format(src))
else:
@@ -2166,6 +2162,7 @@ rule FORTRAN_DEP_HACK
# outdir argument instead.
# https://github.com/mesonbuild/meson/issues/1348
if not is_generated:
+ abs_src = os.path.join(build_dir, rel_src)
extra_deps += self.get_fortran_deps(compiler, abs_src, target)
# Dependency hack. Remove once multiple outputs in Ninja is fixed:
# https://groups.google.com/forum/#!topic/ninja-build/j-2RfBIOd_8