Python 2.7 (final) was released on 3rd July 2010, which is almost half a year ago. One of the awful things about Python is that major releases are not compatible with each other. That is the extension modules compiled against Python 2.6 do not play nicely with the extension modules compiled against Python 2.7. The upshot of this, is that if you want to upgrade your version of Python you have to hunt around looking for extension modules compiled against your new version. In spite of Python 2.7 being 7 months old (1 year + 1 month if you count back to the release of Python 2.7 alpha 1), there isn’t as much extension module support as you’d expect; you still have to hunt and most of it is on unofficial websites i.e. not in the download pages of its project.
One such project is the CORBA implementation omniORB. It’s download pages only contain the Python 2.6 version. While I can use ./configure
to build projects under unix with ease the building of omniORBpy under windows was much more troublesome. I can see why no one has attempted it thus far.
So for all you lucky people out there here is how you do it.
You need to have Python installed but you probably have that already so I’m not going to talk about that here.
We need to compile the omniORB library first then we can compile the omniORBpy against that.
Firstly we must create a directory to download our source software into:
mkdir C:\python-modules
Then download and unpack the source code. omniORB is housed at SourceForge so go to the download page at:
http://sourceforge.net/projects/omniorb/files/
and download the latest omniORB (omniORB-4.1.5.tar.bz2
) and omniORBpy (omniORBpy-3.5.tar.bz2
)
We also need the openssl implementation which can be downloaded from:
http://code.google.com/p/openssl-for-windows/downloads/list
The latest one is openssl-0.9.8k_WIN32
(at the time of writing).
Unpack them all into C:\python-modules
so that we have three folders C:\python-modules\omniORB-4.1.5
, C:\python-modules\omniORBpy-3.5
and C:\python-modules\openssl-0.9.8k_WIN32
.
omniORBpy-3.5 needs to be in a special place to move it to C:\python-modules\omniORB-4.1.5\src\lib\omniORBpy
(removing the version number from the end of the directory name).
The build process needs Cygwin which I already had installed. I tried to use it in the build but it didn’t work, the “make” just hung. So I just stuck to the instructions and used omniORB’s cut-down version. You can download this from http://omniorb.sourceforge.net/att_packages/gnu-win32-lite.zip and unpack it into c:\gnuwin32
.
Now that we have all the software downloaded, we can start configuring the build.
Edit C:\python-modules\omniORB-4.1.5\config\config.mk
and uncomment the platform you are using in my case it is x86_win32_vs_9
Next load the platform specific file from C:\python-modules\omniORB-4.1.5\mk\platforms\x86_win32_vs_9.mk
. As we will be building in a Cygwin environment, we need to specify paths in Cygwin format. Change the variable PYTHON
to point to the correct location of the Python executable. In my case I have Python 2.7 installed (but anything above Python 1.5 is fine)
PYTHON = /cygdrive/c/Python27/python
OpenSSL transport support is disabled by default because you need the Open SSL libraries which we have now so uncomment the OPEN_SSL_ROOT location. The path has to be a relative path. I tried all combinations of windows-style full paths and cygwin-style full paths and none of them worked. “make clean” doesn’t reset the build like it should do :( So if there is a problem during the build you have to unpack the sources from the zips again to create a fresh source tree. Set the ssl root to:
OPEN_SSL_ROOT = ../../../../../../openssl-0.9.8k_WIN32
which is a relative reference to C:\python-modules\openssl-0.9.8k_WIN32
from C:\python-modules\omniORB-4.1.5\src\lib\omniORB\orbcore\ssl
!
Now that we are configured we can actually start the build.
Open a command window and add c:\gnuwin32
to the start of your path:
set PATH=c:\gnuwin32\bin;%PATH%
Run the visual studio batch file to set up the build environment:
“C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat”
Not quite sure what this does but you need it. I think it has something to do with translating cygwin paths to windows paths
C:\gnuwin32\bin\checkmounts C:\gnuwin32
Change to the omniORB source directory and run the build:
cd C:\python-modules\omniORB-4.1.5\src
make export
The build of omniORB will take about 30 minutes.
Next up is to compile the omniORBpy. Change to the omniORBpy source directory and run the build from there:
cd C:\python-modules\omniORB-4.1.5\src\lib\omniORBpy
make export
The build of omniORBpy will take about 3 minutes.
Once the build has finished you need to create a module extension package so that you can give it to other people so they don’t have to go through all the hassle of downloading and compiling it all up.
The pre-built omniORBpy using Python 2.6 resident on SourceForge has a problem which means you need to adjust your PYTHONPATH
and your actual PATH
in order to use it. I use Clearcase which has everything on different drives so having to hard code drive letters made it almost impossible to use in a shared environment. Fear not I have done the 2 hours of reading really boring documentation so you don’t have to and constructed a omniORBpy 3.5 (omniORB 4.1.5) with Python 2.7 module extension that doesn’t require you to update your PATH
or PYTHONPATH
by making use of the site pth features and the nugget of information I found buried on a forum that said that a pyd (Python dynamic library) would pick up DLLs from the same directory it lived in automatically.
Unfortunately the build system is not set up enough so that you can make an installable deliverable to give out like you get with some projects (for example lxml). This means you have to do it by hand and it’s a real pain in the arse!
I’ve written a program to make the omniORBpy extension placing everything in the right place. It’s a bit rough but it works. You can download it from here:
omniorbpy-make-dist.py.zip
Well, thanks for reading all the way to the end (if you did!) and your prize is omniORBpy 3.5 with omniORB 4.1.5 binding using Python 2.7.1. Enjoy.
*Installation instructions*
- Download omniorbpy-3.5.win32-py2.7.zip
- Unpack
omniORBpy-3.5.win32-py2.7.zip
into C:\Python27\Lib\site-packages