Python apps

Get help on how to use the AppImageKit SDK to produce AppImages

Python apps

Postby probono » Sun Apr 25, 2010 4:10 pm

Due to the way Python imports work and due to the way Python packages are installed on Debian and Ubuntu, it is not trivial to create working AppDirs from them. Instead of using distributions' packages, I have found it much more convenient to use upstreams' source packages and work from there for Python apps.

To find out what Python files a Python app (let's say "SpiderOak") accesses, you can use

Code: Select all
strace -eopen -f ./SpiderOak 2>&1 | grep / | grep -v ENOENT | cut -d "\"" -f 2 | sort | uniq > openedfiles


To find out where Python "eggs" live, and to conveniently move them in place, you can use

Code: Select all
DIRS=$(find . -name *.egg-info -exec dirname {} \; 2>/dev/null | sort | uniq)
for DIR in $DIRS; do
    SRCS=$(find $DIR -mindepth 1 -maxdepth 1 -not -name *egg-info -type d -or -name *.py)
    mv $SRCS .
done

Let's not forget .so libraries:

Code: Select all
mv usr/lib/pyshared/python*/* usr/bin/

Update 1/11: Looks like we should put in Some.AppDir/usr/share/pyshared/sitecustomize.py whenever the AppDir contains .py files:

Code: Select all
import os.path, sys, glob
appdir = os.path.abspath(os.path.join(__file__, "../../../../"))
sys.path = glob.glob(appdir) + \
glob.glob(os.path.join(appdir, "usr/lib/py*/")) + \
glob.glob(os.path.join(appdir, "usr/lib/py*/py*")) + \
glob.glob(os.path.join(appdir, "usr/lib/py*/py*/*/")) + \
glob.glob(os.path.join(appdir, "usr/lib/py*/dist*/")) + \
glob.glob(os.path.join(appdir, "usr/lib/py*/dist*/*/")) + \
glob.glob(os.path.join(appdir, "usr/lib/py*/site*/")) + \
glob.glob(os.path.join(appdir, "usr/lib/py*/*/")) + \
glob.glob(os.path.join(appdir, "usr/share/py*/")) + \
sys.path

This gets picked up since AppRun exports Some.AppDir/usr/share/pyshared/ as $PYTHONPATH. It gets executed before the real app is run. Hopefully this does the trick. Needs to be tested though.
If you like PortableLinuxApps and the AppImage format, you might consider a donation --> Image
probono
Site Admin
 
Posts: 429
Joined: Sun Apr 25, 2010 9:41 am

Re: Python apps

Postby shadowbane » Wed Aug 18, 2010 10:29 am

Hi there, can you be more specific to the command?
Well, yeah, I'm not a developer, only a guy who wants to kill his time. But right now I'm working on zenmap to make it portable.
What is the next step after using your command?

Thanks
shadowbane
 
Posts: 2
Joined: Wed Aug 18, 2010 10:23 am

Re: Python apps

Postby probono » Wed Aug 18, 2010 8:25 pm

Uploaded zenmap for you, was quicker than to do a full writeup on how to do it :D
If you like PortableLinuxApps and the AppImage format, you might consider a donation --> Image
probono
Site Admin
 
Posts: 429
Joined: Sun Apr 25, 2010 9:41 am

Re: Python apps

Postby shadowbane » Thu Aug 19, 2010 11:34 am

Aww man.. You're great, dude! Thanks a lot!
But seriously, I think you should write down a little help, so you won't be a single fighter, and a n00b like me can do a little thing to spread this work.

Anyway, thanks again!
shadowbane
 
Posts: 2
Joined: Wed Aug 18, 2010 10:23 am

Re: Python apps

Postby dhunterkde » Tue Oct 12, 2010 7:34 pm

Hi I'm currently developing in PyQt and I would love to distribute my apps in this format.

Have you made a technical paper to understand what is going on across the whole process, I want to really get the "how to", not learning 3 dark steps . ;)

Cheers.

/* Update */

Sorry haven't seen the AppImageKit just the Assitant, I already found it and is just what I was looking for.

Maybe you should put it in a more visible place in the website, maybe in the header instead of the footer. ;)
dhunterkde
 
Posts: 2
Joined: Tue Oct 12, 2010 7:09 pm


Return to Packaging help

Who is online

Users browsing this forum: No registered users and 1 guest