[wxPython-users] Cross-platform distribution

Christopher Barker Chris.Barker at noaa.gov
Mon Oct 1 12:01:02 PDT 2007


Dusty Phillips wrote:

> I'm trying to figure out a better way to ship extra so called
> "resource" files with my wxPython-based application such that they can
> be accessed in a cross-platform manner. 

> I currently use distutils rather clumsily and place these files in the
> data_files array:

distutils is really designed for distributing packages, rather than 
applications. That is, essentially libraries that folks will use to 
build their own apps.

For distributing applications, you're better off with Py2exe on Windows, 
Py2App on OS-X (those two are pretty compatible), and probably a regular 
old tarball for Linux (or maybe PyInstaller). If you want to make things 
really nice for Linux users, you'd build an rpm, and deb, and .....

Anyway, at least py2app and Py2exe have, I think, a standard place to 
put data files.

Another option is to make your "resources" python files instead. img2py 
is a script distributed with wxPython that turns various image types 
into python source code, and virtually any other type of data could be 
serialized in a similar way, I'm sure. I like this approach, it makes 
things pretty darn clean.
 > I
> don't know what happens on a Mac and I'm not in a position to worry
> about it until a Mac user becomes interested in my software

I'm an interested Mac user -- at least if you're still working on 
meeting Robin's "give me a way for me to leave Emacs" challenge.

> I don't know how to reliably access these paths under wxPython.
> wx.StandardPaths returns /usr/share/pallavi under Linux ...

Right. The problem is that wx.StandardPaths and distutils are totally 
unrelated. I suppose you could use wx.StandardPaths in your setup.py 
file, as there wouldn't be much point in anyone running it without wx 
installed anyway.

if you do want to use distutils, this may be helpful:

http://wiki.python.org/moin/DistutilsInstallDataScattered

(the Wiki seems to be down for the moment, so I'm not sure how helpful 
that may be, I found the link in the matplotlib setup.py -- it uses a 
lot of data files)

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list