From fb6c314b6d34ee5c77d7f5fba67bb0bc216ce39b Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Fri, 14 Sep 2012 21:06:25 -0400 Subject: [PATCH] configure: always use shlex instead of split Use shlex module instead of builtin string split to parse CC. --- configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 3a33cfa9f7..3e014ecf68 100755 --- a/configure +++ b/configure @@ -3,6 +3,7 @@ import optparse import os import pprint import re +import shlex import subprocess import sys @@ -205,7 +206,7 @@ def cc_macros(): """Checks predefined macros using the CC command.""" try: - p = subprocess.Popen(CC.split() + ['-dM', '-E', '-'], + p = subprocess.Popen(shlex.split(CC) + ['-dM', '-E', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -225,7 +226,6 @@ def cc_macros(): k = {} for line in out: - import shlex lst = shlex.split(line) if len(lst) > 2: key = lst[1] @@ -310,13 +310,13 @@ def host_arch_win(): def compiler_version(): try: - proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE) + proc = subprocess.Popen(shlex.split(CC) + ['--version'], stdout=subprocess.PIPE) except WindowsError: return (0, False) is_clang = 'clang' in proc.communicate()[0].split('\n')[0] - proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE) + proc = subprocess.Popen(shlex.split(CC) + ['-dumpversion'], stdout=subprocess.PIPE) version = tuple(map(int, proc.communicate()[0].split('.'))) return (version, is_clang)