MySQLdb 1.2.3C1 - Python 2.6.5 - Linux x86 (Fedora) - MySQL 5,0
I'm trying to test Python 2.6 and MySQLdb without running as "root". I've built Python 2.6 from source, and am running it without "installing" it, as a test.
That works fine. When I try to build MySQLdb, by running "python26 setup.py build", the "setup.py" file tries to import "setuptools", which, unlike "distutils", isn't a standard package. So that won't work. There's no "egg" file involved here; I'm building from the gzipped tar file. So "setuptools", the "egg" system,
shouldn't be involved at all.
Running "ez_setup.py build" produces "The following error occurred while trying to add or remove files in the
installation directory:
[Errno 2] No such file or directory: '/usr/local/lib/python2.6/site-packages/test-easy-install-22015.write-test' "
Here, the MySQLdb setup, doing a "build", not an "install", is trying to install "setuptools" AS ROOT. That's bad; a "build" should never tamper with
system files. I'm not running as "root", so there's no damage; the build just fails.
In general, using "setuptools" creates headaches for users. "setuptools" has too many built-in locations of where files should be, and it frequently guesses wrong. Using the standard "distutils" is preferable. "setuptools" should never be used in non-"egg" files.
I tried this change on MySQLdb's "setup.py":
diff setup.py setup-nodistutils.py
5c5
< from setuptools import setup, Extension
The build then runs. The resulting MySQLdb runs under the uninstalled Python and connects to the database properly.
There's no need for "setuptools" here at all. It just gets in the way. This unnecessary dependency should be removed.