Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python3] Update to 3.12.8, drop Windows 7 support #40996

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions ports/glib/0005-pr-4133-4143-avoid-package-packaging.patch

This file was deleted.

4 changes: 2 additions & 2 deletions ports/glib/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# vcpkg_from_* is not used because the project uses submodules.
string(REGEX MATCH "^([0-9]*[.][0-9]*)" GLIB_MAJOR_MINOR "${VERSION}")
vcpkg_download_distfile(GLIB_ARCHIVE
URLS "https://download.gnome.org/sources/glib/${GLIB_MAJOR_MINOR}/glib-${VERSION}.tar.xz"
FILENAME "glib-${VERSION}.tar.xz"
SHA512 1514d62aeb4c4a1a1048ae0f84f7db7f0dbf355772b2dadf6a34ec547045b163a5e28331b096e7616fe3c9c19bed98025a0202b05073f5d7ee901d0efaffe143
SHA512 1686ef719122d2b3e8bcc569ba1e125cde51fbe645811e1eb7ddd49e300ff834eed712bb619bba13629f23ad5f801fdc2d37e3103b5150ad3cb7ff9d1168d902
)

vcpkg_extract_source_archive(SOURCE_PATH
ARCHIVE "${GLIB_ARCHIVE}"
PATCHES
use-libiconv-on-windows.patch
libintl.patch
0005-pr-4133-4143-avoid-package-packaging.patch # Backport from 2.81.1
)

set(LANGUAGES C CXX)
Expand Down
6 changes: 3 additions & 3 deletions ports/glib/use-libiconv-on-windows.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ diff --git a/glib/gconvert.c b/glib/gconvert.c
index 829fe38de..e01ad8884 100644
--- a/glib/gconvert.c
+++ b/glib/gconvert.c
@@ -32,7 +32,8 @@
#include <stdlib.h>
@@ -33,7 +33,8 @@

#ifdef G_OS_WIN32
#include <windows.h>
-#include "win_iconv.c"
+#define USE_LIBICONV_GNU
+#include <iconv.h>
#endif

#ifdef G_PLATFORM_WIN32
#include "gconvert.h"
diff --git a/meson.build b/meson.build
index d465253af..34ce69e4d 100644
--- a/meson.build
Expand Down
3 changes: 1 addition & 2 deletions ports/glib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "glib",
"version": "2.80.0",
"port-version": 1,
"version": "2.83.2",
"description": "Portable, general-purpose utility library.",
"homepage": "https://developer.gnome.org/glib/",
"license": "LGPL-2.1-or-later",
Expand Down
Original file line number Diff line number Diff line change
@@ -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'))
Expand Down
15 changes: 9 additions & 6 deletions ports/gobject-introspection/0002-cross-build.patch
Original file line number Diff line number Diff line change
@@ -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),
Expand All @@ -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: '@[email protected]',
- depends: [gobject_gir, gircompiler, ],
+ depends: [gobject_gir, ],
Expand All @@ -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,
)
Expand All @@ -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,
)
Expand Down
17 changes: 10 additions & 7 deletions ports/gobject-introspection/0003-fix-paths.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions ports/gobject-introspection/fix-pkgconfig.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ diff --git a/meson.build b/meson.build
index b253927..312fbdc 100644
--- a/meson.build
+++ b/meson.build
@@ -254,9 +254,9 @@ endif
@@ -254,9 +254,9 @@
endif

pkgconfig_variables = [
'datadir=' + '${prefix}' / get_option('datadir'),
'bindir=' + '${prefix}' / get_option('bindir'),
- 'g_ir_scanner=${bindir}/g-ir-scanner',
- 'g_ir_compiler=${bindir}/g-ir-compiler@0@'.format(exe_ext),
- 'g_ir_generate=${bindir}/g-ir-generate@0@'.format(exe_ext),
Expand Down
24 changes: 18 additions & 6 deletions ports/gobject-introspection/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -32,6 +32,18 @@ else()
list(APPEND OPTIONS_RELEASE -Dbuild_introspection_data=true)
endif()

find_file(INITIAL_PYTHON3
NAMES "python3${VCPKG_HOST_EXECUTABLE_SUFFIX}" "python${VCPKG_HOST_EXECUTABLE_SUFFIX}"
PATHS "${CURRENT_HOST_INSTALLED_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
Expand All @@ -44,7 +56,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='${CURRENT_HOST_INSTALLED_DIR}/tools/python3/python${VCPKG_HOST_EXECUTABLE_SUFFIX}'
python='${PYTHON3}'
)

vcpkg_host_path_list(APPEND ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")
Expand Down
7 changes: 5 additions & 2 deletions ports/gobject-introspection/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "gobject-introspection",
"version": "1.72.0",
"port-version": 8,
"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,
Expand Down Expand Up @@ -29,6 +28,10 @@
"name": "python3",
"host": true
},
{
"name": "vcpkg-get-python-packages",
"host": true
},
{
"name": "vcpkg-tool-meson",
"host": true
Expand Down
2 changes: 1 addition & 1 deletion ports/python3/0001-only-build-required-projects.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
51 changes: 2 additions & 49 deletions ports/python3/0002-static-library.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand All @@ -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
Expand Down
Loading
Loading