[Distutils] SQLObject and Python 2.2
Phillip J. Eby
pje at telecommunity.com
Wed Aug 24 18:35:09 CEST 2005
At 11:05 AM 8/24/2005 -0500, Ian Bicking wrote:
>Phillip J. Eby wrote:
>>At 10:16 AM 8/24/2005 -0500, Ian Bicking wrote:
>>>Oleg Broytmann wrote:
>>>>Hello, Ian. Have we stopped supporting Python 2.2?
>>>>$ python2.2 setup.py install -O2
>>>>Traceback (most recent call last):
>>>> File "setup.py", line 2, in ?
>>>> File "ez_setup/__init__.py", line 66, in use_setuptools
>>>> egg = download_setuptools(version, download_base, to_dir)
>>>> File "ez_setup/__init__.py", line 100, in download_setuptools
>>>> from distutils import log
>>>>ImportError: cannot import name log
>>>No, not really (though I admit I don't test it frequently). ez_setup
>>>comes from setuptools -- Phillip, should 2.2 be supported? SQLObject is
>>>bringing ez_setup in as an external.
>>Sorry; I've moved on from 2.2, even if Google hasn't. If you want to
>>provide backward compatibility patches, I'll certainly look at them, but
>>I can't guarantee not to accidentally break them in some future release.
>Well, it's broken in a couple ways. One is that a setuptools egg for
>py2.2 doesn't exist.
Yep. Trying to build one should tell you what else is missing - like
zipimport, for example. Just for the heck of it, I tried building a
setuptools egg for 2.2 and quickly discovered why I decided to go with 2.3
only for setuptools: zipimport isn't in Python 2.2, and can't be backported
because it's based on PEP 302. And pkg_resources is PEP 302-based right
down to the bone.
But even if you comment out the zipimport stuff, and stub out the PEP 302
hooks so they only do filesystem stuff, you then need to include the 2.3
'sets' module, because Requirement objects use ImmutableSet internally to
handle comparisons. And comment out 'classifiers' in setup.py because
that's not in 2.3. And all the 'imp.acquire_lock()' calls in
pkg_resources. And add "from __future__ import generators" to every
freaking module. And then you need to backport distutils.log. And then
fix up the dict.fromkeys() calls and the extended list slicing.
And that's as far as I got in 15 minutes or so, with bdist_egg only getting
far enough along to try to write the toplevel.txt file and failing on a
dict.fromkeys() call. Still, in some ways that's pretty good, since to get
that far it had to boot pkg_resources and load several entry point groups,
albeit all from one unpacked egg.
When you get far enough to successfully build a Python 2.2 egg for
setuptools, it'd be interesting to take a look at your patch. You'll also
need to add code to ez_setup to *extract* the egg, because Python 2.2 can't
import from a zipfile. This also means that setuptools and EasyInstall
running under Python 2.2 should always mark all eggs as not zip safe, and
always extract them.
More information about the Distutils-SIG