MINGW-packages/mingw-w64-python/0033-Add-AMD64-to-sys-config-so-msvccompiler-get_build_ve.patch
2025-06-07 14:11:54 +02:00

40 lines
1.3 KiB
Diff

From 28bfd9dcda9d2c12ff9f2cdb9c34098ced453e97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
<alexey.pawlow@gmail.com>
Date: Thu, 17 Jun 2021 18:52:07 +0530
Subject: [PATCH 033/N] Add AMD64 to sys config so msvccompiler
get_build_version works
---
Python/getcompiler.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/Python/getcompiler.c b/Python/getcompiler.c
index a5d2623..3e31c80 100644
--- a/Python/getcompiler.c
+++ b/Python/getcompiler.c
@@ -10,7 +10,22 @@
#if defined(__clang__)
#define COMPILER "[Clang " __clang_version__ "]"
#elif defined(__GNUC__)
-#define COMPILER "[GCC " __VERSION__ "]"
+/* To not break compatibility with things that determine
+ CPU arch by calling get_build_version in msvccompiler.py
+ (such as NumPy) add "32 bit" or "64 bit (AMD64)" on Windows
+ and also use a space as a separator rather than a newline. */
+#if defined(_WIN32)
+#define COMP_SEP " "
+#if defined(__x86_64__)
+#define ARCH_SUFFIX " 64 bit (AMD64)"
+#else
+#define ARCH_SUFFIX " 32 bit"
+#endif
+#else
+#define COMP_SEP "\n"
+#define ARCH_SUFFIX ""
+#endif
+#define COMPILER COMP_SEP "[GCC " __VERSION__ ARCH_SUFFIX "]"
// Generic fallbacks.
#elif defined(__cplusplus)
#define COMPILER "[C++]"