summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--giscanner/ccompiler.py3
-rw-r--r--giscanner/dumper.py10
2 files changed, 6 insertions, 7 deletions
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index 11bc9fc4..7c1895da 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -19,6 +19,7 @@
#
import os
+import shlex
import subprocess
import tempfile
@@ -213,7 +214,7 @@ class CCompiler(object):
# This is to handle the case where macros are defined in CFLAGS
cflags = os.environ.get('CFLAGS')
if cflags:
- for i, cflag in enumerate(cflags.split()):
+ for i, cflag in enumerate(shlex.split(cflags)):
if cflag.startswith('-D'):
stridx = cflag.find('=')
if stridx > -1:
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index 9077d205..f48fcc11 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -26,6 +26,7 @@ from __future__ import unicode_literals
import os
import sys
+import shlex
import subprocess
import shutil
import tempfile
@@ -232,14 +233,11 @@ class DumpCompiler(object):
# MSVC Builds use the INCLUDE, LIB envvars,
# which are automatically picked up during
# compilation and linking
- cppflags = os.environ.get('CPPFLAGS', '')
- for cppflag in cppflags.split():
+ for cppflag in shlex.split(os.environ.get('CPPFLAGS', '')):
args.append(cppflag)
- cflags = os.environ.get('CFLAGS', '')
- for cflag in cflags.split():
+ for cflag in shlex.split(os.environ.get('CFLAGS', '')):
args.append(cflag)
- ldflags = os.environ.get('LDFLAGS', '')
- for ldflag in ldflags.split():
+ for ldflag in shlex.split(os.environ.get('LDFLAGS', '')):
args.append(ldflag)
# Make sure to list the library to be introspected first since it's