vcpkg/ports/python3/0011-gcc-ldflags-fix.patch
Adam Johnson 5599ae4ccf
[python3] Bump to 3.10.7 ()
* [python3] Make patch files contiguous.

When applying these back to the python3 repository and re-formatting,
the gap in patch file numbers requires annoying manual renaming. Debunk
that.

* [python3] Use patch files, not diffs.

Diffs require multiple steps to import into the python3 repository.
Debunk that. The patch format retains authorship information.

* [python3] Fix problems with conflicting patches.

Something modified in the static library patch was being used as a
context line in a later patch. How did this pass CI?

* [python3] Bump to 3.10.7.

* [python3] Fix Windows 7 patch.

* [python3] Back out trivial patch changes.

* [python3] Apply unconditional patches first.

* version things and stuff

* Bump Python tools to 3.10.7.
2022-11-18 11:53:08 -08:00

55 lines
2.3 KiB
Diff

From 84652c4c5658fd443a05bf54fe6040857ba9c36c Mon Sep 17 00:00:00 2001
From: Christoph Neuhauser <c.a.neuhauser@gmail.com>
Date: Sat, 15 Oct 2022 01:14:12 +0200
Subject: [PATCH 11/11] gcc ldflags fix
---
Lib/distutils/unixccompiler.py | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index d00c48981e..b14ce8454e 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -13,7 +13,7 @@
* link shared library handled by 'cc -shared'
"""
-import os, sys, re
+import os, sys, re, shutil
from distutils import sysconfig
from distutils.dep_util import newer
@@ -216,7 +216,27 @@ def library_dir_option(self, dir):
def _is_gcc(self, compiler_name):
# clang uses same syntax for rpath as gcc
- return any(name in compiler_name for name in ("gcc", "g++", "clang"))
+ valid_compiler_names = ("gcc", "g++", "clang")
+ is_gcc = any(name in compiler_name for name in valid_compiler_names)
+ # On Linux systems, the compiler name may be, e.g., "cc -pthread".
+ # The executable "cc" is in this case a symlink to the true compiler.
+ if not is_gcc and "cc" in compiler_name:
+ # We need to make sure that this is not another compiler with "cc"
+ # at the end of its name, like "icc". For this, it is checked
+ # whether "cc" is the first word, or separated by a space or path
+ # delimiter before the "cc" substring.
+ cc_string_location = compiler_name.find("cc")
+ if cc_string_location == 0 \
+ or compiler_name[cc_string_location - 1] == ' ' \
+ or compiler_name[cc_string_location - 1] == '/' \
+ or compiler_name[cc_string_location - 1] == '\\':
+ cc_path = shutil.which("cc")
+ if cc_path is not None:
+ real_compiler_path = os.path.realpath(cc_path)
+ is_gcc = any(
+ name in real_compiler_path \
+ for name in valid_compiler_names)
+ return is_gcc
def runtime_library_dir_option(self, dir):
# XXX Hackish, at the very least. See Python bug #445902:
--
2.37.3.windows.1