Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
configure: always use shlex instead of split
Browse files Browse the repository at this point in the history
Use shlex module instead of builtin string split to parse CC.
  • Loading branch information
Hello71 authored and bnoordhuis committed Sep 17, 2012
1 parent 3806cf0 commit fb6c314
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions configure
Expand Up @@ -3,6 +3,7 @@ import optparse
import os
import pprint
import re
import shlex
import subprocess
import sys

Expand Down Expand Up @@ -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)
Expand All @@ -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]
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fb6c314

Please sign in to comment.