[vtk-developers] python install prefix in setup.py

David Gobbi dgobbi at atamai.com
Wed Feb 15 14:30:21 EST 2006


Sebastien BARRE wrote:

> At 10:50 AM 2/15/2006, you wrote:
>
>> I'm guessing that you need to know where site-packages is so that you 
>> can set the PYTHONPATH
>> automatically.  So VTK's CMake will have to figure out how setup.py 
>> calculates the path to site-packages,
>> and will then create VTK_PYTHON_MODULE_DIRS in UseVTK.cmake so that 
>> other projects
>> can find it.
>>
>> Is that the kind of thing you are looking for?
>
>
> Yup, sounds good.

I've looked in the distutils module and there is a method there that we 
can use:
"distutils.sysconfig.get_python_lib(0,0,prefix)" will return the path 
where the .py files go,
and "distutils.sysconfig.get_python_lib(1,0,prefix)" will return the 
path where .so/.dll files go.
Usually these are the same path, but some people configure their python 
to keep platform-specific
files (the .so files) in platform-specific directories.

The "prefix" is tricky because, right now, it has to be extracted from 
VTK_PYTHON_SETUP_ARGS.
It seems that maybe having a VTK_PYTHON_INSTALL_PREFIX variable might be 
a good idea,
I'm not sure how many people use VTK_PYTHON_SETUP_ARGS for things other 
than setting
the prefix. Prabhu, do you have any insight?

To be complete, the following CMake variables should be created (and 
should definitely be advanced):
VTK_PYTHON_MODULE_INSTALL_DIR for the .py/.pyc files
VTK_PYTHON_MODULE_PLAT_INSTALL_DIR for the .so/.dll files

The UseVTK.cmake should probably store these, and should also have a 
VTK_PYTHON_MODULE_DIRS
that can be used for setting the PYTHONPATH.  For installed VTK, it will 
be set to
VTK_PYTHON_MODULE_INSTALL_DIR plus VTK_PYTHON_MODULE_PLAT_INSTALL_DIR.
For a build-directory VTK, it will be set to the VTK/bin directory and 
the VTK/Wrapping/Python directory.

Does this sound too involved?

 - David







More information about the vtk-developers mailing list