In article <496506cc.30...@strout.net>, Joe Strout <j...@strout.net> wrote:
> I'm (still) trying to make a neatly packaged Python app that works on > both PPC and Intel Macs. All is good except for mysqldb; following the > procedure I've documented at > <http://www.dotancohen.com/howto/python-app-mac.html>, my app bundle > contains an Intel-only binary of the mysqldb library > (libmysqlclient_r.16.dylib). > > This page > (http://developer.apple.com/opensource/buildingopensourceuniversal.html) > at Apple suggests a possible solution: build separate Intel and PPC > binaries, and then combine them with lipo. But of course that's using > Makefiles. MySQLdb instead uses setuptools. > > So: does anyone have a clue how I can convince setuptools to build a PPC > binary (or better yet, a Universal one) on an Intel machine? libmysqlclient is part of the MySQL distribution, i.e. not specific to python, so setuptools isn't the problem here. It looks like there is an open feature request for the MySQL prebuilt packages to be built as universal libraries. The submitter includes a recipe for doing it yourself. I haven't tried it myself, though. <http://bugs.mysql.com/bug.php?id=23701> For python packages with C extensions, distutils, and hence setuptools, does know how to build fat (ppc-32, intel-32) and even universal ({ppc|intel}{32|64}) libraries, depending on how the python distribution itself was built and assuming the proper OSX SDK was installed from an Xcode (Apple Developer Tools) distribution (see /Developer/SDKs/). The recent pythons (2.5/2.6) from python.org are fat and were built with the MacOSX10.4u.sdk. BTW, I just use easy_install (from setuptools) to build and install MySQLdb and, for that matter, nearly all python packages these days. As long as the package uses distutils and doesn't get too fancy with overriding or extending them, they install just fine with easy_install as an egg, even if they don't explicitly use setuptools. In the increasingly rare cases where that don't work, it's usually immediately obvious, i.e. the install fails. Also, eggs don't have to be installed as single zip files: that's just the default. Add --always-unzip or -Z to the easy_install options to install unzipped. To always install unzipped, create a .pydistutils.cfg file in your home directory with an [easy_install] section: [easy_install] zip-ok = 0 So, once you have a universal mysql client library installed, easy_install -Z MySQL-python should be all you need to download, build, and install mysqldb. HTH! -- Ned Deily, n...@acm.org _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig