bpo-41054: Simplify resource compilation on Windows (GH-21004)
Remove auto-generated resource header. Pass definitions required by resource files (ORIGINAL_FILENAME and FIELD3) directly to resource compiler. Remove unused MS_DLL_ID resource string and related dead code.
This commit is contained in:
parent
930f4518ae
commit
4efc3360c9
13
PC/dl_nt.c
13
PC/dl_nt.c
|
@ -12,16 +12,10 @@ forgotten) from the programmer.
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
#ifdef Py_ENABLE_SHARED
|
#ifdef Py_ENABLE_SHARED
|
||||||
#ifdef MS_DLL_ID
|
|
||||||
// The string is available at build, so fill the buffer immediately
|
|
||||||
char dllVersionBuffer[16] = MS_DLL_ID;
|
|
||||||
#else
|
|
||||||
char dllVersionBuffer[16] = ""; // a private buffer
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Python Globals
|
// Python Globals
|
||||||
HMODULE PyWin_DLLhModule = NULL;
|
HMODULE PyWin_DLLhModule = NULL;
|
||||||
const char *PyWin_DLLVersionString = dllVersionBuffer;
|
const char *PyWin_DLLVersionString = MS_DLL_ID;
|
||||||
|
|
||||||
BOOL WINAPI DllMain (HANDLE hInst,
|
BOOL WINAPI DllMain (HANDLE hInst,
|
||||||
ULONG ul_reason_for_call,
|
ULONG ul_reason_for_call,
|
||||||
|
@ -31,11 +25,6 @@ BOOL WINAPI DllMain (HANDLE hInst,
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
PyWin_DLLhModule = hInst;
|
PyWin_DLLhModule = hInst;
|
||||||
#ifndef MS_DLL_ID
|
|
||||||
// If we have MS_DLL_ID, we don't need to load the string.
|
|
||||||
// 1000 is a magic number I picked out of the air. Could do with a #define, I spose...
|
|
||||||
LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
|
|
|
@ -7,12 +7,6 @@
|
||||||
#include <winuser.h>
|
#include <winuser.h>
|
||||||
2 RT_MANIFEST "python.manifest"
|
2 RT_MANIFEST "python.manifest"
|
||||||
|
|
||||||
// String Tables
|
|
||||||
STRINGTABLE DISCARDABLE
|
|
||||||
BEGIN
|
|
||||||
1000, MS_DLL_ID
|
|
||||||
END
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Version
|
// Version
|
||||||
|
@ -40,7 +34,7 @@ BEGIN
|
||||||
VALUE "FileVersion", PYTHON_VERSION
|
VALUE "FileVersion", PYTHON_VERSION
|
||||||
VALUE "InternalName", "Python DLL\0"
|
VALUE "InternalName", "Python DLL\0"
|
||||||
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
|
VALUE "LegalCopyright", PYTHON_COPYRIGHT "\0"
|
||||||
VALUE "OriginalFilename", PYTHON_DLL_NAME "\0"
|
VALUE "OriginalFilename", ORIGINAL_FILENAME "\0"
|
||||||
VALUE "ProductName", "Python\0"
|
VALUE "ProductName", "Python\0"
|
||||||
VALUE "ProductVersion", PYTHON_VERSION
|
VALUE "ProductVersion", PYTHON_VERSION
|
||||||
END
|
END
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#define MS_WINDOWS
|
#define MS_WINDOWS
|
||||||
#include "modsupport.h"
|
#include "modsupport.h"
|
||||||
#include "patchlevel.h"
|
#include "patchlevel.h"
|
||||||
#include <pythonnt_rc.h>
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
# define PYTHON_DEBUG_EXT "_d"
|
# define PYTHON_DEBUG_EXT "_d"
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
</Lib>
|
</Lib>
|
||||||
<ResourceCompile>
|
<ResourceCompile>
|
||||||
<AdditionalIncludeDirectories>$(PySourcePath)PC;$(PySourcePath)Include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(PySourcePath)PC;$(PySourcePath)Include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>ORIGINAL_FILENAME=\"$(TargetName)$(TargetExt)\";FIELD3=$(Field3Value);$(_DebugPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<Culture>0x0409</Culture>
|
<Culture>0x0409</Culture>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Midl>
|
<Midl>
|
||||||
|
@ -95,21 +95,6 @@
|
||||||
</Midl>
|
</Midl>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
|
||||||
<Target Name="GeneratePythonNtRcH"
|
|
||||||
BeforeTargets="ClCompile"
|
|
||||||
Inputs="$(PySourcePath)Include\patchlevel.h"
|
|
||||||
Outputs="$(IntDir)pythonnt_rc.h">
|
|
||||||
<WriteLinesToFile File="$(IntDir)pythonnt_rc.h" Overwrite="true" Encoding="ascii"
|
|
||||||
Lines='/* This file created by pyproject.props /t:GeneratePythonNtRcH */
|
|
||||||
#define FIELD3 $(Field3Value)
|
|
||||||
#define MS_DLL_ID "$(SysWinVer)"
|
|
||||||
#define PYTHON_DLL_NAME "$(TargetName)$(TargetExt)"
|
|
||||||
' />
|
|
||||||
<ItemGroup>
|
|
||||||
<FileWrites Include="$(IntDir)pythonnt_rc.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<UsingTask TaskName="KillPython" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
<UsingTask TaskName="KillPython" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
||||||
<ParameterGroup>
|
<ParameterGroup>
|
||||||
<FileName Required="true" />
|
<FileName Required="true" />
|
||||||
|
|
Loading…
Reference in New Issue