aboutsummaryrefslogtreecommitdiffstats
path: root/distribute_setup.py
diff options
context:
space:
mode:
authortarek <none@none>2009-10-10 17:14:04 +0200
committertarek <none@none>2009-10-10 17:14:04 +0200
commitb76a5bf6c2386785eef7f3f3123878c22fba8145 (patch)
treec09716ade74c0cf9cbc941fc2853fd53f8185bcb /distribute_setup.py
parent4c9daf7b5983e6aecd04a35e51d1820b3702d4ba (diff)
downloadexternal_python_setuptools-b76a5bf6c2386785eef7f3f3123878c22fba8145.tar.gz
external_python_setuptools-b76a5bf6c2386785eef7f3f3123878c22fba8145.tar.bz2
external_python_setuptools-b76a5bf6c2386785eef7f3f3123878c22fba8145.zip
the parse API needs to return distribute when setuptools is asked
--HG-- branch : distribute extra : rebase_source : 485e5999425fb57f1f0fce496ffc209a9bfe54e8
Diffstat (limited to 'distribute_setup.py')
-rw-r--r--distribute_setup.py52
1 files changed, 30 insertions, 22 deletions
diff --git a/distribute_setup.py b/distribute_setup.py
index bde6c762..b40a9499 100644
--- a/distribute_setup.py
+++ b/distribute_setup.py
@@ -130,29 +130,34 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
was_imported = 'pkg_resources' in sys.modules or \
'setuptools' in sys.modules
try:
- import pkg_resources
- if not hasattr(pkg_resources, '_distribute'):
- fake_setuptools()
- raise ImportError
- except ImportError:
- return _do_download(version, download_base, to_dir, download_delay)
- try:
- pkg_resources.require("distribute>="+version)
- return
- except pkg_resources.VersionConflict, e:
- if was_imported:
- print >>sys.stderr, (
- "The required version of distribute (>=%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 distribute'."
- "\n\n(Currently using %r)") % (version, e.args[0])
- sys.exit(2)
- else:
- del pkg_resources, sys.modules['pkg_resources'] # reload ok
+ try:
+ import pkg_resources
+ if not hasattr(pkg_resources, '_distribute'):
+ fake_setuptools()
+ raise ImportError
+ except ImportError:
return _do_download(version, download_base, to_dir, download_delay)
- except pkg_resources.DistributionNotFound:
- return _do_download(version, download_base, to_dir, download_delay)
-
+ try:
+ pkg_resources.require("distribute>="+version)
+ return
+ except pkg_resources.VersionConflict, e:
+ if was_imported:
+ print >>sys.stderr, (
+ "The required version of distribute (>=%s) is not available,\n"
+ "and can't be installed while this script is running. Please\n"
+ "install a more recent version first, using\n"
+ "'easy_install -U distribute'."
+ "\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(version, download_base, to_dir,
+ download_delay)
+ except pkg_resources.DistributionNotFound:
+ return _do_download(version, download_base, to_dir,
+ download_delay)
+ finally:
+ _create_fake_setuptools_pkg_info(to_dir)
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15):
@@ -260,6 +265,9 @@ def _remove_flat_installation(placeholder):
def _after_install(dist):
log.warn('After install bootstrap.')
placeholder = dist.get_command_obj('install').install_purelib
+ _create_fake_setuptools_pkg_info(placeholder)
+
+def _create_fake_setuptools_pkg_info(placeholder):
if not placeholder or not os.path.exists(placeholder):
log.warn('Could not find the install location')
return