[Zope] Re: AW: [Zope] HELP NEEDED - EXTREMELY URGENT (Zope on NT4 SP4)

Jim Fulton jim@digicool.com
Fri, 26 Feb 1999 15:42:39 -0500


This is a multi-part message in MIME format.
--------------DC96900A49D211FFABC66154
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Stefan Franke wrote:
> 
> Jim Fulton wrote:
> 
>         > Stefan Franke wrote:
>         >> Ok today I checked that my problem is definitely caused by
> the
>         >> Win NT SP4.
> 
>         > Wow.  How did you determine this.
> 
> Easy... I was in the lucky position to check it with two identical
> servers in the server pool of out customer (the public administration
> of the city of cologne). They were exact clones WRT Hardware,
> and SW either, due to M$'s Software Management System), and
> differed only in the OS patch version.
> 
>         > I'm not sure when we'll do this.  If compiling with a newer
>         > compiler fixes the problem, please let us know.
> 
> Sure I will, propably within the next week. I never compiled Python
> extensions myself, are there any instructions or makefiles in the
> source distribution, or should I have a look into Python's E&E
> manual?

Ick, I keep forgetting how painful this is.

I've attached a Python script that build VC++ make files.
It works with VC++5.  Hopefully it'll work with VC++6.

I think that David Ascher also posted a compilation script to the Zope
list back in November or December.

Jim
--------------DC96900A49D211FFABC66154
Content-Type: text/plain; charset=us-ascii;
 name="ext15.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ext15.py"


'''Build t Python extension using Visual C++ 40

This script generates and runs a series of .mak and .def
files for extensions defined in a Setup file.

Note that you must have set up your environment to run VC command-line
ustilities.  This can be done by running the vcvar32.bat file in the
VC++ bin directory.

Usage: python ext.py [options]

Options:

   -r     Run nmake to build release version
   -d     Run nmake to build debug version
   -c     If used with -r or -d, runs nmake on clean target.
   -p     Specify location of Python source tree.  Default
          is ..\.. (assuming you are in Extensions/some_name)

''' # '

import sys, getopt, os, string, regex

def die(m):
	print m
	print
	print __doc__
	sys.exit(1)

def setup():

    poptlist,pargs=getopt.getopt(sys.argv[1:],'p:drcI:o:h')
    if opt(poptlist,'h'): print __doc__
    if poptlist==[('-h','')]: sys.exit(0)

    pargs and die('Unrecognized arguments: %s', string.join(args))

    ext_regex = regex.compile('\([a-z][a-z0-9_]*\)[ \t]'
			      '\([a-z][a-z0-9_]*[.]c\)[ \t\n]',
			      regex.casefold)

    for line in open('Setup').readlines():
	    
        if ext_regex.match(line) >= 0:
	    sargs=string.split(line)
	    module=sargs[0]
	    soptlist, sargs = getopt.getopt(sargs[2:],'I:D:')

	    filter(lambda a: a[:1]=='-' or string.find(a,'.') < 0,
		   sargs) and die('Invalid arguments in Setup file: %s' %
				  string.join(sargs))

	    simple(module,poptlist+soptlist,
		   map(lambda a: a[:string.find(a,'.')],
		       sargs))
	    

main=setup

def simple(module,optlist,others):
    tdef,tmak=templates()

    pyhome=opt(optlist,'p')
    pyhome=pyhome and pyhome[0] or '..\\..'
    cfg=opt(optlist,'d') and 'Debug' or 'Release'
    parms={'module': module, 'pyhome':pyhome, 'cfg': cfg}
    parms['includes']=string.join(
	map(lambda i: '/I "%s"' % i,
	    opt(optlist,'I')) +
	map(lambda i: '/D "%s"' % i,
	    opt(optlist,'D'))
	, ' ') 
    parms['other_clean_release']=string.join(
	map(lambda o:
	    '\n\t-@erase ".\\Release\\%s.obj"' % o,
	    others),'')
    parms['other_clean_debug']=string.join(
	map(lambda o:
	    '\n\t-@erase ".\\Debug\\%s.obj"' % o,
	    others),'')
    parms['other_rule']=string.join(
	map(lambda o:
	    '"$(INTDIR)\%s.obj" : $(SOURCE) $(DEP_CPP_MOD) "$(INTDIR)"' % o,
	    others),'\n')
    parms['other_link']=string.join(
	map(lambda o:
	    '\n\t"$(INTDIR)\%s.obj" \\' % o,
	    others),'')

    open(module+'.def','w').write(tdef % parms)
    open(module+'.mak','w').write(tmak % parms)
    cfg_=' CFG="%s - Win32 %s"' % (module,cfg)
    os.system('nmake /nologo /f %s.mak%s' % (module,cfg_))
    os.system('copy %s\%s.dll %s.pyd' % (cfg,module,module))
    if opt(optlist,'c'):
        os.system("nmake /f %s.mak%s CLEAN" % (module,cfg_))



def opt(optlist,name):
    l=filter(lambda t, name='-'+name: t[0]==name, optlist)
    return map(lambda t: t[1], l)

def templates():
    tdef = '''EXPORTS
	init%(module)s
'''

    tmak = '''# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00
# ** DO NOT EDIT **

# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102

!IF "$(CFG)" == ""
CFG=%(module)s - Win32 Debug
!MESSAGE No configuration specified.  Defaulting to %(module)s - Win32 Debug.
!ENDIF 

!IF "$(CFG)" != "%(module)s - Win32 Release" && "$(CFG)" !=\\
 "%(module)s - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line.  For example:
!MESSAGE 
!MESSAGE NMAKE /f "%(module)s.mak" CFG="%(module)s - Win32 Debug"
!MESSAGE 
!MESSAGE Possible choices for configuration are:
!MESSAGE 
!MESSAGE "%(module)s - Win32 Release" (based on\\
 "Win32 (x86) Dynamic-Link Library")
!MESSAGE "%(module)s - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE 
!ERROR An invalid configuration is specified.
!ENDIF 

!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE 
NULL=nul
!ENDIF 
################################################################################
# Begin Project
# PROP Target_Last_Scanned "%(module)s - Win32 Debug"
CPP=cl.exe
RSC=rc.exe
MTL=mktyplib.exe

!IF  "$(CFG)" == "%(module)s - 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 "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
OUTDIR=.\\Release
INTDIR=.\\Release

ALL : "$(OUTDIR)\\%(module)s.dll"

CLEAN : 
	-@erase ".\\Release\\%(module)s.dll"
	-@erase ".\\Release\\%(module)s.obj"%(other_clean_release)s
	-@erase ".\\Release\\%(module)s.lib"
	-@erase ".\\Release\\%(module)s.exp"
	-@erase ".\\Release\\%(module)s.pch"

"$(OUTDIR)" :
    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"

# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "%(pyhome)s\\Include" /I "%(pyhome)s\\PC" %(includes)s /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "%(pyhome)s\\Include" /I "%(pyhome)s\\PC" %(includes)s /D "WIN32" /D\\
 "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/%(module)s.pch" /YX /Fo"$(INTDIR)/" /c 
CPP_OBJS=.\\Release/
CPP_SBRS=
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ=/nologo /D "NDEBUG" /win32 
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/%(module)s.bsc" 
BSC32_SBRS=
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:windows /dll /machine:I386
# ADD 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:windows /dll /machine:I386
LINK32_FLAGS=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:windows /dll /incremental:no\\
 /pdb:"$(OUTDIR)/%(module)s.pdb" /machine:I386 /def:".\\%(module)s.def"\\
 /out:"$(OUTDIR)/%(module)s.dll" /implib:"$(OUTDIR)/%(module)s.lib" 
DEF_FILE= \\
	".\\%(module)s.def"
LINK32_OBJS= \\
	"$(INTDIR)/%(module)s.obj" \\%(other_link)s
	"%(pyhome)s\\pcbuild\\%(cfg)s\\python15.lib"

"$(OUTDIR)\\%(module)s.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
    $(LINK32) @<<
  $(LINK32_FLAGS) $(LINK32_OBJS)
<<

!ELSEIF  "$(CFG)" == "%(module)s - 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 "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
OUTDIR=.\\Debug
INTDIR=.\\Debug

ALL : "$(OUTDIR)\\%(module)s.dll"

CLEAN : 
	-@erase ".\\Debug\\%(module)s.dll"
	-@erase ".\\Debug\\%(module)s.obj"%(other_clean_debug)s
	-@erase ".\\Debug\\%(module)s.ilk"
	-@erase ".\\Debug\\%(module)s.lib"
	-@erase ".\\Debug\\%(module)s.exp"
	-@erase ".\\Debug\\%(module)s.pdb"
	-@erase ".\\Debug\\%(module)s.pch"
	-@erase ".\\Debug\\pcbuild.pdb"
	-@erase ".\\Debug\\pcbuild.idb"

"$(OUTDIR)" :
    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"

# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "%(pyhome)s\\Include" /I "%(pyhome)s\\PC" %(includes)s /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "%(pyhome)s\\Include" /I "%(pyhome)s\\PC" %(includes)s /D "WIN32"\\
 /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/%(module)s.pch" /YX /Fo"$(INTDIR)/"\\
 /Fd"$(INTDIR)/" /c 
CPP_OBJS=.\\Debug/
CPP_SBRS=
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ=/nologo /D "_DEBUG" /win32 
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/%(module)s.bsc" 
BSC32_SBRS=
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:windows /dll /debug /machine:I386
# ADD 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:windows /dll /debug /machine:I386
LINK32_FLAGS=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:windows /dll /incremental:yes\\
 /pdb:"$(OUTDIR)/%(module)s.pdb" /debug /machine:I386 /def:".\\%(module)s.def"\\
 /out:"$(OUTDIR)/%(module)s.dll" /implib:"$(OUTDIR)/%(module)s.lib" 
DEF_FILE= \\
	".\\%(module)s.def"
LINK32_OBJS= \\
	"$(INTDIR)/%(module)s.obj" \\%(other_link)s
	"%(pyhome)s\\pcbuild\\%(cfg)s\\python15.lib"

"$(OUTDIR)\\%(module)s.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
    $(LINK32) @<<
  $(LINK32_FLAGS) $(LINK32_OBJS)
<<

!ENDIF 

.c{$(CPP_OBJS)}.obj:
   $(CPP) $(CPP_PROJ) $<  

.cpp{$(CPP_OBJS)}.obj:
   $(CPP) $(CPP_PROJ) $<  

.cxx{$(CPP_OBJS)}.obj:
   $(CPP) $(CPP_PROJ) $<  

.c{$(CPP_SBRS)}.sbr:
   $(CPP) $(CPP_PROJ) $<  

.cpp{$(CPP_SBRS)}.sbr:
   $(CPP) $(CPP_PROJ) $<  

.cxx{$(CPP_SBRS)}.sbr:
   $(CPP) $(CPP_PROJ) $<  

################################################################################
# Begin Target

# Name "%(module)s - Win32 Release"
# Name "%(module)s - Win32 Debug"

!IF  "$(CFG)" == "%(module)s - Win32 Release"

!ELSEIF  "$(CFG)" == "%(module)s - Win32 Debug"

!ENDIF 

################################################################################
# Begin Source File

SOURCE=.\\%(module)s.c
DEP_CPP_MOD=\\
	"%(pyhome)s\\Include\\Python.h"\\
	"%(pyhome)s\\PC\\config.h"\\
	"%(pyhome)s\\Include\\myproto.h"\\
	"%(pyhome)s\\Include\\object.h"\\
	"%(pyhome)s\\Include\\objimpl.h"\\
	"%(pyhome)s\\Include\\pydebug.h"\\
	"%(pyhome)s\\Include\\intobject.h"\\
	"%(pyhome)s\\Include\\longobject.h"\\
	"%(pyhome)s\\Include\\floatobject.h"\\
	"%(pyhome)s\\Include\\complexobject.h"\\
	"%(pyhome)s\\Include\\rangeobject.h"\\
	"%(pyhome)s\\Include\\stringobject.h"\\
	"%(pyhome)s\\Include\\tupleobject.h"\\
	"%(pyhome)s\\Include\\listobject.h"\\
	"%(pyhome)s\\Include\\methodobject.h"\\
	"%(pyhome)s\\Include\\moduleobject.h"\\
	"%(pyhome)s\\Include\\funcobject.h"\\
	"%(pyhome)s\\Include\\classobject.h"\\
	"%(pyhome)s\\Include\\fileobject.h"\\
	"%(pyhome)s\\Include\\cobject.h"\\
	"%(pyhome)s\\Include\\traceback.h"\\
	"%(pyhome)s\\Include\\sliceobject.h"\\
	"%(pyhome)s\\Include\\pyerrors.h"\\
	"%(pyhome)s\\Include\\mymalloc.h"\\
	"%(pyhome)s\\Include\\modsupport.h"\\
	"%(pyhome)s\\Include\\ceval.h"\\
	"%(pyhome)s\\Include\\pythonrun.h"\\
	"%(pyhome)s\\Include\\sysmodule.h"\\
	"%(pyhome)s\\Include\\intrcheck.h"\\
	"%(pyhome)s\\Include\\import.h"\\
	"%(pyhome)s\\Include\\abstract.h"\\
	"%(pyhome)s\\Include\\rename2.h"\\
	"%(pyhome)s\\Include\\thread.h"\\
	

"$(INTDIR)\\%(module)s.obj" : $(SOURCE) $(DEP_CPP_MOD) "$(INTDIR)"
%(other_rule)s

# End Source File
################################################################################
# Begin Source File

SOURCE=.\\%(module)s.def

!IF  "$(CFG)" == "%(module)s - Win32 Release"

!ELSEIF  "$(CFG)" == "%(module)s - Win32 Debug"

!ENDIF 

# End Source File
################################################################################
# Begin Source File

SOURCE=%(pyhome)s\\pcbuild\\%(cfg)s\\python15.lib

!IF  "$(CFG)" == "%(module)s - Win32 Release"

!ELSEIF  "$(CFG)" == "%(module)s - Win32 Debug"

!ENDIF 

# End Source File
################################################################################
# Begin Source File

SOURCE=.\\readme.txt

!IF  "$(CFG)" == "%(module)s - Win32 Release"

!ELSEIF  "$(CFG)" == "%(module)s - Win32 Debug"

!ENDIF 

# End Source File
# End Target
# End Project
################################################################################
'''
    return tdef, tmak

if __name__=='__main__': main()

--------------DC96900A49D211FFABC66154--