prefix for installed scripts

K

Kim Kulak

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?

TIA,
Kim

P.S.
Is anybody working on: "python setup.py uninstall" ?
 
V

vincent wehren

Kim said:
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?

TIA,
Kim

P.S.
Is anybody working on: "python setup.py uninstall" ?
How about os.path.split(sys.argv[0])[0]?

HTH,

Vincent Wehren
 
S

Sridhar R

Kim Kulak said:
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.
 
K

Kim Kulak

Sridhar said:
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.

Yes, I think this is the way to do it. I was looking at the setup.py for
gaphor last night and noticed that it did this. Now I just have to look
deeper into how :).
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.

Thanks. I'll remember this too, but it's not a priority right now.
Actually I am working on an IDE with all such project management
stuffs.
Now this sounds interesting!!! Is it available someplace where I can
have a look at it? I'm working on an IDE too. Give me another week to
complete some cleanup and documentation and I'd be happy to send you
what I have.

Kim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,038
Members
47,633
Latest member
BriannaLyk

Latest Threads

Top