python - app packaging - wrapper script ?

Todd Zullinger tmz at pobox.com
Wed Jun 11 15:07:21 UTC 2008


David Timms wrote:
> Hi, I'm packaging a python based app [1], that I want to make a
> wrapper script [2] {or similar} for, so the app can start from a
> normal user terminal, with just the script name.
>
> I have had a couple of goes, but I'm not getting it. It's supposed
> to detect the appropriate lib/lib64 directory, append the
> site-lib/appfolder path, and call the python app. Any pythonites
> know a solution ?

I haven't read the bugzilla entry nor had my tea yet today, but here's
what I've done for some python apps:

#!/bin/sh
sitelib=`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`
exec python $sitelib/appdir/appname.py "$@"

Replace appdir and appname appropriately, put it in /usr/bin/appname,
and make it executable.  If the software you are packaging installs
arch dependent files, you will probably need to replace the sitelib
call to:

sitelib=`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)"`

Notice the 1 in get_python_lib() there.  That tells python to return
the arch specific lib dir.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are three ways to get something done: do it yourself, hire
someone, or forbid your kids to do it.
    -- Monta Crane

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 542 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20080611/1a7a026e/attachment-0001.sig>


More information about the fedora-list mailing list