[Pythonmac-SIG] How to get setuptools to build a Universal Binary?

Joe Strout joe at strout.net
Thu Jan 8 15:53:23 CET 2009


Ned Deily wrote:

> Note, I haven't tested this so YMMV.  If you can get away with using a 
> 5.0 client, that should work.  But if you just fix-up the 5.1 libs with 
> a couple of copies that should work, too.   Go to the directory of your 
> mysql installation, probably something like:
> 
> cd /usr/local/mysql-5.1.30-osx10.4-universal
> 
> Then:
> 
> cd lib
> ls -l *.dylib
> file *.dylib
> 
> sudo sh
> 
> cp -p libmysqlclient.16.0.0.dylib libmysqlclient.16.dylib
> cp -p libmysqlclient.16.0.0.dylib libmysqlclient.dylib
> 
> cp -p libmysqlclient_r.16.0.0.dylib libmysqlclient_r.16.dylib
> cp -p libmysqlclient_r.16.0.0.dylib libmysqlclient_r.dylib

Hmm.  This doesn't appear to have worked, but it's failing in an odd way 
that I don't understand.  Here's what I did:

1. The above copying, vebatim.
2. In the MySQL-python-1.2.2 source directory:
    2a. sudo python setup.py clean
    2b. sudo python setup.py build
    2c. sudo python setup.py install
3. In my project directory:
    3a. rm -rf build/*
    3b. rm -rf dist/*
    3c. python setup.py py2app
4. Ran the resulting app on ANY machine -- even the one I just built it 
on -- and it fails with:

...File "IADB.pyc", line 12, in <module>
  ImportError: No module named MySQLdb

Note that the program still works fine when I run it on the command line 
(with "python eTownCentral.py"), and when I enter python and try "import 
MySQLdb" that works too, so I haven't broken MySQLdb completely.  It's 
just not included in my app bundle now.  Within Frameworks, I see only 
libwx_macud-2.8.0.dylib and Python.framework; no libmysqlclient at all. 
  And in lib-dynload, there is no longer a _mysqldb.so.

The weird thing is, my python source and setup.py have not changed.  So 
why is py2app suddenly failing to realize that it should include MySQLdb?

Thanks,
- Joe



More information about the Pythonmac-SIG mailing list