aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-05-23 18:55:08 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-05-24 14:38:28 +0000
commitfecd5806871ee78f81d63934401a1f4c09c8d187 (patch)
treef7965090a20463e5e7649124b1a9cce708d57560
parent165da6fb65d1048ffa34dc583023054c439e276b (diff)
downloadmeson-fecd5806871ee78f81d63934401a1f4c09c8d187.zip
meson-fecd5806871ee78f81d63934401a1f4c09c8d187.tar.gz
meson-fecd5806871ee78f81d63934401a1f4c09c8d187.tar.bz2
backends: Simplify loop getting rpaths for bundled libs
No functionality changes
-rw-r--r--mesonbuild/backend/backends.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 613e489..a7f9ba1 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -334,23 +334,25 @@ class Backend:
def rpaths_for_bundled_shared_libraries(self, target):
paths = []
for dep in target.external_deps:
- if isinstance(dep, (dependencies.ExternalLibrary, dependencies.PkgConfigDependency)):
- la = dep.link_args
- if len(la) == 1 and os.path.isabs(la[0]):
- # The only link argument is an absolute path to a library file.
- libpath = la[0]
- if libpath.startswith(('/usr/lib', '/lib')):
- # No point in adding system paths.
- continue
- if os.path.splitext(libpath)[1] not in ['.dll', '.lib', '.so']:
- continue
- absdir = os.path.dirname(libpath)
- if absdir.startswith(self.environment.get_source_dir()):
- rel_to_src = absdir[len(self.environment.get_source_dir()) + 1:]
- assert not os.path.isabs(rel_to_src), 'rel_to_src: {} is absolute'.format(rel_to_src)
- paths.append(os.path.join(self.build_to_src, rel_to_src))
- else:
- paths.append(absdir)
+ if not isinstance(dep, (dependencies.ExternalLibrary, dependencies.PkgConfigDependency)):
+ continue
+ la = dep.link_args
+ if len(la) != 1 or not os.path.isabs(la[0]):
+ continue
+ # The only link argument is an absolute path to a library file.
+ libpath = la[0]
+ if libpath.startswith(('/usr/lib', '/lib')):
+ # No point in adding system paths.
+ continue
+ if os.path.splitext(libpath)[1] not in ['.dll', '.lib', '.so']:
+ continue
+ absdir = os.path.dirname(libpath)
+ if absdir.startswith(self.environment.get_source_dir()):
+ rel_to_src = absdir[len(self.environment.get_source_dir()) + 1:]
+ assert not os.path.isabs(rel_to_src), 'rel_to_src: {} is absolute'.format(rel_to_src)
+ paths.append(os.path.join(self.build_to_src, rel_to_src))
+ else:
+ paths.append(absdir)
return paths
def determine_rpath_dirs(self, target):