Skip to content

Commit

Permalink
distutils: split CC env var before passing to subprocess
Browse files Browse the repository at this point in the history
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 python#53
  • Loading branch information
lazka authored and naveen521kk committed Jun 23, 2023
1 parent 9935034 commit e5554ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Lib/distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import os
import sys
import copy
import shlex

from distutils.unixccompiler import UnixCCompiler
from distutils.file_util import write_file
Expand Down Expand Up @@ -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')

0 comments on commit e5554ff

Please sign in to comment.