LONG_BIT errors getting you down? If you are building MySQL-Python with the DMG version of Python 2.5.4 then make sure that you have a 32-bit version of MySQL installed or else you will see a variation of this:

(visions)Trinity:envs kelvin$ easy_install -Z mysql_python
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql_python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /var/folders/L4/L4q9U6sBHceoN-EDstAkL++++TI/-Tmp-/easy_install-rniNnX/MySQL-python-1.2.3/egg-dist-tmp-4WCvXJ
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
In file included from /Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:57,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyport.h:761:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:1062:1: warning: "HAVE_WCSCOLL" redefined
In file included from /Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyconfig.h:721:1: warning: this is the location of the previous definition
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:1180:1: warning: "SIZEOF_LONG" redefined
In file included from /Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyconfig.h:811:1: warning: this is the location of the previous definition
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:1189:1: warning: "SIZEOF_PTHREAD_T" redefined
In file included from /Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyconfig.h:820:1: warning: this is the location of the previous definition
error: Setup script exited with error: command 'gcc' failed with exit status 1

If you check, you will find that SIZEOF_LONG is 4 and LONG_BIT is 64 (should be 32) if you are using the 32-bit version of Python 2.5.4 and you have the 64-bit version of MySQL Community Server installed. The pyport.h file will catch it and raise the error — thanks pyport!

The solution for me was to uninstall my 64-bit version of MySQL and install the 32-bit version which was way down on the list of installers. Another solution would be just to use MacPorts to build all your Python bits.

Once the offending version of MySQL was replaced, MySQL-Python installed with only a minor warning. It was immediately usable:

Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) 
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> MySQLdb.__version__
'1.2.3'
>>>

And if you are still running Python 2.5.4 try upgrading to Python 2.6.4