[Distutils] Distributing Python-programs to Ubuntu users

Floris Bruynooghe floris.bruynooghe at gmail.com
Fri Sep 25 11:41:14 CEST 2009

On Fri, Sep 25, 2009 at 10:23:58AM +0200, Olof Bjarnason wrote:
> I'm new at the mailing list. I write small games in Python/PyGame. I
> want to find a way to make a downloadable package/installer/script
> to put on my webpage, especially for Ubuntu users.
> I've skimmed a couple of tutorials on how to generate .deb-files, but,
> wow, it's a whole new skill set to do that!
> Does anyone have any hint on a more economic way of creating
> single-file distribution packages for Python+PyGame projects? Maybe
> some GUI-tool that automates the .deb file creation process, but
> targetting Python specifically and not C++.

If your code (including dependencies) only uses pure-python you could
use the executable zipfile feature of Python 2.6 to simply ship an
executable that only needs Python.

$ cat > __main__.py
print('hi there')
$ zip test.zip __main__.py
adding: __main__.py (stored 0%)
$ cat > hashbang.txt
#!/usr/bin/env python3.0
$ cat hashbang.txt test.zip > my_exec
$ chmod +x my_exec
$ ./my_exec
hi there

Obviously you'd have to put all your the packages and modules you
depend on inside the zipfile.

This sort of sounds like what you are looking for.  It's not a
replacement for a properly shipped/distributed application but does a
good job if you just want to give your friends a small game to play.


PS: My search-foo must be low today as I couldn't find any official
documentation on this.  Any pointers?

Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org

More information about the Distutils-SIG mailing list