Search code examples
pythonvirtualenvwaf

How to tell Python waf where to place package? Can it work with virtualenv?


I am trying to install a ready-made waf package (py2cairo) in a directory of my choice. Ideally in my virtualenv site-packages. This should be simple, but I can't seem to get waf to do it.

$ sudo ./waf install
  ./options()
Waf: Entering directory `/tmp/py2cairo-1.10.0/build_directory'
  ./build()
  src/build()
- install /usr/local/include/pycairo/pycairo.h (from src/pycairo.h)
+ install /usr/local/lib/python2.6/site-packages/cairo/_cairo.so (from build_directory/src/_cairo.so)
+ install /usr/local/lib/pkgconfig/pycairo.pc (from pycairo.pc)
Waf: Leaving directory `/tmp/py2cairo-1.10.0/build_directory'
- install /usr/local/lib/python2.6/site-packages/cairo/__init__.py (from src/__init__.py)
+ byte compiling '/usr/local/lib/python2.6/site-packages/cairo/__init__.py'
'install' finished successfully (0.130s)

I want to change /usr/local/lib/python2.6/site-packages/cairo/__init__.py to something of my choosing. I can't find a configuration option that does this for me.

The --prefix command add a prefix to string, but doesn't change it. The --destdir seem sto make no difference.


Solution

  • Edit: If the developer did not implement such an option, --prefix is all you get.

    You can dig through it yourself and add such an option which usees the methods .install_as , .symlink_as, .install_files.

    For details see the wafbook chapter 4.2.2