aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-03-24 20:58:09 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-04-04 22:30:13 +0530
commit09fee02dd9484e682401469ff890cf99ef5fa56a (patch)
treeaaf5aa6b8f2a994e4d7f12d9bb5597a44406338a /mesonbuild/environment.py
parentde47541e6cee66e17b44981b9264f0ea75181b06 (diff)
downloadmeson-09fee02dd9484e682401469ff890cf99ef5fa56a.zip
meson-09fee02dd9484e682401469ff890cf99ef5fa56a.tar.gz
meson-09fee02dd9484e682401469ff890cf99ef5fa56a.tar.bz2
Use shlex.split() to split CFLAGS/LDFLAGS/etc
This allows people to use spaces in the environment variables as long as they use the correct quoting.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 1beb63c..f2de31a 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -781,12 +781,12 @@ def get_args_from_envvars(compiler):
'd': 'DFLAGS'}
compile_flags = os.environ.get(cflags_mapping[lang], '')
log_var(cflags_mapping[lang], compile_flags)
- compile_flags = compile_flags.split()
+ compile_flags = shlex.split(compile_flags)
# Link flags (same for all languages)
link_flags = os.environ.get('LDFLAGS', '')
log_var('LDFLAGS', link_flags)
- link_flags = link_flags.split()
+ link_flags = shlex.split(link_flags)
if compiler_is_linker:
# When the compiler is used as a wrapper around the linker (such as
# with GCC and Clang), the compile flags can be needed while linking
@@ -799,7 +799,8 @@ def get_args_from_envvars(compiler):
if lang in ('c', 'cpp', 'objc', 'objcpp'):
preproc_flags = os.environ.get('CPPFLAGS', '')
log_var('CPPFLAGS', preproc_flags)
- compile_flags += preproc_flags.split()
+ preproc_flags = shlex.split(preproc_flags)
+ compile_flags += preproc_flags
return compile_flags, link_flags