提交 f887aa6a 编写于 作者: C Carl Meyer

Fix upgrade of VCS requirement with otherwise nonexistent egg. Fixes #486.

上级 417fae49
......@@ -13,6 +13,9 @@ Beta and final releases planned for the second half of 2012.
master (unreleased)
-------------------
* Fixed issue #486 - fix upgrade from VCS url of otherwise nonexistent egg.
Thanks aknapp for the report.
* Fixed issue #427 - clearer error message on a malformed VCS url. Thanks
Thomas Fenzl.
......
......@@ -7,7 +7,8 @@ import pkg_resources
import tempfile
from pip.locations import bin_py, running_under_virtualenv
from pip.exceptions import (InstallationError, UninstallationError,
BestVersionAlreadyInstalled)
BestVersionAlreadyInstalled,
DistributionNotFound)
from pip.vcs import vcs
from pip.log import logger
from pip.util import display_path, rmtree
......@@ -910,6 +911,7 @@ class RequirementSet(object):
req_to_install = reqs.pop(0)
install = True
best_installed = False
not_found = None
if not self.ignore_installed and not req_to_install.editable:
req_to_install.check_if_exists()
if req_to_install.satisfied_by:
......@@ -921,6 +923,8 @@ class RequirementSet(object):
except BestVersionAlreadyInstalled:
best_installed = True
install = False
except DistributionNotFound:
not_found = sys.exc_info()[1]
else:
# Avoid the need to call find_requirement again
req_to_install.url = url.url
......@@ -975,6 +979,8 @@ class RequirementSet(object):
if not os.path.exists(os.path.join(location, 'setup.py')):
## FIXME: this won't upgrade when there's an existing package unpacked in `location`
if req_to_install.url is None:
if not_found:
raise not_found
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
else:
## FIXME: should req_to_install.url already be a link?
......
......@@ -3,6 +3,7 @@ from os.path import join
from tests.test_pip import (here, reset_env, run_pip, assert_all_changes,
write_file, pyversion, _create_test_package,
_change_test_package_version)
from tests.local_repos import local_checkout
def test_no_upgrade_unless_requested():
......@@ -190,3 +191,12 @@ def test_install_with_ignoreinstalled_requested():
assert result.files_created, 'pip install -I did not install'
assert env.site_packages/'INITools-0.1-py%s.egg-info' % pyversion not in result.files_created
def test_upgrade_vcs_req_with_no_dists_found():
"""It can upgrade a VCS requirement that has no distributions otherwise."""
reset_env()
req = "%s#egg=pip-test-package" % local_checkout(
"git+http://github.com/pypa/pip-test-package.git")
run_pip("install", req)
result = run_pip("install", "-U", req)
assert not result.returncode
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册