python-imaging/Pillow — pull request #240 by mgorny (2013-05-30 22:17:40+00:00)
Title: Support explicitly disabling features via --disable-* options

This one adds `--disable-foo` options to disable features such as `jpeg`, `tiff` etc. The latter commit adds also matching `--enable-foo` options for convenience. At this point, there's not much magic involved but it can be extended on request.

First of all, I have moved `class feature` to the scope of `pil_build_ext`. This way, it can be accessed outside `build_extension()` and the option parsing methods can mangle it. I have also added iteration support to it, for convenience of option parsing code.

The user options are generated directly from supported features. Each feature gives a single `--disable-foo` and a single `--enable-foo` option. Passing `--disable-foo` causes `feature.foo` to be set to `False` (unlike default `None`), `--enable-foo` is a no-op.

Now, the library detection code has been wrapped in a number of `if feature.foo is None`. That is, the library detection is performed *only* if `feature.foo` hasn't been set already, for example by `--disable-foo` switch.