[Distutils] How to upgrade distribute with distribute_setupif necessary?

anatoly techtonik techtonik at gmail.com
Sat Nov 3 17:49:34 CET 2012


On Tue, Oct 23, 2012 at 12:40 AM, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> anatoly techtonik <techtonik <at> gmail.com> writes:
>
>>
>> On Mon, Oct 22, 2012 at 11:00 PM, Daniel Holth <dholth <at> gmail.com> wrote:
>> > You should just invoke a recent virtualenv on the environment.
>>
>> It is for system-wide installation of Sphinx. I need it as a user tool.
>> --
>
> Download the latest version of distribute_setup.py from
>
> http://python-distribute.org/distribute_setup.py
>
> Then run it (using sudo if necessary). It should download the latest distribute
> version (0.6.30) and install it in your environment. You might want to try it in
> a virtualenv first.

That doesn't answer the question: What is the proper way to modify the following
setup.py to make distribute_setup.py upgrade itself if necessary?

try:
    from setuptools import setup, find_packages
except ImportError:
    import distribute_setup
    distribute_setup.use_setuptools()
    from setuptools import setup, find_packages

The problem here that setuptools import works correctly, but it is not
the required version. I want to check if this setuptools is distribute, if its
version is correct, and if not - rerun already patched `distribute_setup` to
update.

It is desired to have automatic upgrade, not waiting for new magic
bugs and wasting time troubleshooting what's going on. See Python 3.2
chapter in this report for a background
https://bitbucket.org/birkenfeld/sphinx/issue/1022/doesnt-install-with-python-32-and-33-on


More information about the Distutils-SIG mailing list