Search code examples
pythonvirtualenvpipcorba

install omniorb python in a virtualenv


I am trying to install omniorb in a virtualenv for python.

Doing this using the included configure script with omniorb seems rather difficult.

Does anyone know about a pip, setup.py or easy_install script for omniorb?


Solution

  • Out of curiosity I just tried this on Ubuntu 10.04. I don't have a pip or setup.py solution for you, but it isn't too hard.

    I think the secret is to set the PYTHON variable to configure to point to the python executable in your virtualenv. I built omniORB and omniORBPy from source and installed them to a directory under my virtualenv (by specifying the --prefix option to configure).

    You then have to put the site-packages directory that gets created under the omniORB install directory on your PYTHONPATH. I chose to do this by creating a omniorb.pth file in my virtualenv's site-packages folder (more on this below).

    Here is the shell history of what I did. I am working out of a directory /home/brian/coding/python/virtualenvs. You'll have to mentally adjust paths, etc. for your environment.

     virtualenv omniORB
     cd omniORB/
     . bin/activate
     cp /home/brian/Downloads/omni* .
     tar xvfj omniORB-4.1.6.tar.bz2 
     tar xvfj omniORBpy-3.6.tar.bz2 
     mkdir omniORB_install
     cd omniORB-4.1.6/
     mkdir build
     cd build
     ../configure --prefix=/home/brian/coding/python/virtualenvs/omniORB/omniORB_install/ PYTHON=/home/brian/coding/python/virtualenvs/omniORB/bin/python 
     make
     make install
     cd ../../omniORBpy-3.6/
     mkdir build
     cd build
     ../configure --prefix=/home/brian/coding/python/virtualenvs/omniORB/omniORB_install/ PYTHON=/home/brian/coding/python/virtualenvs/omniORB/bin/python --with-omniorb=/home/brian/coding/python/virtualenvs/omniORB/omniORB_install/
     make
     make install
    

    Now here is that omniorb.pth file I mentioned earlier. Change directory to the top of your virtualenv. Create omniorb.pth such that it looks and is located like this:

    $ cat lib/python2.6/site-packages/omniorb.pth 
    /home/brian/coding/python/virtualenvs/omniORB/omniORB_install/lib/python2.6/site-packages
    

    Now, inside my activated virtualenv:

    $ python
    Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import CORBA
    >>> CORBA.__file__
    '/home/brian/coding/python/virtualenvs/omniORB/omniORB_install/lib/python2.6/site-packages/omniORB/CORBA.pyc'
    >>>