Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverts #2493 - Upgrades will again contact the index #2631

Merged
merged 1 commit into from
Apr 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
* Speed up installing a directory in certain cases by creating a sdist instead
of copying the entire directory. (:pull:`2535`)

* Speed up upgrading by skipping packages which use ``==`` and the specified
version is already installed. (:pull:`2493`)

* Don't follow symlinks when uninstalling files (:pull:`2552`)

* Upgrade the bundled copy of cachecontrol from 0.11.1 to 0.11.2.
Expand Down
6 changes: 1 addition & 5 deletions pip/req/req_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,7 @@ def _check_skip_installed(self, req_to_install, finder):
req_to_install.check_if_exists()
if req_to_install.satisfied_by:
skip_reason = 'satisfied (use --upgrade to upgrade)'
# check that we don't already have an exact version match
# i.e. with at least one strict req operator
strict_req = set(('==', '===')) & set(
op for op, _ in req_to_install.req.specs)
if self.upgrade and (not strict_req or self.force_reinstall):
if self.upgrade:
best_installed = False
# For link based requirements we have to pull the
# tree down and inspect to assess the version #, so
Expand Down
55 changes: 0 additions & 55 deletions tests/unit/test_req.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from mock import Mock, patch, mock_open
from pip.exceptions import (
PreviousBuildDirError, InvalidWheelFilename, UnsupportedWheel,
BestVersionAlreadyInstalled,
)
from pip.download import PipSession
from pip.index import PackageFinder
Expand Down Expand Up @@ -55,60 +54,6 @@ def test_no_reuse_existing_build_dir(self, data):
finder,
)

@patch(
'pip.req.req_install.pkg_resources.get_distribution',
lambda x: pkg_resources.Distribution(
project_name='Pygments',
version='2.0.2',
location='/python',
)
)
def test_upgrade_no_look_at_pypi_if_exact_version_installed(
self, data):
"""
If an exact version is specified for install, and that version is
already installed, then there is no point going to pypi as no install
is needed.
"""
reqset = self.basic_reqset()
reqset.upgrade = True
req = InstallRequirement.from_line('pygments==2.0.2')
req.url = None
reqset.add_requirement(req)
finder = PackageFinder([data.find_links], [], session=PipSession())
with patch.object(finder, 'find_requirement') as find_requirement:
find_requirement.side_effect = AssertionError(
'find_requirement should NOT be called')
reqset.prepare_files(finder)

@patch(
'pip.req.req_install.pkg_resources.get_distribution',
lambda x: pkg_resources.Distribution(
project_name='Pygments',
version='2.0.2',
location='/python',
)
)
def test_upgrade_look_at_pypi_if_exact_version_installed_and_force(
self, data):
"""
If an exact version is specified for install, and that version is
already installed, but --force-reinstall was provided, we should hit
PyPI.
"""
reqset = self.basic_reqset()
reqset.upgrade = True
reqset.force_reinstall = True
req = InstallRequirement.from_line('pygments==2.0.2')
req.url = None
reqset.add_requirement(req)
finder = PackageFinder([data.find_links], [], session=PipSession())
with patch.object(finder, 'find_requirement') as find_requirement:
find_requirement.side_effect = BestVersionAlreadyInstalled
with pytest.raises(BestVersionAlreadyInstalled):
reqset.prepare_files(finder)
find_requirement.assert_called_once()

def test_environment_marker_extras(self, data):
"""
Test that the environment marker extras are used with
Expand Down