mxcl/homebrew — pull request #12758 by samueljohn (2012-06-11 21:20:45+00:00)
Title: python: Do not link against system's python lib!

Fix http://bugs.python.org/issue11445.
This caused various bugs and build failures of certain modules.

- Made the dynamic extensions of sqlite optional, since it can lead to not building sqlite at all.

If you stop after the make step and `otool -L python.exe` (for non framework builds), you may find that it links against the system's python lib. That is bad bad bad.

One symptom is
```
Scanning installed packages
Setuptools installation detected at /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
```

You can also `import sys; print sys.executable`. If you see /System/..../Python

```

Concerning the sqlite dynamic extensions. I have a failure (see below). Python then just warns about and skips sqlite at all. Try `import sqlite3` on your homebrew installed python.

*** WARNING: renaming "_sqlite3" since importing it failed: dlopen(build/lib.macosx-10.7-x86_64-2.7/_sqlite3.so, 2): Symbol not found: _sqlite3_enable_load_extension
Referenced from: /private/tmp/homebrew-python-2.7.3-tgP7/Python-2.7.3/build/lib.macosx-10.7-x86_64-2.7/_sqlite3.so
Expected in: flat namespace
in /private/tmp/homebrew-python-2.7.3-tgP7/Python-2.7.3/build/lib.macosx-10.7-x86_64-2.7/_sqlite3.so

Python build finished, but the necessary bits to build these modules were not found:
_bsddb dl imageop
linuxaudiodev ossaudiodev spwd
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:
_sqlite3

==> make install
make install
```