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