Commit e88887be4a
("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>
pull/11390/merge
parent
61d525cc16
commit
c849031513
1 changed files with 9 additions and 2 deletions
Loading…
Reference in new issue