@@ -134,25 +134,23 @@ def resolve(self, root_reqs, check_supported_wheels):
134
134
135
135
# Check if there is already an installation under the same name,
136
136
# 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.
145
137
installed_dist = self .factory .get_dist_to_uninstall (candidate )
146
138
if installed_dist is None :
139
+ # There is no existing installation -- nothing to uninstall.
147
140
ireq .should_reinstall = False
148
141
elif self .factory .force_reinstall :
142
+ # The --force-reinstall flag is set -- reinstall.
149
143
ireq .should_reinstall = True
150
144
elif installed_dist .parsed_version != candidate .version :
145
+ # The installation is different in version -- reinstall.
151
146
ireq .should_reinstall = True
152
147
elif dist_is_editable (installed_dist ) != candidate .is_editable :
148
+ # The installation is different in editable-ness -- reinstall.
153
149
ireq .should_reinstall = True
154
150
elif candidate .source_link .is_file :
151
+ # The incoming distribution is under file://
155
152
if candidate .source_link .is_wheel :
153
+ # is a local wheel -- do nothing.
156
154
logger .info (
157
155
"%s is already installed with the same version as the "
158
156
"provided wheel. Use --force-reinstall to force an "
@@ -166,6 +164,7 @@ def resolve(self, root_reqs, check_supported_wheels):
166
164
and candidate .source_link .ext != ".zip"
167
165
)
168
166
if looks_like_sdist :
167
+ # is a local sdist -- show a deprecation warning!
169
168
reason = (
170
169
"Source distribution is being reinstalled despite an "
171
170
"installed package having the same name and version as "
@@ -178,6 +177,8 @@ def resolve(self, root_reqs, check_supported_wheels):
178
177
gone_in = "21.1" ,
179
178
issue = 8711 ,
180
179
)
180
+
181
+ # is a local sdist or path -- reinstall
181
182
ireq .should_reinstall = True
182
183
else :
183
184
continue
0 commit comments