aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-07-28 21:06:00 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-07-28 21:06:00 +0530
commit48b4defa3781dac7bd9bf7988664c9de4f576a07 (patch)
treedb5213bd75f5a13241b0c0aabfb2f987bf2437b6
parentbc63103ae02d8cca96ed9f4f130f0eca2d2abd4f (diff)
downloadmeson-48b4defa3781dac7bd9bf7988664c9de4f576a07.zip
meson-48b4defa3781dac7bd9bf7988664c9de4f576a07.tar.gz
meson-48b4defa3781dac7bd9bf7988664c9de4f576a07.tar.bz2
pkg-config: Move setting of cargs and libs to functions
Much cleaner this way. It's completely clear what each block of code does.
-rw-r--r--mesonbuild/dependencies.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py
index a62973e..bfcc420 100644
--- a/mesonbuild/dependencies.py
+++ b/mesonbuild/dependencies.py
@@ -139,19 +139,26 @@ class PkgConfigDependency(Dependency):
(name, self.version_requirement, self.modversion))
if not self.is_found:
return
- p = subprocess.Popen([pkgbin, '--cflags', name], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ # Fetch cargs to be used while using this dependency
+ self._set_cargs()
+ # Fetch the libraries and library paths needed for using this
+ self._set_libs()
+
+ def _set_cargs(self):
+ p = subprocess.Popen([self.pkgbin, '--cflags', self.name],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode != 0:
raise DependencyException('Could not generate cargs for %s:\n\n%s' % \
(name, out.decode(errors='ignore')))
self.cargs = out.decode().split()
- libcmd = [pkgbin, '--libs']
+ def _set_libs(self):
+ libcmd = [self.pkgbin, '--libs']
if self.static:
libcmd.append('--static')
- p = subprocess.Popen(libcmd + [name], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ p = subprocess.Popen(libcmd + [self.name],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode != 0:
raise DependencyException('Could not generate libs for %s:\n\n%s' % \
@@ -170,7 +177,6 @@ class PkgConfigDependency(Dependency):
'library path' % lib)
lib = shared_lib
self.is_libtool = True
-
self.libs.append(lib)
def get_variable(self, variable_name):