Commit 2587952f authored by Steve Dower's avatar Steve Dower

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

parent a39eb0f4
...@@ -12,7 +12,12 @@ forgotten) from the programmer. ...@@ -12,7 +12,12 @@ 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 char dllVersionBuffer[16] = ""; // a private buffer
#endif
// Python Globals // Python Globals
HMODULE PyWin_DLLhModule = NULL; HMODULE PyWin_DLLhModule = NULL;
...@@ -88,8 +93,11 @@ BOOL WINAPI DllMain (HANDLE hInst, ...@@ -88,8 +93,11 @@ 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... // 1000 is a magic number I picked out of the air. Could do with a #define, I spose...
LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer)); LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer));
#endif
#if HAVE_SXS #if HAVE_SXS
// and capture our activation context for use when loading extensions. // and capture our activation context for use when loading extensions.
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<WriteLinesToFile File="$(PySourcePath)PC\pythonnt_rc$(PyDebugExt).h" Overwrite="true" Encoding="ascii" <WriteLinesToFile File="$(PySourcePath)PC\pythonnt_rc$(PyDebugExt).h" Overwrite="true" Encoding="ascii"
Lines='/* This file created by python.props /t:GeneratePythonNtRcH */ Lines='/* This file created by python.props /t:GeneratePythonNtRcH */
#define FIELD3 $(Field3Value) #define FIELD3 $(Field3Value)
#define MS_DLL_ID "$(PythonMajorVersion).$(PythonMinorVersion)" #define MS_DLL_ID "$(SysWinVer)"
#define PYTHON_DLL_NAME "$(PyDllName).dll" #define PYTHON_DLL_NAME "$(PyDllName).dll"
' /> ' />
<ItemGroup> <ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?> <?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> <PropertyGroup>
<Platform Condition="'$(Platform)' == ''">Win32</Platform> <Platform Condition="'$(Platform)' == '' or '$(Platform)' == 'x86'">Win32</Platform>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration> <Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<!-- <!--
Use the latest available version of Visual Studio to build. To override Use the latest available version of Visual Studio to build. To override
...@@ -100,6 +100,10 @@ ...@@ -100,6 +100,10 @@
<!-- The version and platform tag to include in .pyd filenames --> <!-- The version and platform tag to include in .pyd filenames -->
<PydTag Condition="$(Platform) == 'Win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag> <PydTag Condition="$(Platform) == 'Win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
<PydTag Condition="$(Platform) == 'x64'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64</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> </PropertyGroup>
<!-- Displays the calculated version info --> <!-- Displays the calculated version info -->
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<ClCompile> <ClCompile>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <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> </ClCompile>
<Link> <Link>
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
...@@ -335,7 +335,6 @@ ...@@ -335,7 +335,6 @@
<ClCompile Include="..\Parser\tokenizer.c" /> <ClCompile Include="..\Parser\tokenizer.c" />
<ClCompile Include="..\PC\winreg.c" /> <ClCompile Include="..\PC\winreg.c" />
<ClCompile Include="..\PC\config.c" /> <ClCompile Include="..\PC\config.c" />
<ClCompile Include="..\PC\dl_nt.c" />
<ClCompile Include="..\PC\getpathp.c" /> <ClCompile Include="..\PC\getpathp.c" />
<ClCompile Include="..\PC\msvcrtmodule.c" /> <ClCompile Include="..\PC\msvcrtmodule.c" />
<ClCompile Include="..\Python\pyhash.c" /> <ClCompile Include="..\Python\pyhash.c" />
...@@ -386,6 +385,9 @@ ...@@ -386,6 +385,9 @@
<ClCompile Include="..\Python\thread.c" /> <ClCompile Include="..\Python\thread.c" />
<ClCompile Include="..\Python\traceback.c" /> <ClCompile Include="..\Python\traceback.c" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClCompile Include="..\PC\dl_nt.c" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\PC\python_nt.rc" /> <ResourceCompile Include="..\PC\python_nt.rc" />
</ItemGroup> </ItemGroup>
...@@ -393,7 +395,7 @@ ...@@ -393,7 +395,7 @@
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </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 -b &gt; "$(IntDir)hgbranch.txt"' ContinueOnError="true" />
<Exec Command='hg id -i &gt; "$(IntDir)hgversion.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" /> <Exec Command='hg id -t &gt; "$(IntDir)hgtag.txt"' ContinueOnError="true" />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment