prefix for installed scripts

Sridhar R sridharinfinity at yahoo.com
Thu May 6 09:16:48 EDT 2004


Kim Kulak <kkulak at shaw.ca> wrote in message news:<8Vemc.384062$oR5.32412 at pd7tw3no>...
> Hello,
> 
> I've run into a small problem with my first python program.
> 
> I'm writing this program on Debian Linux so python is installed in /usr 
> and sys.prefix is '/usr'. I've written a setup.py script and installed 
> my program and it's configuration data with prefix = '/usr/local'. It 
> installs exactly where I want it, but when I run my program 'sys.prefix' 
> is '/usr' (where python is installed) and not '/usr/local' (where my 
> program is installed.
> 
> My question is: how do I find where _my_ program was installed?

   You can write code in setup.py that creates a directory.py (say)
file in $prefix/youapp/, which contains the `prefix`
   Then you import that module and use `directory.prefix` to get your
installatino prefix.

> 
> TIA,
> Kim
> 
> P.S.
> Is anybody working on: "python setup.py uninstall" ?

   Again the same trick, you can code that in setup.py.  But a better
option is to install also a `uninstall.py` script, so that source
tarball is never needed after installation.
   Actually I am working on an IDE with all such project management
stuffs.



More information about the Python-list mailing list