diff options
author | Stefan Hajnoczi <stefanha@gmail.com> | 2023-01-29 08:42:32 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2023-03-01 08:56:46 -0500 |
commit | c8490315133166136b6dd8ac8b94c7349240eea0 (patch) | |
tree | 2edb69c28e561f3fc15edb0db8b720f11ba70afb /unittests/datatests.py | |
parent | 61d525cc16a10dcd780d2fc14a7371dc809223d0 (diff) | |
download | meson-c8490315133166136b6dd8ac8b94c7349240eea0.zip meson-c8490315133166136b6dd8ac8b94c7349240eea0.tar.gz meson-c8490315133166136b6dd8ac8b94c7349240eea0.tar.bz2 |
backends: fix source dir stripping from rpaths
Commit e88887be4a08 ("Only remove substring if it is part of string")
removed the source dir from the rpath when the following check succeeds:
if absdir.startswith(self.environment.get_source_dir()):
rel_to_src = absdir[len(self.environment.get_source_dir()) + 1:]
For example, absdir '/myproject/foo' starts with source dir
'/myproject', so we want to generate the relative path 'foo'.
This code doesn't work with absdir '/myproject-libs/foo' though, because
we'll incorrectly turn it into a relative path 'libs/foo' after
stripping away '/myproject-'.
Use os.path.commonpath() instead of str.startswith() so path components
are correctly handled.
Cc: Niklas Claesson <niklas.claesson@cosylab.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Diffstat (limited to 'unittests/datatests.py')
0 files changed, 0 insertions, 0 deletions