To build on windows, the manual editing of the python_nt.rc file to

change the version number is no longer required.

Instead, a make_versioninfo.exe is compiled, which spits out an
include file for python_nt.rc.

Will backport to 2.3
This commit is contained in:
Thomas Heller 2003-10-10 16:57:45 +00:00
parent b97f0b7654
commit 13dbabe46e
5 changed files with 162 additions and 34 deletions

2
PC/.cvsignore Normal file
View File

@ -0,0 +1,2 @@
pythonnt_rc.h
pythonnt_rc_d.h

33
PC/make_versioninfo.c Normal file
View File

@ -0,0 +1,33 @@
#include <stdio.h>
#include "patchlevel.h"
/*
* This program prints out an include file containing fields required to build
* the version info resource of pythonxx.dll because the resource compiler
* cannot do the arithmetic.
*/
/*
* FIELD3 is the third field of the version number.
* This is what we'd like FIELD3 to be:
*
* #define FIELD3 (PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL)
*
* but that neither gives an error nor comes anywhere close to working.
*
* For 2.4a0,
* PY_MICRO_VERSION = 0
* PY_RELEASE_LEVEL = 'alpha' = 0xa
* PY_RELEASE_SERIAL = 0
*
* gives FIELD3 = 0*1000 + 10*10 + 0 = 100
*/
int main(int argc, char **argv)
{
printf("/* This file created by make_versioninfo.exe */\n");
printf("#define FIELD3 %d\n",
PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL);
printf("#define MS_DLL_ID \"%d.%d\"\n",
PY_MAJOR_VERSION, PY_MINOR_VERSION);
printf("#define PYTHON_DLL_NAME \"python%d%d.dll\"\n",
PY_MAJOR_VERSION, PY_MINOR_VERSION);
return 0;
}

View File

@ -6,42 +6,12 @@
#define MS_WINDOWS
#include "modsupport.h"
#include "patchlevel.h"
/* Across releases, change:
* MS_DLL_ID if the minor version number changes.
* PYTHON_DLL_NAME ditto.
* MS_DLL_ID must match PY_VERSION in the Windows install script.
*/
#define MS_DLL_ID "2.4"
#ifndef PYTHON_DLL_NAME
#define PYTHON_DLL_NAME "python24.dll"
#ifdef _DEBUG
# include "pythonnt_rc_d.h"
#else
# include "pythonnt_rc.h"
#endif
/* Nothing below this should need to be changed except for copyright
* notices, company name, and FIELD3. Unfortunately, all attempts
* to get the resource compiler to do arithmetic in macros have
* failed miserably -- it gives syntax errors, ignores operators,
* or does stuff that's simply bizarre.
*/
/* This is what we'd like FIELD3 to be:
*
* #define FIELD3 (PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL)
*
* but that neither gives an error nor comes anywhere close to working. The
* following comment and #define are output from PCbuild\field3.py:
*
* For 2.4a0,
* PY_MICRO_VERSION = 0
* PY_RELEASE_LEVEL = 'alpha' = 0xa
* PY_RELEASE_SERIAL = 0
*
* and 0*1000 + 10*10 + 0 = 100
*/
#define FIELD3 100
/* e.g., 2.1a2
* PY_VERSION comes from patchevel.h
*/

View File

@ -0,0 +1,108 @@
# Microsoft Developer Studio Project File - Name="make_versioninfo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=make_versioninfo - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "make_versioninfo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "make_versioninfo.mak" CFG="make_versioninfo - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "make_versioninfo - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "make_versioninfo - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName "make_versioninfo"
# PROP Scc_LocalPath ".."
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "make_versioninfo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "."
# PROP Intermediate_Dir "x86-temp-release\make_versioninfo"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386
# SUBTRACT LINK32 /pdb:none
# Begin Custom Build
InputPath=.\make_versioninfo.exe
SOURCE="$(InputPath)"
"..\PC\pythonnt_rc.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
.\make_versioninfo.exe >..\PC\pythonnt_rc.h
# End Custom Build
!ELSEIF "$(CFG)" == "make_versioninfo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "."
# PROP Intermediate_Dir "x86-temp-debug\make_versioninfo"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /i "..\Include" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 /out:"./make_versioninfo_d.exe" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
# Begin Custom Build
InputPath=.\make_versioninfo_d.exe
SOURCE="$(InputPath)"
"..\PC\pythonnt_rc_d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
.\make_versioninfo_d.exe >..\PC\pythonnt_rc_d.h
# End Custom Build
!ENDIF
# Begin Target
# Name "make_versioninfo - Win32 Release"
# Name "make_versioninfo - Win32 Debug"
# Begin Source File
SOURCE=..\PC\make_versioninfo.c
# End Source File
# End Target
# End Project

View File

@ -159,6 +159,18 @@ Package=<4>
###############################################################################
Project: "make_versioninfo"=.\make_versioninfo.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "mmap"=.\mmap.dsp - Package Owner=<4>
Package=<5>
@ -227,6 +239,9 @@ Package=<5>
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name make_versioninfo
End Project Dependency
}}}
###############################################################################