python packaging - icons/desktop files and /usr/bin accessibility

Toshio Kuratomi a.badger at gmail.com
Mon May 5 18:26:46 UTC 2008


Mary Ellen Foster wrote:
> On Mon, May 5, 2008 at 1:32 PM, David Timms <dtimms at iinet.net.au> wrote:
>> I'm packaging a basic python program, and request some guidance:
>>
>>  1. the app has three main .py programs, and another 10 or so .py modules.
>> My installed rpm puts these in site-packages/appname which I understand the
>> guidelines to require. Problem is these are not accessible as a user because
>> they aren't on the path.
>>  So it works if I /usr/lib/python../site-packages/myapp/app1.py
>>
>>  Should I be messing with the path ?
>>  Creating a shell script for each of the main programs, and dropping them in
>> /usr/bin ?
> 
> Note that if you want the libraries to be available to Python, as far
> as I understand it, the standard way to do this is to a "*.pth" file
> and put it into site-packages. For example, for my package (which puts
> files into an "Ice" subdirectory), I created a file called ice.pth
> containing only the following:
>     Ice
> For yours, you probably want to create "myapp.pth" containing the line
> "myapp" and install that into site-packages.
> 
> This doesn't answer the question of how to run the programs, though, of course.
> 
Personally, I avoid .pth files when possible because of the performance 
hit that they cause.  I'd much rather set PYTHONPATH individually for 
each application that needs to know about a special path.  For doing 
this in python, you can look at /usr/bin/yum.  For doing it in bourne 
shell /usr/bin/gramps (from the gramps package.)

ice may be a special case because it is a module requiring another 
module although I need to look a little closer at that.  Something looks 
fishy about what python-ice is doing.

Also note that this particular case doesn't seem to need a .pth 
file/PYTHONPATH changes as, if I'm reading it correctly, the module is 
being installed into site-packages which python searches under normal 
circumstances.  It's just that the application file itself is also being 
installed into site-packages so invoking the application fails to find 
/usr/bin/APPNAME.

-Toshio




More information about the devel mailing list