[Distutils] installing to a non-standard directory

P.J. Eby pje at telecommunity.com
Sun Nov 21 19:33:37 CET 2010


At 03:39 PM 11/20/2010 -0800, K. Richard Pixley wrote:
>Context #1: an alternate packaging mechanism.  I want to use that 
>packaging mechanism because it's the most appropriate way to package 
>and distribute my module for this application.  The packaging 
>mechanism involves calling "install", (typically "make install 
>prefix=/tmp/jail", but there's no reason it couldn't be "python 
>setup.py install"), in a sort of jail.  Anything installed during 
>that encapsulation is recorded and those pieces are the ones which 
>are picked up and packaged by the automatic packaging system.

Use --root, then.  That's what it's for.

>Context #2: cross development.  I'm running on one system producing 
>a root file system which will be used later to boot a new 
>system.  This is another application of "make install PREFIX=/tmp/newroot"

Likewise, this is what --root is for.

In both of the above cases, you want the prefix of anything you build 
to be set up for the prefix where it's really going to *end up* 
installed, not to the temporary directory where you're 
mock-installing it to.  That's why all distutils' internal commands 
use --root when they call an install operation for packaging.


>What I want to do is to manage and build my tool in python, 
>including nose tests outside of bitbake, as a component within 
>openembedded.  This means that bitbake will build the component and 
>install the component into a staging area which is unique to this 
>particular build directory.  It can then import the tool from the 
>local staging area and use it.
>
>What I want to do is the moral equivalent of "make install 
>prefix=foo" or "make install DESTDIR=foo".  It's a common task with 
>numerous applications.  This shouldn't be difficult and I really 
>can't believe that I'm the first person using python to want to do 
>this.  It's a 10 character command line option.  There should be 
>something comparably simple in distutils/setuptools/whatever, no?

Yes.  It's --root.  ;-)



More information about the Distutils-SIG mailing list