[Zope-dev] What does DC use to compile Splitter.c on Windows?
resefficient...
resefficient@yahoo.com
Thu, 22 Mar 2001 15:44:02 -0800 (PST)
I just got back into my office and low and behold!
Andy, you shouldn't have...but I'm glad you did. :)
I'll test it out.
I can't wait to see what Chris M. has up his sleeve.
--- Andy McKay <andym@ActiveState.com> wrote:
> Here we go.... maybe
>
> How to:
>
> get Python 1.5.2 source and build it.
> get Zope source
> put ext15.py somewhere in your path
>
> then call
>
> d:\Python-1.5.2\python d:\Zope-2.3.0-src\ext15.py -p
> d:\Python-1.5.2
>
> you need to specify the source of your python and
> you may need to move a few
> files within python to get it looking at the right
> files.
>
> totally untested pyd but Visual Studio 6.0 didnt
> complain
>
> HTH
> --
> Andy McKay.
>
>
> ----- Original Message -----
> From: "resefficient..." <resefficient@yahoo.com>
> To: <zope-dev@zope.org>
> Sent: Thursday, March 22, 2001 1:36 PM
> Subject: [Zope-dev] What does DC use to compile
> Splitter.c on Windows?
>
>
> > Can someone from DC tell me what they use to come
> up
> > with the binary version of the Splitter on
> Windoze. I
> > am trying to get the Catalog to recognize "C++" on
> > Win32. I have posted the Splitter.c file to my
> home
> > page http://www.zope.org/Members/jspisak/Splitter
> >
> >
> > Can anyone give me a clue as to how to make a
> working
> > Splitter.pyd out of this file on Windoze.
> >
> > Thanks in advance!
> >
> > Jason Spisak
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get email at your own domain with Yahoo! Mail.
> > http://personal.mail.yahoo.com/
> >
> > _______________________________________________
> > Zope-Dev maillist - Zope-Dev@zope.org
> > http://lists.zope.org/mailman/listinfo/zope-dev
> > ** No cross posts or HTML encoding! **
> > (Related lists -
> >
> http://lists.zope.org/mailman/listinfo/zope-announce
> > http://lists.zope.org/mailman/listinfo/zope )
> >
>
> ATTACHMENT part 2 application/octet-stream
name=Splitter.pyd
> ATTACHMENT part 3 application/octet-stream
name=Splitter.def
> ATTACHMENT part 4 application/octet-stream
name=Splitter.mak
> ATTACHMENT part 5 application/octet-stream
name=Splitter.c
>
> '''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)
>
> The script reads a file named "Setup" in the current
> directory. The
> Setup file has lines that describe the contents of
> an extension.
> Here\'s an example:
>
> ExtensionClass ExtensionClass.c
> Acquisition Acquisition.c
>
> Note that I\'ve intented for readability. The Setup
> file shouldn\'t
> be indented. Basically, the first token on the line
> is the module
> name, and the second token on the line is the sorce
> file. Additional
> source files and include directories may be included
> as well, as in:
>
> pyexpat pyexpat.c -DXML_NS -Iexpat/xmlparse
> -Iexpat/xmltok expat/xmlparse/xmlparse.c
> expat/xmlparse/hashtable.c expat/xmltok/xmlrole.c
> expat/xmltok/xmltok.c
>
>
> ''' # '
>
> 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]
> src=sargs[1]
> if src[:2]=='./': continue
> 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))
>
> sargs=map(lambda a: string.replace(a,
> '/','\\'), sargs)
> simple(module,poptlist+soptlist, sargs)
>
>
> main=setup
>
> def filebase(o,
> splitext=os.path.splitext,
> split=os.path.split):
> return splitext(split(o)[1])[0]
>
>
>
> 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"' %
> filebase(o),
> others),'')
> parms['other_clean_debug']=string.join(
> map(lambda o:
> '\n\t-@erase ".\\Debug\\%s.obj"' %
> filebase(o),
> others),'')
> parms['other_rule']=string.join(
> map(lambda o:
> '"$(INTDIR)\%s.obj" : .\%s $(DEP_CPP_MOD)
> "$(INTDIR)"\n'
> '\t$(CPP) $(CPP_PROJ) .\%s '
> % (filebase(o), o, o),
> others),'\n')
> parms['other_link']=string.join(
> map(lambda o:
> '\n\t"$(INTDIR)\%s.obj" \\' % filebase(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"
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/