[Distutils] --prefix

Nick Leaton nickle at gmail.com
Fri Sep 3 17:46:32 CEST 2010

I had an inkling I might be asking the wrong question.

It relates to releasing an app that has the following features.

1) Internal package
2) A couple of scripts
3) A dependency on an external package/library (Already packaged in its own
4) A couple of dll or equivalent on Unix.

We don't want to install into site-packages, we want to keep that clean. We
would like to install all the above into one directory structure, and set a
python path to poin to the appropriate directory. Almost xcopy installation
if that makes sense.

I can see two ways of doing this.

1. In a temporary build area build up everything and then package it
2. In the install script, as a post_install action install the external
package and the dlls

I'm trying to do the second, and as you say its the prefix for where python
is installed. I could parse the command line, but that smells it has to be

Advice please?


On 3 September 2010 16:38, P.J. Eby <pje at telecommunity.com> wrote:

> At 10:03 AM 9/3/2010 +0100, Nick Leaton wrote:
>> How can I get access to the value of --prefix from code during an install?
> If you mean from setup.py, you can't.  You would need to subclass one of
> the distutils commands and ue the cmdclass argument to setup().  (sys.prefix
> is the wrong answer, by the way; it contains the prefix where python was
> installed, *not* the prefix being installed to!)
> Even then, you don't want the value of --prefix, because that doesn't
> necessarily tell you where something should be installed!  Distutils has
> multiple installation schemes, many of which don't use --prefix at all.
>  --prefix is used to calculate various paths, but those paths can be
> specified individually, without using a --prefix.
> What's more, when a --root installation is taking place, putting things
> under --prefix would break bdist_rpm, bdist_wininst, bdist_msi, and other
> bdist_* commands, which are actually installing files to a temporary
> location in order to build an installation package, rather than "really"
> installing anything.
> In short, you're asking the wrong question, but if you can let us know what
> it is you're planning to *do* with this information, there may be an easier
> way to go about whatever you're actually trying to accomplish.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20100903/bc30e28f/attachment.html>

More information about the Distutils-SIG mailing list