Skip to content

Commit

Permalink
[python3] Reset to version 3.10.7 in ports
Browse files Browse the repository at this point in the history
This is for vcpkg operating in _classic_ (a.k.a. command-line) mode.
In this mode, vcpkg is not aware of versions and simply installs
whatever is in ports/ subdir.

Currently we're using classic mode in vcpkg-privates CI, and can't build
Python 3.11, hence this commit. It was created by this sequence of
commands (a0f1... SHA is taken from versions/p-/python3/vcpkg.json file):

       mkdir bak
       git read-tree --prefix bak -u a0f1ead9323b9521f3c3016469f028be712c0252
       rm -rf ports/python3/
       mv x ports/python3/
       git add -A
       git commit
  • Loading branch information
Lex-2008 authored and vitaly-fanaskov-r committed Feb 13, 2024
1 parent 7ba0ba7 commit 99e84ca
Show file tree
Hide file tree
Showing 18 changed files with 421 additions and 492 deletions.
4 changes: 2 additions & 2 deletions ports/python3/0001-only-build-required-projects.patch
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj
index 4d416c589e..ede9868a8f 100644
--- a/PCbuild/pcbuild.proj
+++ b/PCbuild/pcbuild.proj
@@ -60,17 +60,17 @@
@@ -49,17 +49,17 @@
<!-- python3.dll -->
<Projects Include="python3dll.vcxproj" />
<!-- py[w].exe -->
Expand All @@ -49,7 +49,7 @@ index 4d416c589e..ede9868a8f 100644
+ <!-- _ssl will NOT build _socket as well -->
+ <ExtensionModules Include="_socket" Condition="true" />
+ <ExternalModules Include="_ssl;_hashlib" Condition="true" />
<ExternalModules Include="_tkinter" Condition="$(IncludeTkinter)" />
<ExternalModules Include="_tkinter" Condition="$(IncludeTkinter) and $(Platform) != 'ARM' and $(Platform) != 'ARM64'" />
<ExtensionModules Include="@(ExternalModules->'%(Identity)')" Condition="$(IncludeExternals)" />
<Projects Include="@(ExtensionModules->'%(Identity).vcxproj')" Condition="$(IncludeExtensions)" />
--
Expand Down
67 changes: 2 additions & 65 deletions ports/python3/0002-static-library.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,19 @@ 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
+++ b/PC/pyconfig.h
@@ -251,6 +251,9 @@ typedef int pid_t;
@@ -251,6 +251,7 @@ typedef int pid_t;

/* For Windows the Python core is in a DLL by default. Test
Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
+#ifndef Py_NO_ENABLE_SHARED
+#define Py_NO_ENABLE_SHARED
+#endif
#if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
# define Py_ENABLE_SHARED 1 /* standard symbol for shared library */
# define MS_COREDLL /* deprecated old symbol */
@@ -276,6 +277,15 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
@@ -276,6 +277,14 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
# endif /* _DEBUG */
# endif /* _MSC_VER */
# endif /* Py_BUILD_CORE */
Expand All @@ -49,7 +30,6 @@ index d7d3cf081e..34269f0b75 100644
+# pragma comment(lib, "version.lib")
+# pragma comment(lib, "shlwapi.lib")
+# pragma comment(lib, "ws2_32.lib")
+# pragma comment(lib, "bcrypt.lib")
+# if Py_WINVER > 0x0601
+# pragma comment(lib, "pathcch.lib")
+# endif /* Py_WINVER */
Expand Down Expand Up @@ -91,49 +71,6 @@ index 2625d0293d..2f8bdaa931 100644
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index 2625d0293d..2f8bdaa931 100644
--- a/PCbuild/_freeze_module.vcxproj
+++ b/PCbuild/_freeze_module.vcxproj
@@ -88,7 +88,7 @@
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup>
<ClCompile>
- <PreprocessorDefinitions>Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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
8 changes: 4 additions & 4 deletions ports/python3/0003-use-vcpkg-zlib.patch
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index dbe236829a..5f30a35eb3 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -540,8 +540,10 @@
<ClCompile Include="..\Python\deepfreeze\deepfreeze.c" />
<!-- END deepfreeze -->
@@ -507,8 +507,10 @@
<ClCompile Include="..\Python\thread.c" />
<ClCompile Include="..\Python\traceback.c" />
</ItemGroup>
- <ItemGroup Condition="$(IncludeExternals)">
+ <ItemGroup>
Expand All @@ -25,7 +25,7 @@ index dbe236829a..5f30a35eb3 100644
<ClCompile Include="$(zlibDir)\adler32.c" />
<ClCompile Include="$(zlibDir)\compress.c" />
<ClCompile Include="$(zlibDir)\crc32.c" />
@@ -593,7 +595,7 @@
@@ -556,7 +558,7 @@
<Target Name="_WarnAboutToolset" BeforeTargets="PrepareForBuild" Condition="$(PlatformToolset) != 'v140' and $(PlatformToolset) != 'v141' and $(PlatformToolset) != 'v142' and $(PlatformToolset) != 'v143'">
<Warning Text="Toolset $(PlatformToolset) is not used for official builds. Your build may have errors or incompatibilities." />
</Target>
Expand Down
2 changes: 1 addition & 1 deletion ports/python3/0004-devendor-external-dependencies.patch
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ index b2d9f5d57d..4efb826a05 100644
- <ClCompile>
+ <ClCompile Condition="false">
<AdditionalIncludeDirectories>$(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
- <ItemGroup>
Expand Down
Loading

0 comments on commit 99e84ca

Please sign in to comment.