[python3] Update to 3.12.9, drop Windows 7 support (#40996)

This commit is contained in:
Osyotr 2025-04-09 23:24:48 +03:00 committed by GitHub
parent e1877ab371
commit ce613c4137
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 124 additions and 554 deletions

View File

@ -1,7 +1,7 @@
--- a/tools/g-ir-tool-template.in 2021-09-17 23:02:42.601052000 +0700
+++ b/tools/g-ir-tool-template.in 2021-12-29 21:41:52.987141900 +0700
@@ -59,7 +59,7 @@
builtins.__dict__['GIRDIR'] = [girdir]
builtins.__dict__['GIR_DIR'] = gir_dir
# Again, relative paths first so that the installation prefix is relocatable
-pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection'))

View File

@ -1,7 +1,7 @@
--- a/gir/meson.build 2021-09-17 23:02:42.502052000 +0700
+++ b/gir/meson.build 2022-01-05 02:31:25.960457800 +0700
@@ -42,7 +42,7 @@
install_data(gir_files, install_dir: girdir)
install_data(installed_gir_files, install_dir: girdir)
scanner_command = [
- find_program('g-ir-scanner', native: true),
@ -15,11 +15,11 @@
typelibs = []
+gircompiler = find_program('g-ir-compiler')
if get_option('gi_cross_binary_wrapper') != ''
gircompiler_command = [get_option('gi_cross_binary_wrapper'), gircompiler.full_path(), ]
gircompiler_command = [get_option('gi_cross_binary_wrapper'), gircompiler.full_path(), ]
else
@@ -510,7 +511,7 @@
typelibs += custom_target('generate-typelib-@0@'.format(gir).underscorify(),
input: gir,
typelibs += custom_target(
input: gir.get('file'),
output: '@BASENAME@.typelib',
- depends: [gobject_gir, gircompiler, ],
+ depends: [gobject_gir, ],
@ -39,7 +39,7 @@
girgenerate = executable('g-ir-generate', 'generate.c',
dependencies: [
@@ -74,11 +76,15 @@
@@ -74,14 +76,18 @@
install: true,
c_args: custom_c_args,
)
@ -49,7 +49,10 @@
+endif
girinspect = executable('g-ir-inspect', 'g-ir-inspect.c',
dependencies: girepo_dep,
dependencies: [
girepo_dep,
gio_dep,
],
install: true,
c_args: custom_c_args,
)

View File

@ -11,12 +11,15 @@ index 75c35a7..499ed01 100644
# Fallback to hard-coded paths if the relocatable paths are wrong
if not os.path.isdir(os.path.join(datadir, 'gir-1.0')):
datadir = "@datarootdir@"
@@ -55,7 +55,7 @@ builtins.__dict__['DATADIR'] = datadir
@@ -53,10 +53,7 @@ builtins.__dict__['DATADIR'] = datadir
# Respect gir_dir_prefix
girdir = ''
-girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@'))
+girdir = datadir
builtins.__dict__['GIRDIR'] = [girdir]
builtins.__dict__['DATADIR'] = datadir
-gir_dir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@', 'gir-1.0'))
-# Fallback to hard-coded paths if the relocatable paths are wrong
-if not os.path.isdir(gir_dir):
- gir_dir = "@GIR_DIR@"
+gir_dir = datadir
builtins.__dict__['GIR_DIR'] = gir_dir
# Again, relative paths first so that the installation prefix is relocatable

View File

@ -0,0 +1,12 @@
diff --git a/giscanner/scannerlexer.l b/giscanner/scannerlexer.l
index 38e21534edfa6c92f2ecb6c8a68b6d0360c21c64..4ca62d21f8fa8e663db152415d0ef85cfe6107f5 100644
--- a/giscanner/scannerlexer.l
+++ b/giscanner/scannerlexer.l
@@ -193,6 +193,7 @@ stringtext ([^\\\"])|(\\.)
"__declspec(deprecated(".*"))" { /* Ignore */ }
"__declspec"[\t ]*"("[a-z\t ]+")" { /* Ignore */ }
"__stdcall" { /* ignore */ }
+"__fastcall" { /* ignore */ }
"__w64" { /* ignore */ }
"G_GINT64_CONSTANT" { return INTL_CONST; }

View File

@ -1,11 +0,0 @@
diff --git a/meson.build b/meson.build
index b253927..312fbdc 100644
--- a/meson.build
+++ b/meson.build
@@ -254,5 +254,5 @@ endif
pkgconfig_variables = [
'datadir=' + '${prefix}' / get_option('datadir'),
- 'bindir=' + '${prefix}' / get_option('bindir'),
+ 'bindir=' + '${prefix}/tools/gobject-introspection',
'g_ir_scanner=${bindir}/g-ir-scanner',
'g_ir_compiler=${bindir}/g-ir-compiler@0@'.format(exe_ext),

View File

@ -1,11 +1,11 @@
set(GI_MAJOR_MINOR 1.72)
# vcpkg_from_* is not used because the project uses submodules.
string(REGEX MATCH "^([0-9]*[.][0-9]*)" GI_MAJOR_MINOR "${VERSION}")
set(GI_PATCH 0)
vcpkg_download_distfile(ARCHIVE
URLS "https://download.gnome.org/sources/gobject-introspection/${GI_MAJOR_MINOR}/gobject-introspection-${GI_MAJOR_MINOR}.${GI_PATCH}.tar.xz"
FILENAME "gobject-introspection-${GI_MAJOR_MINOR}.${GI_PATCH}.tar.xz"
SHA512 b8fba2bd12e93776c55228acf3487bef36ee40b1abdc7f681b827780ac94a8bfa1f59b0c30d60fa5a1fea2f610de78b9e52029f411128067808f17eb6374cdc5
URLS "https://download.gnome.org/sources/gobject-introspection/${GI_MAJOR_MINOR}/gobject-introspection-${VERSION}.tar.xz"
FILENAME "gobject-introspection-${VERSION}.tar.xz"
SHA512 e139fadb4174c72b648914f3774d89fc0e5eaee45bba0c13edf05de883664dad8276dbc34006217bb09871ed4bad23adab51ff232a17b9eb131329b2926cafb7
)
vcpkg_extract_source_archive(
@ -15,7 +15,7 @@ vcpkg_extract_source_archive(
0001-g-ir-tool-template.in.patch
0002-cross-build.patch
0003-fix-paths.patch
fix-pkgconfig.patch
0004-fastcall.patch # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/498
)
vcpkg_find_acquire_program(FLEX)
@ -34,6 +34,18 @@ else()
endif()
endif()
find_file(INITIAL_PYTHON3
NAMES "python3${VCPKG_HOST_EXECUTABLE_SUFFIX}" "python${VCPKG_HOST_EXECUTABLE_SUFFIX}"
PATHS "${PYTHON_DIR}/tools/python3"
NO_DEFAULT_PATH
REQUIRED
)
x_vcpkg_get_python_packages(OUT_PYTHON_VAR PYTHON3
PYTHON_EXECUTABLE "${INITIAL_PYTHON3}"
PYTHON_VERSION "3"
PACKAGES setuptools
)
vcpkg_configure_meson(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG
@ -46,7 +58,7 @@ vcpkg_configure_meson(
g-ir-annotation-tool='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-annotation-tool'
g-ir-compiler='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-compiler${VCPKG_HOST_EXECUTABLE_SUFFIX}'
g-ir-scanner='${CURRENT_HOST_INSTALLED_DIR}/tools/gobject-introspection/g-ir-scanner'
python='${PYTHON_DIR}/tools/python3/python${VCPKG_HOST_EXECUTABLE_SUFFIX}'
python='${PYTHON3}'
)
vcpkg_host_path_list(APPEND ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")

View File

@ -1,7 +1,6 @@
{
"name": "gobject-introspection",
"version": "1.72.0",
"port-version": 9,
"version": "1.82.0",
"description": "A middleware layer between C libraries (using GObject) and language bindings.",
"homepage": "https://gi.readthedocs.io/en/latest/",
"license": null,
@ -31,6 +30,10 @@
"host": true,
"platform": "!(windows & x86)"
},
{
"name": "vcpkg-get-python-packages",
"host": true
},
{
"name": "vcpkg-tool-meson",
"host": true

View File

@ -1,5 +1,5 @@
vcpkg_download_distfile(ARCHIVE
URLS "https://netcologne.dl.sourceforge.net/project/omniorb/omniORB/omniORB-4.3.0/omniORB-4.3.0.tar.bz2"
URLS "https://netcologne.dl.sourceforge.net/project/omniorb/omniORB/omniORB-${VERSION}/omniORB-${VERSION}.tar.bz2"
FILENAME "omniORB-${VERSION}.tar.bz2"
SHA512 b081c1acbea3c7bee619a288fec209a0705b7d436f8e5fd4743675046356ef271a8c75882334fcbde4ff77d15f54d2da55f6cfcd117b01e42919d04fd29bfe2f
)

View File

@ -2,14 +2,19 @@ diff --git a/mk/python.mk b/mk/python.mk
index 1380018..fb321a5 100644
--- a/mk/python.mk
+++ b/mk/python.mk
@@ -4,7 +4,7 @@
@@ -3,10 +3,10 @@
#############################################################################
PYVERSION := $(shell $(PYTHON) -c 'import sys; sys.stdout.write(".".join(sys.version.split(".")[:2]))')
PYPREFIX := $(shell $(PYTHON) -c 'import sys; sys.stdout.write(sys.exec_prefix.replace("\\","/"))')
-PYPREFIX := $(shell $(PYTHON) -c 'import sys; sys.stdout.write(sys.exec_prefix.replace("\\","/"))')
-PYINCDIR := $(shell $(PYTHON) -c 'import sys, distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_python_inc().replace("\\","/"))')
+PYPREFIX := $(shell $(PYTHON) -c 'import sys; sys.stdout.write(sys.exec_prefix.replace("\\","/").replace(" ","\\ "))')
+PYINCDIR := $(includedir)/python$(PYVERSION)
PythonSHAREDLIB_SUFFIX = $(shell $(PYTHON) -c 'import sys, distutils.sysconfig; sys.stdout.write((distutils.sysconfig.get_config_var("SO") or ".so").lstrip("."))')
-PythonSHAREDLIB_SUFFIX = $(shell $(PYTHON) -c 'import sys, distutils.sysconfig; sys.stdout.write((distutils.sysconfig.get_config_var("SO") or ".so").lstrip("."))')
+PythonSHAREDLIB_SUFFIX = $(shell $(PYTHON) -c 'import sys, sysconfig; sys.stdout.write((sysconfig.get_config_var("SO") or ".so").lstrip("."))')
PY_MODULE_SUFFIX := $(shell $(PYTHON) -c 'import sys; sys.stdout.write((sys.hexversion < 0x3000000 and not hasattr(sys, "pypy_version_info")) and "module" or "")')
diff --git a/src/tool/omniidl/cxx/idlpython.cc b/src/tool/omniidl/cxx/idlpython.cc
index 639515105..27ad3ee0e 100644

View File

@ -1,7 +1,7 @@
{
"name": "omniorb",
"version": "4.3.0",
"port-version": 3,
"port-version": 4,
"description": "omniORB is a robust high performance CORBA ORB for C++",
"homepage": "https://omniorb.sourceforge.io/",
"license": "LGPL-2.1-or-later",

View File

@ -36,7 +36,7 @@ index 4d416c589e..ede9868a8f 100644
- <Projects Include="pyshellext.vcxproj" />
+ <Projects Include="pyshellext.vcxproj" Condition="false" />
<!-- Extension modules -->
<ExtensionModules Include="_asyncio;_zoneinfo;_decimal;_elementtree;_msi;_multiprocessing;_overlapped;pyexpat;_queue;select;unicodedata;winsound;_uuid" />
<ExtensionModules Include="_asyncio;_zoneinfo;_decimal;_elementtree;_msi;_multiprocessing;_overlapped;pyexpat;_queue;select;unicodedata;winsound;_uuid;_wmi" />
<ExtensionModules Include="_ctypes" Condition="$(IncludeCTypes)" />
<!-- Extension modules that require external sources -->
<ExternalModules Include="_bz2;_lzma;_sqlite3" />

View File

@ -9,23 +9,6 @@ builds the pythoncore as a static library instead of a DLL
PCbuild/pythoncore.vcxproj | 4 ++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Modules/getpath.c b/Modules/getpath.c
index d7d3cf081e..34269f0b75 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -801,10 +801,12 @@ static int
library_to_dict(PyObject *dict, const char *key)
{
#ifdef MS_WINDOWS
+#ifdef Py_ENABLE_SHARED
extern HMODULE PyWin_DLLhModule;
if (PyWin_DLLhModule) {
return winmodule_to_dict(dict, key, PyWin_DLLhModule);
}
+#endif
#elif defined(WITH_NEXT_FRAMEWORK)
static char modPath[MAXPATHLEN + 1];
static int modPathInitialized = -1;
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index d7d3cf081e..34269f0b75 100644
--- a/PC/pyconfig.h
@ -55,7 +38,7 @@ index d7d3cf081e..34269f0b75 100644
+# endif /* Py_WINVER */
#endif /* MS_COREDLL */
#if defined(MS_WIN64)
#ifdef MS_WIN64
diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
index 70c336a9d3..ba797e8afd 100644
--- a/PCbuild/pcbuild.proj
@ -84,7 +67,7 @@ index 2625d0293d..2f8bdaa931 100644
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -102,7 +102,7 @@
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(PySourcePath)Python;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(PySourcePath)Modules\_hacl\include;$(PySourcePath)Modules\_hacl\internal;$(PySourcePath)Python;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="$(IncludeExternals)">$(zlibDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -104,36 +87,6 @@ index 2625d0293d..2f8bdaa931 100644
<Optimization>Disabled</Optimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index ac49f7867a..f3583345ff 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -163,6 +163,7 @@ static char *GetPythonImport (HINSTANCE hModule)
return NULL;
}
+#ifdef Py_ENABLE_SHARED
/* Load python3.dll before loading any extension module that might refer
to it. That way, we can be sure that always the python3.dll corresponding
to this python DLL is loaded, not a python3.dll that might be on the path
@@ -216,6 +217,7 @@ _Py_CheckPython3(void)
return hPython3 != NULL;
#undef MAXPATHLEN
}
+#endif /* Py_ENABLE_SHARED */
dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
const char *shortname,
@@ -224,7 +226,9 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
dl_funcptr p;
char funcname[258], *import_python;
+#ifdef Py_ENABLE_SHARED
_Py_CheckPython3();
+#endif /* Py_ENABLE_SHARED */
#if USE_UNICODE_WCHAR_CACHE
const wchar_t *wpathname = _PyUnicode_AsUnicode(pathname);
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index ac49f7867a..f3583345ff 100644
--- a/Python/sysmodule.c

View File

@ -1,326 +0,0 @@
From e30a560527d17ae81685dd11d3268bc982af2048 Mon Sep 17 00:00:00 2001
From: Adam Johnson <AdamJohnso@gmail.com>
Date: Tue, 16 Feb 2021 18:03:07 -0500
Subject: [PATCH 7/7] restore support for windows 7
this backports the windows 7 compatible fix for bpo-39401 from gh-18234,
originally authored by Steve Dower, and removes explicit dependencies on
pathcch.
The same mechanism is applied to fix posixmodule.c
---
index 25ddc82..ff51042 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -44,6 +44,15 @@
#include "pycore_runtime.h" // _Py_ID
+// The Windws 7 patch lowers the API version such that these constants
+// are no longer defined by the Windows SDK. Debounce that.
+#ifndef LCMAP_SORTHANDLE
+# define LCMAP_SORTHANDLE 0x20000000
+#endif
+#ifndef LCMAP_HASH
+# define LCMAP_HASH 0x00040000
+#endif
+
#if defined(MS_WIN32) && !defined(MS_WIN64)
#define HANDLE_TO_PYNUM(handle) \
PyLong_FromUnsignedLong((unsigned long) handle)
diff --git a/Modules/getpath.c b/Modules/getpath.c
index bc730fc..7d3d559 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -11,7 +11,7 @@
#ifdef MS_WINDOWS
# include <windows.h> // GetFullPathNameW(), MAX_PATH
-# include <pathcch.h>
+# include <Shlwapi.h>
#endif
#ifdef __APPLE__
@@ -217,6 +217,11 @@ getpath_isfile(PyObject *Py_UNUSED(self), PyObject *args)
return r;
}
+#ifdef MS_WINDOWS
+static int _PathCchFindExtension_Initialized = 0;
+typedef HRESULT (__stdcall *PPathCchFindExtension) (PCWSTR pszPath, size_t cchPath, PCWSTR *ppszExt);
+static PPathCchFindExtension _PathCchFindExtension;
+#endif
static PyObject *
getpath_isxfile(PyObject *Py_UNUSED(self), PyObject *args)
@@ -231,13 +235,51 @@ getpath_isxfile(PyObject *Py_UNUSED(self), PyObject *args)
path = PyUnicode_AsWideCharString(pathobj, &cchPath);
if (path) {
#ifdef MS_WINDOWS
+
+ if (_PathCchFindExtension_Initialized == 0) {
+ HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
+
+ if (pathapi) {
+ _PathCchFindExtension = (PPathCchFindExtension)GetProcAddress(pathapi, "PathCchFindExtension");
+ } else {
+ _PathCchFindExtension = NULL;
+ }
+
+ _PathCchFindExtension_Initialized = 1;
+ }
+
const wchar_t *ext;
DWORD attr = GetFileAttributesW(path);
- r = (attr != INVALID_FILE_ATTRIBUTES) &&
- !(attr & FILE_ATTRIBUTE_DIRECTORY) &&
- SUCCEEDED(PathCchFindExtension(path, cchPath + 1, &ext)) &&
- (CompareStringOrdinal(ext, -1, L".exe", -1, 1 /* ignore case */) == CSTR_EQUAL)
- ? Py_True : Py_False;
+ if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) {
+ r = Py_False;
+ }
+ else {
+ HRESULT hr = S_OK;
+ if (_PathCchFindExtension) {
+ hr = _PathCchFindExtension(path, cchPath + 1, &ext);
+ }
+ else {
+ if (cchPath > MAX_PATH) {
+ hr = E_FAIL;
+ }
+ else {
+ ext = PathFindExtensionW(path);
+ if (*ext == '\0')
+ hr = E_FAIL;
+ }
+ }
+
+ if (!SUCCEEDED(hr)) {
+ r = Py_False;
+ }
+ else if (CompareStringOrdinal(ext, -1, L".exe", -1, 1 /* ignore case */) != CSTR_EQUAL) {
+ r = Py_False;
+ }
+ else {
+ r = Py_True;
+ }
+ }
#else
struct stat st;
r = (_Py_wstat(path, &st) == 0) &&
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -15,7 +15,7 @@
// whereas pycore_condvar.h defines the WIN32_LEAN_AND_MEAN macro.
#ifdef MS_WINDOWS
# include <windows.h>
-# include <pathcch.h>
+# include <Shlwapi.h>
# include <lmcons.h> // UNLEN
# include "osdefs.h" // SEP
# define HAVE_SYMLINK
@@ -4471,6 +4471,11 @@ os__getvolumepathname_impl(PyObject *module, path_t *path)
return result;
}
+#ifdef MS_WINDOWS
+static int _PathCchSkipRoot_Initialized = 0;
+typedef HRESULT (__stdcall *PPathCchSkipRoot) (PCWSTR pszPath, PCWSTR *ppszRootEnd);
+static PPathCchSkipRoot _PathCchSkipRoot;
+#endif
/*[clinic input]
os._path_splitroot
@@ -4489,6 +4493,19 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
PyObject *result = NULL;
HRESULT ret;
+ if (_PathCchSkipRoot_Initialized == 0) {
+ HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
+
+ if (pathapi) {
+ _PathCchSkipRoot = (PPathCchSkipRoot)GetProcAddress(pathapi, "PathCchSkipRoot");
+ } else {
+ _PathCchSkipRoot = NULL;
+ }
+
+ _PathCchSkipRoot_Initialized = 1;
+ }
+
buffer = (wchar_t*)PyMem_Malloc(sizeof(wchar_t) * (wcslen(path->wide) + 1));
if (!buffer) {
return NULL;
@@ -4499,7 +4516,14 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
}
Py_BEGIN_ALLOW_THREADS
- ret = PathCchSkipRoot(buffer, &end);
+ if (_PathCchSkipRoot) {
+ ret = _PathCchSkipRoot(buffer, &end);
+ } else {
+ end = PathSkipRootW(buffer);
+ if (!end) {
+ ret = E_FAIL;
+ }
+ }
Py_END_ALLOW_THREADS
if (FAILED(ret)) {
result = Py_BuildValue("sO", "", path->object);
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index d7d3cf0..6e9c090 100644
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -130,8 +130,8 @@ WIN32 is still required for the locale module.
/* set the version macros for the windows headers */
/* Python 3.9+ requires Windows 8 or greater */
-#define Py_WINVER 0x0602 /* _WIN32_WINNT_WIN8 */
-#define Py_NTDDI NTDDI_WIN8
+#define Py_WINVER 0x0601 /* _WIN32_WINNT_WIN7 */
+#define Py_NTDDI NTDDI_WIN7
/* We only set these values when building Python - we don't want to force
these values on extensions, as that will affect the prototypes and
diff --git a/PCbuild/_freeze_module.vcxproj b/PCbuild/_freeze_module.vcxproj
index 442e343..ef0a43e 100644
--- a/PCbuild/_freeze_module.vcxproj
+++ b/PCbuild/_freeze_module.vcxproj
@@ -94,7 +94,7 @@
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
- <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>version.lib;ws2_32.lib;shlwapi.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index c39ba3e1a9..0ef3a05fb6 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -106,7 +106,7 @@
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
- <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>version.lib;ws2_32.lib;shlwapi.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
diff --git a/Python/fileutils.c b/Python/fileutils.c
index c86ed40..6b1535d 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -8,7 +8,7 @@
#ifdef MS_WINDOWS
# include <malloc.h>
# include <windows.h>
-# include <pathcch.h> // PathCchCombineEx
+# include <Shlwapi.h>
extern int winerror_to_errno(int);
#endif
@@ -1999,13 +1999,46 @@ _Py_wrealpath(const wchar_t *path,
}
#endif
+#ifdef MS_WINDOWS
+static int _PathCchSkipRoot_Initialized = 0;
+typedef HRESULT (__stdcall *PPathCchSkipRoot) (PCWSTR pszPath, PCWSTR *ppszRootEnd);
+static PPathCchSkipRoot _PathCchSkipRoot;
+
+#ifndef PATHCCH_ALLOW_LONG_PATHS
+#define PATHCCH_ALLOW_LONG_PATHS 0x00000001
+#endif
+#endif
int
_Py_isabs(const wchar_t *path)
{
#ifdef MS_WINDOWS
+ if (_PathCchSkipRoot_Initialized == 0) {
+ HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
+
+ if (pathapi) {
+ _PathCchSkipRoot = (PPathCchSkipRoot)GetProcAddress(pathapi, "PathCchSkipRoot");
+ } else {
+ _PathCchSkipRoot = NULL;
+ }
+
+ _PathCchSkipRoot_Initialized = 1;
+ }
+
+ HRESULT hr;
const wchar_t *tail;
- HRESULT hr = PathCchSkipRoot(path, &tail);
+ if (_PathCchSkipRoot) {
+ hr = _PathCchSkipRoot(path, &tail);
+ } else {
+ tail = PathSkipRootW(path);
+ if (!tail) {
+ hr = E_FAIL;
+ } else {
+ hr = S_OK;
+ }
+ }
+
if (FAILED(hr) || path == tail) {
return 0;
}
@@ -2086,6 +2117,11 @@ _Py_abspath(const wchar_t *path, wchar_t **abspath_p)
#endif
}
+#ifdef MS_WINDOWS
+static int _PathCchCombineEx_Initialized = 0;
+typedef HRESULT (__stdcall *PPathCchCombineEx) (PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn, PCWSTR pszMore, ULONG dwFlags);
+static PPathCchCombineEx _PathCchCombineEx;
+#endif
// The caller must ensure "buffer" is big enough.
static int
@@ -2093,9 +2127,36 @@ join_relfile(wchar_t *buffer, size_t bufsize,
const wchar_t *dirname, const wchar_t *relfile)
{
#ifdef MS_WINDOWS
- if (FAILED(PathCchCombineEx(buffer, bufsize, dirname, relfile,
- PATHCCH_ALLOW_LONG_PATHS))) {
- return -1;
+
+ if (_PathCchCombineEx_Initialized == 0) {
+ HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
+
+ if (pathapi) {
+ _PathCchCombineEx = (PPathCchCombineEx)GetProcAddress(pathapi, "PathCchCombineEx");
+ } else {
+ _PathCchCombineEx = NULL;
+ }
+
+ _PathCchCombineEx_Initialized = 1;
+ }
+
+ if (_PathCchCombineEx) {
+ if (FAILED(_PathCchCombineEx(buffer, bufsize, dirname, relfile,
+ PATHCCH_ALLOW_LONG_PATHS))) {
+ return -1;
+ }
+ }
+ else {
+ size_t dirlen = wcslen(dirname);
+ size_t rellen = wcslen(relfile);
+ size_t maxlen = bufsize - 1;
+ if (maxlen > MAX_PATH || dirlen >= maxlen || rellen >= maxlen - dirlen) {
+ return -1;
+ }
+ wchar_t * r = PathCombineW(buffer, dirname, relfile);
+ if (!r)
+ return -1;
}
#else
assert(!_Py_isabs(relfile));

View File

@ -26,7 +26,7 @@ index 87e04decc2..0349dc81ba 100644
@@ -10,4 +10,4 @@ Requires:
Version: @VERSION@
Libs.private: @LIBS@
Libs:
Libs: -L${libdir} @LIBPYTHON@
-Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
+Cflags: -I${includedir}/python@VERSION@
--

View File

@ -1,54 +0,0 @@
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

View File

@ -1,44 +0,0 @@
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

View File

@ -0,0 +1,13 @@
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index f4f57c5d270028..9e70303868e5de 100644
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -302,7 +302,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
#ifdef MS_COREDLL
# if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_BUILTIN)
/* not building the core - must be an ext */
-# if defined(_MSC_VER)
+# if defined(_MSC_VER) && !defined(Py_NO_LINK_LIB)
/* So MSVC users need not specify the .lib
file in their Makefile (other compilers are
generally taken care of by distutils.) */

View File

@ -40,31 +40,17 @@ set(PATCHES
0008-python.pc.patch
0010-dont-skip-rpath.patch
0012-force-disable-modules.patch
0014-fix-get-python-inc-output.patch
0015-dont-use-WINDOWS-def.patch
0016-undup-ffi-symbols.patch # Required for lld-link.
0018-fix-sysconfig-include.patch
0019-fix-ssl-linkage.patch
0020-Py_NO_LINK_LIB.patch # Remove in 3.14 https://github.com/python/cpython/pull/19740
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND PATCHES 0002-static-library.patch)
endif()
# Fix build failures with GCC for built-in modules (https://github.com/microsoft/vcpkg/issues/26573)
if(VCPKG_TARGET_IS_LINUX)
list(APPEND PATCHES 0011-gcc-ldflags-fix.patch)
endif()
# Python 3.9 removed support for Windows 7. This patch re-adds support for Windows 7 and is therefore
# required to build this port on Windows 7 itself due to Python using itself in its own build system.
if("deprecated-win7-support" IN_LIST FEATURES)
list(APPEND PATCHES 0006-restore-support-for-windows-7.patch)
message(WARNING "Windows 7 support is deprecated and may be removed at any time.")
elseif(VCPKG_TARGET_IS_WINDOWS AND CMAKE_SYSTEM_VERSION EQUAL 6.1)
message(FATAL_ERROR "python3 requires the feature deprecated-win7-support when building on Windows 7.")
endif()
if(VCPKG_TARGET_IS_WINDOWS)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PYTHON_ALLOW_EXTENSIONS)
if(PYTHON_HAS_EXTENSIONS AND NOT PYTHON_ALLOW_EXTENSIONS)
@ -87,7 +73,7 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO python/cpython
REF v${VERSION}
SHA512 16686aa69fe953d8c04e213a1dcf98e92b9898f24f6daec66184a2488c609abc2c2bfe251addd9f5ed63f6e6052a802b2c00ae97bd446282e8b0e4b58c591bae
SHA512 0ca83685fe00d374857ce544eb10037f284a702b14f4cd5c22402b9fbeb557d6d4d23722eae3adbcff1208bf780a50c71146d8d5e3e8a65b84f50bcc5b6968c3
HEAD_REF master
PATCHES ${PATCHES}
)
@ -396,10 +382,7 @@ if (NOT VCPKG_TARGET_IS_WINDOWS)
endif()
endif()
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/python3/Lib/distutils/command/build_ext.py" "'libs'" "'../../lib'")
else()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/python3.${PYTHON_VERSION_MINOR}/distutils/command/build_ext.py" "'libs'" "'../../lib'")
if(NOT VCPKG_TARGET_IS_WINDOWS)
file(COPY_FILE "${CURRENT_PACKAGES_DIR}/tools/python3/python3.${PYTHON_VERSION_MINOR}" "${CURRENT_PACKAGES_DIR}/tools/python3/python3")
endif()

View File

@ -20,7 +20,7 @@ endif()
if("Development" IN_LIST ARGS OR "Development.Embed" IN_LIST ARGS)
set(_PythonFinder_WantInterp TRUE)
set(_PythonFinder_WantLibs TRUE)
elseif("Development.Module" IN_LIST ARGS)
elseif("Development.Module" IN_LIST ARGS OR "Development.SABIModule" IN_LIST ARGS)
if("Interpreter" IN_LIST ARGS)
set(_PythonFinder_WantInterp TRUE)
endif()
@ -126,10 +126,13 @@ else()
endif()
if(TARGET @PythonFinder_PREFIX@::Python)
target_compile_definitions(@PythonFinder_PREFIX@::Python INTERFACE "$<$<CONFIG:Debug>:Py_DEBUG>")
target_compile_definitions(@PythonFinder_PREFIX@::Python INTERFACE "Py_NO_LINK_LIB")
endif()
if(TARGET @PythonFinder_PREFIX@::Module)
target_compile_definitions(@PythonFinder_PREFIX@::Module INTERFACE "$<$<CONFIG:Debug>:Py_DEBUG>")
target_compile_definitions(@PythonFinder_PREFIX@::Module INTERFACE "Py_NO_LINK_LIB")
endif()
if(TARGET @PythonFinder_PREFIX@::SABIModule)
target_compile_definitions(@PythonFinder_PREFIX@::SABIModule INTERFACE "Py_NO_LINK_LIB")
endif()
unset(_PythonFinder_WantInterp)

View File

@ -1,6 +1,6 @@
{
"name": "python3",
"version": "3.11.11",
"version": "3.12.9",
"description": "The Python programming language",
"homepage": "https://github.com/python/cpython",
"license": "Python-2.0",
@ -48,9 +48,6 @@
}
],
"features": {
"deprecated-win7-support": {
"description": "Deprecated support for the Windows 7 platform -- may be removed at any time."
},
"extensions": {
"description": "Allow the build and usage of python extensions. On windows this requires python to be a dynamic library!",
"supports": "!(staticcrt & windows)",

View File

@ -1,6 +1,6 @@
{
"name": "vcpkg-get-python-packages",
"version-date": "2024-09-29",
"version-date": "2025-04-05",
"documentation": "https://learn.microsoft.com/en-us/vcpkg/maintainers/functions/vcpkg_get_python_packages",
"license": "MIT",
"supports": "native"

View File

@ -31,7 +31,10 @@ function(x_vcpkg_get_python_packages)
get_filename_component(python_dir "${arg_PYTHON_EXECUTABLE}" DIRECTORY)
set(ENV{PYTHONNOUSERSITE} "1")
if("${python_dir}" MATCHES "(${DOWNLOADS}|${CURRENT_HOST_INSTALLED_DIR})" AND CMAKE_HOST_WIN32) # inside vcpkg and windows host.
if(CMAKE_HOST_WIN32 AND
("${python_dir}" MATCHES "(${DOWNLOADS}|${CURRENT_HOST_INSTALLED_DIR})"
OR (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND ("${python_dir}" MATCHES "(${CURRENT_INSTALLED_DIR})"))
)) # inside vcpkg and windows host or compatible target.
if(NOT EXISTS "${python_dir}/easy_install${VCPKG_HOST_EXECUTABLE_SUFFIX}")
if(NOT EXISTS "${python_dir}/Scripts/pip${VCPKG_HOST_EXECUTABLE_SUFFIX}")
if(arg_PYTHON_VERSION STREQUAL 3)

View File

@ -15,11 +15,6 @@ vcpkg_from_github(
HEAD_REF master
)
# This is needed to correctly build/link against a debug build of Python on
# Windows
string(APPEND VCPKG_CXX_FLAGS_DEBUG " -DPy_DEBUG")
string(APPEND VCPKG_C_FLAGS_DEBUG " -DPy_DEBUG")
vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}")
vcpkg_cmake_build()

View File

@ -1,6 +1,6 @@
{
"name": "vcpkg-ci-nanobind",
"version": "0.0.1",
"version-date": "2025-04-03",
"description": "A nanobind example project",
"homepage": "https://nanobind.readthedocs.io/en/latest/",
"license": "BSD-3-Clause",

View File

@ -3269,8 +3269,8 @@
"port-version": 0
},
"gobject-introspection": {
"baseline": "1.72.0",
"port-version": 9
"baseline": "1.82.0",
"port-version": 0
},
"godot-cpp": {
"baseline": "4.4",
@ -6742,7 +6742,7 @@
},
"omniorb": {
"baseline": "4.3.0",
"port-version": 3
"port-version": 4
},
"ompl": {
"baseline": "1.6.0",
@ -7501,7 +7501,7 @@
"port-version": 7
},
"python3": {
"baseline": "3.11.11",
"baseline": "3.12.9",
"port-version": 0
},
"qca": {
@ -9681,7 +9681,7 @@
"port-version": 0
},
"vcpkg-get-python-packages": {
"baseline": "2024-09-29",
"baseline": "2025-04-05",
"port-version": 0
},
"vcpkg-gfortran": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2998d48a8661410527703c06b125d198ebb19411",
"version": "1.82.0",
"port-version": 0
},
{
"git-tree": "3be3499cb5b2d9b4d476bd49375255bb02c8f426",
"version": "1.72.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "6ca24d5ca5d2bcc61fb96f531a56da7b09990452",
"version": "4.3.0",
"port-version": 4
},
{
"git-tree": "37b1efea82d28e65a44105b54a592fafede78b94",
"version": "4.3.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "49a5d9f6c71382e9eff7135d12d0d074af0540eb",
"version": "3.12.9",
"port-version": 0
},
{
"git-tree": "7aeb024f9b5e3927d3e37f145b85c85504bc51dd",
"version": "3.11.11",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2550a21f375bb78fd3fba745a2e58a2355912767",
"version-date": "2025-04-05",
"port-version": 0
},
{
"git-tree": "c7d017ccabcaf02739662b60cc1000b8489acb22",
"version-date": "2024-09-29",