[Distutils] Bootstrap use_setuptools() in ez_setup.py failure

Pherl Liu liujisi at google.com
Thu Jan 20 06:55:07 CET 2011


Hmm, I think it now only delete pkg_resource when
pkg_resrouces.VersionConflict is caught, but the fix should be also delete
pkg_resources when pkg_resources.DistributionNotFound is caught. The code
looks like:

   try:
        pkg_resources.require("setuptools>="+version); return
    except pkg_resources.VersionConflict, e:
        if was_imported:
            print >>sys.stderr, (
            "The required version of setuptools (>=%s) is not available,
and\n"
            "can't be installed while this script is running. Please
install\n"
            " a more recent version first, using 'easy_install -U
setuptools'."
            "\n\n(Currently using %r)"
            ) % (version, e.args[0])
            sys.exit(2)
        else:
            del pkg_resources, sys.modules['pkg_resources']    # reload ok
            return do_download()
    except pkg_resources.DistributionNotFound:
        *del pkg_resources, sys.modules['pkg_resources']*  #  added this
line.
        return do_download()


On Thu, Jan 20, 2011 at 12:53 AM, P.J. Eby <pje at telecommunity.com> wrote:

> At 03:40 PM 1/19/2011 +0800, Pherl Liu wrote:
>
>> Well..
>>
>> I think I can fix this by editing ez_setup.py
>>
>> adding oneline after pkg_resources.DistributionNotFound is caught, in
>> use_setuptools()
>>
>> del pkg_resources, sys.modules['pkg_resources']
>>
>> Not sure if this makes sense.
>>
>
> That's already in current versions of ez_setup.py; 0.6c9 is several years
> old.  I'd suggest you use the svn externals to keep it up-to-date.  See:
>
>
> http://peak.telecommunity.com/DevCenter/setuptools#managing-multiple-projects
>
> for details.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20110120/faabd3f9/attachment.html>


More information about the Distutils-SIG mailing list