New py2app fork: pluginbuilder

Python 3.2 brought with it a couple of changes that broke py2app. It had been a while since I wanted to work on that project, but because the main command is distutils-based, I lacked the motivation to properly learn how its code works. I saw Python 3.2's breakage as a good opportunity to get my feet wet, since as far as I can tell, there's very few of us using the "plugin" feature of py2app, and I'm pretty sure to be alone to, additionally, use Python 3. Nobody was going to fix it except me.

py2app being a distutils-based command brings needless complexity to the code. Unless you know how distutils commands work, you don't really know what's the main entry point or where options are stored. Because (1) fixing py2app involved code changes that I wasn't sure were backward compatible, (2) I'm one of a very few users of the "plugin" feature, and (3) distutils was increasingly getting on my nerves, I said "screw that, I'm tearing that package apart", and that's what I did. It felt rather good :)

What's different? Apart from not supporting application building like py2app does and not being based on distutils' command, there's a few things that are different in pluginbuilder.

  1. Invocation is simpler. Instead of having to go through distutils' setup() to build your plugin, you can call build_plugin() directly or use the pluginbuilder command line script.
  2. The "main" binary file is compiled on your machine rather than being prebuilt. py2app ships with prebuilt binaries for all possible architectures combinations, but it never worked on my machine so I had to rebuild them anyway. A benefit from this is that it simplifies the code in "main.m" because dynamic symbol bindings aren't necessary anymore and Python.h can be included directly.
  3. Collected source files aren't zipped. That's actually a drawback, but it was part of the fix for Python 3.2's breakage, which didn't like encodings-related modules to be in a zip file. I'm not sure yet, but I think that feature could come back if I use the newly introduced Py_SetPath function.

Roadmap: For the first release of pluginbuilder, I didn't modify a lot of code. I merely, step by step, refactored the thing until I could get rid of distutils' command. The code is not as clean as it should be and I'll probably slowly start to actually change the code. I'm also contemplating the removal of modulegraph's dependency (I think the additional complexity brought by this mechanism is not worth the convenience of not having to manually specify dependencies), but that's something I haven't thought through yet.

That's all I have to say about this. Here's some links: