At 04:36 PM 10/2/2007 -0600, zooko wrote:
Okay. Attached is a patch that doesn't import pkg_resources and doesn't reload anything. I haven't yet tested it -- I am submitting it only to inform the discussion and get any early feedback from you on whether the very idea is sound.
Okay, I tested this patch on Mac OS X and it worked. First I installed setuptools v0.6c3, then I tried to execute allmydata.org 's "setup.py install". I got the error message saying that it couldn't install a newer version of setuptools (v0.6c7) when an older version was already loaded. Then I applied my patch to ez_setup.py and tried again. This time it installed v0.6c7.
Interesting. But the patch doesn't actually address the real issue with importing; i.e., upgrading setuptools in-place *while setuptools is already running*.
In other words, the test I care about is what happens when you run easy_install on the package, not "setup.py install".
Or, to put it more succinctly:
if 'pkg_resources' in sys.modules or 'setuptools' in sys.modules: # setuptools is installed, but can't be upgraded, so # just version check (using pkg_resources) and exit if # it's not a good enough version. else: # okay to import pkg_resources and check for version, # as long as afterwards we del sys.modules['pkg_resources'] # and re-import it.
So the subprocess and the duplication of code from pkg_resources is unnecessary, since it does not fix the problem when the code is run via easy_install.