Commit 48923df7 authored by Jim Fulton's avatar Jim Fulton

More helpful errors when we can't get a distribution in offline mode.

parent f9e37369
...@@ -422,8 +422,13 @@ class Installer: ...@@ -422,8 +422,13 @@ class Installer:
dist, avail = self._satisfied(requirement) dist, avail = self._satisfied(requirement)
if dist is None: if dist is None:
if self._dest is not None: if self._dest is None:
logger.info(*__doing__) raise zc.buildout.UserError(
"We don't have a distribution for %s\n"
"and can't install one in offline (no-install) mode.\n"
% requirement)
logger.info(*__doing__)
# Retrieve the dist: # Retrieve the dist:
if avail is None: if avail is None:
...@@ -616,6 +621,13 @@ class Installer: ...@@ -616,6 +621,13 @@ class Installer:
"Couldn't find a source distribution for %r." "Couldn't find a source distribution for %r."
% str(requirement)) % str(requirement))
if self._dest is None:
raise zc.buildout.UserError(
"We don't have a distribution for %s\n"
"and can't build one in offline (no-install) mode.\n"
% requirement
)
logger.debug('Building %r', spec) logger.debug('Building %r', spec)
tmp = self._download_cache tmp = self._download_cache
......
...@@ -2806,6 +2806,31 @@ def cant_use_install_from_cache_and_offline_together(): ...@@ -2806,6 +2806,31 @@ def cant_use_install_from_cache_and_offline_together():
<BLANKLINE> <BLANKLINE>
""" """
def error_installing_in_offline_mode_if_dont_have_needed_dist():
r"""
>>> import zc.buildout.easy_install
>>> ws = zc.buildout.easy_install.install(
... ['demo==0.2'], None,
... links=[link_server], index=link_server+'index/')
Traceback (most recent call last):
...
UserError: We don't have a distribution for demo==0.2
and can't install one in offline (no-install) mode.
<BLANKLINE>
"""
def error_building_in_offline_mode_if_dont_have_needed_dist():
r"""
>>> zc.buildout.easy_install.build(
... 'extdemo', None,
... {}, links=[link_server], index=link_server+'index/')
Traceback (most recent call last):
...
UserError: We don't have a distribution for extdemo
and can't build one in offline (no-install) mode.
<BLANKLINE>
"""
###################################################################### ######################################################################
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment