Fixes sys.winver generation and removes dependency on user32.dll

This commit is contained in:
Steve Dower 2015-01-15 09:10:16 -08:00
parent a39eb0f42b
commit 2587952f2f
4 changed files with 20 additions and 6 deletions

View File

@ -12,7 +12,12 @@ forgotten) from the programmer.
#include "windows.h"
#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
HMODULE PyWin_DLLhModule = NULL;
@ -88,8 +93,11 @@ BOOL WINAPI DllMain (HANDLE hInst,
{
case DLL_PROCESS_ATTACH:
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
#if HAVE_SXS
// and capture our activation context for use when loading extensions.

View File

@ -87,7 +87,7 @@
<WriteLinesToFile File="$(PySourcePath)PC\pythonnt_rc$(PyDebugExt).h" Overwrite="true" Encoding="ascii"
Lines='/* This file created by python.props /t:GeneratePythonNtRcH */
#define FIELD3 $(Field3Value)
#define MS_DLL_ID "$(PythonMajorVersion).$(PythonMinorVersion)"
#define MS_DLL_ID "$(SysWinVer)"
#define PYTHON_DLL_NAME "$(PyDllName).dll"
' />
<ItemGroup>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="Platform">
<PropertyGroup>
<Platform Condition="'$(Platform)' == ''">Win32</Platform>
<Platform Condition="'$(Platform)' == '' or '$(Platform)' == 'x86'">Win32</Platform>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<!--
Use the latest available version of Visual Studio to build. To override
@ -100,6 +100,10 @@
<!-- The version and platform tag to include in .pyd filenames -->
<PydTag Condition="$(Platform) == 'Win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
<PydTag Condition="$(Platform) == 'x64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</PydTag>
<!-- The version number for sys.winver -->
<SysWinVer>$(MajorVersionNumber).$(MinorVersionNumber)</SysWinVer>
<SysWinVer Condition="$(Platform) == 'Win32'">$(SysWinVer)-32</SysWinVer>
</PropertyGroup>
<!-- Displays the calculated version info -->

View File

@ -67,7 +67,7 @@
<ClCompile>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -335,7 +335,6 @@
<ClCompile Include="..\Parser\tokenizer.c" />
<ClCompile Include="..\PC\winreg.c" />
<ClCompile Include="..\PC\config.c" />
<ClCompile Include="..\PC\dl_nt.c" />
<ClCompile Include="..\PC\getpathp.c" />
<ClCompile Include="..\PC\msvcrtmodule.c" />
<ClCompile Include="..\Python\pyhash.c" />
@ -386,6 +385,9 @@
<ClCompile Include="..\Python\thread.c" />
<ClCompile Include="..\Python\traceback.c" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\PC\dl_nt.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\PC\python_nt.rc" />
</ItemGroup>
@ -393,7 +395,7 @@
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="_GetBuildInfo" AfterTargets="PrepareForBuild">
<Target Name="_GetBuildInfo" BeforeTargets="PrepareForBuild">
<Exec Command='hg id -b &gt; "$(IntDir)hgbranch.txt"' ContinueOnError="true" />
<Exec Command='hg id -i &gt; "$(IntDir)hgversion.txt"' ContinueOnError="true" />
<Exec Command='hg id -t &gt; "$(IntDir)hgtag.txt"' ContinueOnError="true" />