vcpkg/ports/python3/0014-fix-get-python-inc-output.patch
jim wang 0a3bc3d255
[python3] Fix distutils path (#30822)
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2023-04-26 11:51:50 -07:00

45 lines
1.7 KiB
Diff

From b6ffa6e7a0f7a013fb111e618a7f7e2c58e9d548 Mon Sep 17 00:00:00 2001
From: Billy Robert O'Neal III <bion@microsoft.com>
Date: Wed, 26 Apr 2023 05:17:44 +0000
Subject: [PATCH 14/14] fix get python inc output
---
Lib/distutils/sysconfig.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 3414a761e7..e6ae456ee9 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -45,7 +45,7 @@
get_makefile_filename,
get_python_version,
)
-
+from os.path import dirname
# This is better than
# from sysconfig import _CONFIG_VARS as _config_vars
# because it makes sure that the global dictionary is initialized
@@ -292,6 +292,7 @@ def get_python_inc(plat_specific=0, prefix=None):
incdir = os.path.join(get_config_var('srcdir'), 'Include')
return os.path.normpath(incdir)
python_dir = 'python' + get_python_version() + build_flags
+ prefix = dirname(dirname(BASE_PREFIX))
return os.path.join(prefix, "include", python_dir)
elif os.name == "nt":
if python_build:
@@ -299,7 +300,9 @@ def get_python_inc(plat_specific=0, prefix=None):
# pyconfig.h
return (os.path.join(prefix, "include") + os.path.pathsep +
os.path.join(prefix, "PC"))
- return os.path.join(prefix, "include")
+ python_dir = 'python' + get_python_version() + build_flags
+ prefix = dirname(dirname(BASE_PREFIX))
+ return os.path.join(prefix, "include", python_dir)
else:
raise DistutilsPlatformError(
"I don't know where Python installs its C header files "
--
2.25.1