aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <atash@google.com>2016-07-16 00:17:10 -0700
committerGravatar Masood Malekghassemi <atash@google.com>2016-07-16 01:31:51 -0700
commita39c2cb4f2881351fb8844d5e5a49e5bc80e2f8a (patch)
tree0ee025fddfa9b5aa72aaf8c98842caa2c4ae7c29 /src
parentc089a58a20b5f6ca996640016cdcba4d62712601 (diff)
Handle distutils command idiosyncracies
Diffstat (limited to 'src')
-rw-r--r--src/python/grpcio/_unixccompiler_patch.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/python/grpcio/_unixccompiler_patch.py b/src/python/grpcio/_unixccompiler_patch.py
index 0ce5d63e98..894c3ef395 100644
--- a/src/python/grpcio/_unixccompiler_patch.py
+++ b/src/python/grpcio/_unixccompiler_patch.py
@@ -34,6 +34,7 @@ from distutils import errors
from distutils import unixccompiler
import os
import os.path
+import shlex
import shutil
import sys
import tempfile
@@ -47,6 +48,9 @@ def _unix_commandfile_spawn(self, command):
Some commands like `gcc` (and friends like `clang`) support command files to
work around shell command length limits.
"""
+ # Sometimes distutils embeds the executables as full strings including some
+ # hard-coded flags rather than as lists.
+ command = list(shlex.split(command[0])) + list(command[1:])
command_base = os.path.basename(command[0].strip())
if command_base == 'ccache':
command_base = command[:2]