how to build a MacOS universal python package including external dependencies

Mathieu Prevot mathieu.prevot at gmail.com
Wed Sep 24 12:44:22 EDT 2008


2008/9/24 Jaime Huerta Cepas <jhuerta at cipf.es>:
> Hi all,
>
> I have developed a set python libraries that provide several scientific
> methods to analyse and visualize certain type of biological data.  This
> libraries are based on many external python modules, such as python-mysql
> python-sip or python-qt4. I use GNU/linux to develop my tools and I found no
> problems into installing all dependencies, however it does not seem to be
> that easy on MacOS. I am sure that all the dependencies (qt4, pyqt4 ,
> mysqldb, scipy, numpy) are cross platform, but when you are trying to
> publish your tool in an academic journal, most referees (many of them using
> MacOS) expect some kind of straightforward installation process for the
> tool.
>
> I wonder if there would be a way in which I could compile all the
> dependencies and libraries in a MacOs system and then building a static
> universal binary that I can distribute. I guess  it should be possible, but
> I am not sure how difficult it might be, and whether all dependencies (qt4
> is huge) can be packaged together.

IMHO this is too complex to commit. Macport is a way to do what you
want, but packages may not be up to date enough. Maybe the easiest and
simplest way for you to do this is to write a script that will
download, compile and install everything.

The script should work like:

sudo all_in_one_script.py

and then wait for jobs to be done. Your script will need to know if a
package was sucessfully installed and then continue or take steps and
say it. For a complex set of dependencies, I recommend you to write
Makefiles.

For instance, in pseudo-code:
if /usr/local/lib/libfoo.dylib doesn't exist
  download foo
  install foo

if python-module foo doesn't exist
  download foo
  python foo/setup.py install

etc

HTH
Mathieu



More information about the Python-list mailing list