How To run current Zope 2 & 3 from CVS on Windows
Though releases are made once in a while for Z3, they are quickly outdated. So if you want to develop on it, or just try it out, you need to download it from CVS.
This can be a problem for Windows developers that do not have Microsofts Visual Studio installed.
The reason is that Z3 must be compiled with the same compiler as the Python install.
The ususal Python Windows distribution is compiled with VS 6.0, so if you want to run Z3 with your normal installer, it must be compiled with that.
Without VS 6.0 installed, that is a bit of a jam for us lowly Windows developers.
There are a few ways to get around it though, even without a compiler.
Cygwin
One option is to install Cygwin with it's development tools, and run Z3 from there. That works nicely. But it's quite a long download, and it doesn't feel that "Windowsy."
I was lazy, had a fast line and a big empty harddisk, so I just downloaded all the development tools during lunch. That was about 800 MB
It is pretty painless though. The Windows friendly Cygwin installer, created a directory with the same directory structure that a Linux machine usually has.
You can then open a command line and navigate it via a Bash shell. Like you would in a Linux console.
That way you can compile Z3 like on Linux.
Even with just a little Linux experience it isn't that difficult to get going.
Binary files
But there is a better approach. At least in my mind.
There is only little difference between the files you get via CVS and the compiled version of Zope. The directory structure is exactly the same.
The only difference is the compiled files. So if you could just get the compiled files, and put those into the correct places in the branch from CVS, you would be able to run the latest development branch of Z3. Even without Visual Studio.
Well that is possible. Tim Peters from Zope Corp. has made a zip file with only the compiled files. The nice thing is that they are in in the right directory structure.
You can get it here (~150KB):
http://zope.org/Members/tim_one/Zope3-pyd.zip
http://www.zope.org/Members/tim_one/Zope2-Py2.4-pyd.zip
When you unpack the zip file, it will have this directory structure in which the binary files resides:
src/
BTrees/
persistent/
ZODB/
zope/
app/
container/
hookable/
interface/
proxy/
security/
As mentioned, it's the same structure as the source from CVS. So unpack it, and copy it over the src/ directory in your CVS structure. Then you should be able to get Z3 up and running.
Just follow the rest of the instructions at: InstallingZope3
The best thing about this approach, is that the binary files are not in CVS, so whenever you do an update from CVS you don't need to download and install the binary files again.
This is only nessecary when the binary files changes. Which is a rare event.
If you are not used to CVS, I recommend that you use TortoiseCVS. It's easy, and integrates nicely into the Windows desktop.
Here is a screenshot of TortoiseCVS downloading Zope3:
If you paste this line into the CVSROOT field, most fields are filled out automatically:
:pserver:anonymous@cvs.zope.org:/cvs-repository
The binary files for Zope can be found here:
http://www.zope.org/Members/tim_one/Zope2-Py2.4-pyd.zip
http://www.zope.org/Members/tim_one/Zope3-Py2.4-pyd.zip
You can use a similar procedure to get that up and running from CVS.
Link of Tim's Extensions changed
bzw.
http://www.zope.org/Members/tim_one/Zope2-Py2.4-pyd.zip/
Link broken
results in a 404.
download MinGW from http://www.mingw.org/ (it is only 14Mb)
and use that for compiling extensions.
To set up my environment I did following steps:
- downloaded MinGW from http://sourceforge.net/project/showfiles.php?group_id=2435
and installed it to a directory without spaces in the name (just to be safe)
- made sure bin directory from the MinGW installation folder is on the PATH
- generated libraries that could be used by MinGW.
This step is a little more involved but if you follow instructions found in Python documentation:
http://docs.python.org/inst/tweak-flags.html#SECTION000622000000000000000 you should be OK.
Assuming you have pexports.exe in your path you can place following script
in [your python]\libs directory and have the libs generated automatically.
############################################################
import os
import shutil
def genLib(dll, dllbase):
cmd = 'dlltool --dllname %s --def %s.def --output-lib lib%s.a'%(dll,dllbase, dllbase)
f = os.popen(cmd)
print f.read()
def genSymbols(dllpath):
shutil.copy(dllpath, '.')
p, dll = os.path.split(dllpath)
dllbase = os.path.splitext(dll)[0]
#produce .def file
cmd = 'pexports %s' %(dll)
f = os.popen(cmd)
file('%s.def'%dllbase, 'wb').write(f.read())
genLib(dll, dllbase)
#cleanup
os.remove('%s.def'%dllbase)
os.remove(dll)
if __name__=='__main__':
paths = ('c:/winnt/system32/python23.dll',)
for p in paths:
genSymbols(p)
####################################################33
- now you are ready to roll.
Running following command should leave you with compiled extensions:
python setup.py build_ext -i --compiler=mingw32
To avoid putting --compiler=mingw32 option every time create distutils.cfg in
[your python]\lib\distutils directory with following two lines:
[build]
compiler=mingw32