Building dtrace-enabled python from sources on Mac OS X

One highlight of Mac OS X Tiger is dtrace. Providers for ruby and python are also available, but only with the “system” interpreters (the one included out of the box). If you install python from http://www.python.org, you can’t use dtrace anymore. Since the code to make dtrace enable python is available on the open source corner of Apple, I thought it would be easy to apply it to pristine sources available on python.org.

Unfortunately, for some strange reasons, Apple only provides changes in the form of ed scripts applied through a Makefile; the changes are not feature specific, you just have a bunch of files for each modified file: dtrace, Apple-specific changes are all put together. I managed to extract the dtrace part of this mess, so that I can apply only dtrace related changes. The goal is to have a python as close as possible to the official binary available on python.org. The patch can be found there.

How to use ?

Untar the python 2.5.2 tarball

Apply the patch

Regenerate the configure scripts by running autoconf

configure as usual, with the additional option –enable-dtrace (the configuration is buggy, and will fail if you don’t enable dtrace, unfortunately)

build python (make, make install).

It time permits, I will post a .dmg. Needless to say, you run this at your own risk.

It would be nice for sure, but I cannot take responsibility for this code; Apple are the one who should do this.

To be included, it would have to be implemented by someone who knows about dtrace internals, and the patch would have to be cleaned up (it does not work when –enable-dtrace is not set up, for example).