From 346215d9cf66fa98203fa4cb803f2d60f6798c07 Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Wed, 6 Sep 2006 18:14:34 +0000 Subject: Support setuptools .egg being in current directory when bootstrapping on an offline machine. Output what version/location is conflicting when a newer version of setuptools is requested. --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4051778 --- ez_setup.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ez_setup.py') diff --git a/ez_setup.py b/ez_setup.py index adf4eeec..e58c6f6b 100755 --- a/ez_setup.py +++ b/ez_setup.py @@ -77,13 +77,13 @@ def use_setuptools( try: pkg_resources.require("setuptools>="+version) - except pkg_resources.VersionConflict: + except pkg_resources.VersionConflict, e: # XXX could we install in a subprocess here? 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." - ) % version + " a more recent version first.\n\n(Currently using %r)" + ) % (version, e.args[0]) sys.exit(2) def download_setuptools( @@ -139,15 +139,15 @@ def main(argv, version=DEFAULT_VERSION): try: import setuptools except ImportError: - import tempfile, shutil - tmpdir = tempfile.mkdtemp(prefix="easy_install-") + egg = None try: - egg = download_setuptools(version, to_dir=tmpdir, delay=0) + egg = download_setuptools(version, delay=0) sys.path.insert(0,egg) from setuptools.command.easy_install import main return main(list(argv)+[egg]) # we're done here finally: - shutil.rmtree(tmpdir) + if egg and os.path.exists(egg): + os.unlink(egg) else: if setuptools.__version__ == '0.0.1': # tell the user to uninstall obsolete version -- cgit v1.2.3