MINGW-packages/mingw-w64-python/0101-distutils-split-CC-env-var-before-passing-to-subproc.patch
2023-12-07 08:12:51 +01:00

34 lines
1.1 KiB
Diff

From c2485a671c907c486d2bd5b60a388005da8a464e Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 7 Nov 2021 23:12:10 +0100
Subject: [PATCH 101/N] 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 2804f69..6e22555 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')