aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-11-03 13:26:41 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-11-11 23:06:49 +0530
commit65edbf35ef728034a9bf4dfd304e6d42aac384b7 (patch)
treeefbdcdf74da2811194fc636276327a6c30bba64e /mesonbuild
parent22f459a7dd8d6d815ade836b6ea9404572cbc92b (diff)
downloadmeson-65edbf35ef728034a9bf4dfd304e6d42aac384b7.zip
meson-65edbf35ef728034a9bf4dfd304e6d42aac384b7.tar.gz
meson-65edbf35ef728034a9bf4dfd304e6d42aac384b7.tar.bz2
dependencies: Use shlex to parse pkg-config cflags and libs
Escaping spaces with '\ ' is the only way that works with both pkg-config and pkgconf, so quote that way and unquote inside Meson. This should work on all platforms. Also fix the unit test to do the same. https://github.com/pkgconf/pkgconf/issues/153
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/base.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 6592495..8d364a8 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -16,9 +16,10 @@
# Custom logic for several other packages are in separate files.
import os
-import shutil
-import stat
import sys
+import stat
+import shlex
+import shutil
from enum import Enum
from .. import mlog
@@ -267,7 +268,7 @@ class PkgConfigDependency(ExternalDependency):
if ret != 0:
raise DependencyException('Could not generate cargs for %s:\n\n%s' %
(self.name, out))
- self.compile_args = out.split()
+ self.compile_args = shlex.split(out)
def _set_libs(self):
libcmd = [self.name, '--libs']
@@ -279,7 +280,7 @@ class PkgConfigDependency(ExternalDependency):
(self.name, out))
self.link_args = []
libpaths = []
- for lib in out.split():
+ for lib in shlex.split(out):
# If we want to use only static libraries, we have to look for the
# file ourselves instead of depending on the compiler to find it
# with -lfoo or foo.lib. However, we can only do this if we already