Skip to content

Commit a510b22

Browse files
committed
Reverts pypa#2493 - Upgrades will again contact the index
1 parent 34e27fe commit a510b22

File tree

3 files changed

+1
-63
lines changed

3 files changed

+1
-63
lines changed

CHANGES.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
* Speed up installing a directory in certain cases by creating a sdist instead
2828
of copying the entire directory. (:pull:`2535`)
2929

30-
* Speed up upgrading by skipping packages which use ``==`` and the specified
31-
version is already installed. (:pull:`2493`)
32-
3330
* Don't follow symlinks when uninstalling files (:pull:`2552`)
3431

3532
* Upgrade the bundled copy of cachecontrol from 0.11.1 to 0.11.2.

pip/req/req_set.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,7 @@ def _check_skip_installed(self, req_to_install, finder):
366366
req_to_install.check_if_exists()
367367
if req_to_install.satisfied_by:
368368
skip_reason = 'satisfied (use --upgrade to upgrade)'
369-
# check that we don't already have an exact version match
370-
# i.e. with at least one strict req operator
371-
strict_req = set(('==', '===')) & set(
372-
op for op, _ in req_to_install.req.specs)
373-
if self.upgrade and (not strict_req or self.force_reinstall):
369+
if self.upgrade:
374370
best_installed = False
375371
# For link based requirements we have to pull the
376372
# tree down and inspect to assess the version #, so

tests/unit/test_req.py

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from mock import Mock, patch, mock_open
99
from pip.exceptions import (
1010
PreviousBuildDirError, InvalidWheelFilename, UnsupportedWheel,
11-
BestVersionAlreadyInstalled,
1211
)
1312
from pip.download import PipSession
1413
from pip.index import PackageFinder
@@ -55,60 +54,6 @@ def test_no_reuse_existing_build_dir(self, data):
5554
finder,
5655
)
5756

58-
@patch(
59-
'pip.req.req_install.pkg_resources.get_distribution',
60-
lambda x: pkg_resources.Distribution(
61-
project_name='Pygments',
62-
version='2.0.2',
63-
location='/python',
64-
)
65-
)
66-
def test_upgrade_no_look_at_pypi_if_exact_version_installed(
67-
self, data):
68-
"""
69-
If an exact version is specified for install, and that version is
70-
already installed, then there is no point going to pypi as no install
71-
is needed.
72-
"""
73-
reqset = self.basic_reqset()
74-
reqset.upgrade = True
75-
req = InstallRequirement.from_line('pygments==2.0.2')
76-
req.url = None
77-
reqset.add_requirement(req)
78-
finder = PackageFinder([data.find_links], [], session=PipSession())
79-
with patch.object(finder, 'find_requirement') as find_requirement:
80-
find_requirement.side_effect = AssertionError(
81-
'find_requirement should NOT be called')
82-
reqset.prepare_files(finder)
83-
84-
@patch(
85-
'pip.req.req_install.pkg_resources.get_distribution',
86-
lambda x: pkg_resources.Distribution(
87-
project_name='Pygments',
88-
version='2.0.2',
89-
location='/python',
90-
)
91-
)
92-
def test_upgrade_look_at_pypi_if_exact_version_installed_and_force(
93-
self, data):
94-
"""
95-
If an exact version is specified for install, and that version is
96-
already installed, but --force-reinstall was provided, we should hit
97-
PyPI.
98-
"""
99-
reqset = self.basic_reqset()
100-
reqset.upgrade = True
101-
reqset.force_reinstall = True
102-
req = InstallRequirement.from_line('pygments==2.0.2')
103-
req.url = None
104-
reqset.add_requirement(req)
105-
finder = PackageFinder([data.find_links], [], session=PipSession())
106-
with patch.object(finder, 'find_requirement') as find_requirement:
107-
find_requirement.side_effect = BestVersionAlreadyInstalled
108-
with pytest.raises(BestVersionAlreadyInstalled):
109-
reqset.prepare_files(finder)
110-
find_requirement.assert_called_once()
111-
11257
def test_environment_marker_extras(self, data):
11358
"""
11459
Test that the environment marker extras are used with

0 commit comments

Comments
 (0)