Skip to content

Commit 9f4c540

Browse files
committed
🎨 Breakup and move comment
Signed-off-by: Pradyun Gedam <[email protected]>
1 parent 8b4652e commit 9f4c540

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/pip/_internal/resolution/resolvelib/resolver.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,25 +134,23 @@ def resolve(self, root_reqs, check_supported_wheels):
134134

135135
# Check if there is already an installation under the same name,
136136
# and set a flag for later stages to uninstall it, if needed.
137-
#
138-
# * There is no existing installation. Nothing to uninstall.
139-
# * The --force-reinstall flag is set. Always reinstall.
140-
# * The installation is different in version or editable-ness, so
141-
# we need to uninstall it to install the new distribution.
142-
# * The candidate is a local wheel. Do nothing.
143-
# * The candidate is a local sdist. Print a deprecation warning.
144-
# * The candidate is a local path. Always reinstall.
145137
installed_dist = self.factory.get_dist_to_uninstall(candidate)
146138
if installed_dist is None:
139+
# There is no existing installation -- nothing to uninstall.
147140
ireq.should_reinstall = False
148141
elif self.factory.force_reinstall:
142+
# The --force-reinstall flag is set -- reinstall.
149143
ireq.should_reinstall = True
150144
elif installed_dist.parsed_version != candidate.version:
145+
# The installation is different in version -- reinstall.
151146
ireq.should_reinstall = True
152147
elif dist_is_editable(installed_dist) != candidate.is_editable:
148+
# The installation is different in editable-ness -- reinstall.
153149
ireq.should_reinstall = True
154150
elif candidate.source_link.is_file:
151+
# The incoming distribution is under file://
155152
if candidate.source_link.is_wheel:
153+
# is a local wheel -- do nothing.
156154
logger.info(
157155
"%s is already installed with the same version as the "
158156
"provided wheel. Use --force-reinstall to force an "
@@ -166,6 +164,7 @@ def resolve(self, root_reqs, check_supported_wheels):
166164
and candidate.source_link.ext != ".zip"
167165
)
168166
if looks_like_sdist:
167+
# is a local sdist -- show a deprecation warning!
169168
reason = (
170169
"Source distribution is being reinstalled despite an "
171170
"installed package having the same name and version as "
@@ -178,6 +177,8 @@ def resolve(self, root_reqs, check_supported_wheels):
178177
gone_in="21.1",
179178
issue=8711,
180179
)
180+
181+
# is a local sdist or path -- reinstall
181182
ireq.should_reinstall = True
182183
else:
183184
continue

0 commit comments

Comments
 (0)