Permalink
Browse files

configure: always use shlex instead of split

Use shlex module instead of builtin string split to parse CC.
  • Loading branch information...
1 parent 3806cf0 commit fb6c314b6d34ee5c77d7f5fba67bb0bc216ce39b @Hello71 Hello71 committed with bnoordhuis Sep 15, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 configure
View
@@ -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)

0 comments on commit fb6c314

Please sign in to comment.