From e5554ffa16ed49b14dd772583a6aeb6c5ac0727b Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sun, 7 Nov 2021 23:12:10 +0100 Subject: [PATCH] distutils: split CC env var before passing to subprocess In case CC="ccache gcc" then subprocess would interpret it as one command and fail to find it. Instead split the command line into separate arguments. Fixes #53 --- Lib/distutils/cygwinccompiler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index 2804f693815045..6e22555af72fef 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -50,6 +50,7 @@ import os import sys import copy +import shlex from distutils.unixccompiler import UnixCCompiler from distutils.file_util import write_file @@ -353,5 +354,5 @@ def check_config_h(): def is_cygwincc(cc): '''Try to determine if the compiler that would be used is from cygwin.''' - out_string = check_output([cc, '-dumpmachine']) + out_string = check_output(shlex.split(cc) + ['-dumpmachine']) return out_string.strip().endswith(b'cygwin')