File tree 3 files changed +8
-5
lines changed
3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -310,7 +310,7 @@ def get_requirements(
310
310
parsed_req ,
311
311
isolated = options .isolated_mode ,
312
312
)
313
- req_to_add .is_direct = True
313
+ req_to_add .is_direct = False
314
314
requirements .append (req_to_add )
315
315
316
316
for req in args :
Original file line number Diff line number Diff line change @@ -110,9 +110,8 @@ def add_requirement(
110
110
)
111
111
112
112
# This next bit is really a sanity check.
113
- assert install_req .is_direct == (parent_req_name is None ), (
114
- "a direct req shouldn't have a parent and also, "
115
- "a non direct req should have a parent"
113
+ assert not install_req .is_direct or parent_req_name is None , (
114
+ "a direct req shouldn't have a parent"
116
115
)
117
116
118
117
# Unnamed requirements are scanned again and the requirement won't be
@@ -167,6 +166,10 @@ def add_requirement(
167
166
# If we're now installing a constraint, mark the existing
168
167
# object for real installation.
169
168
existing_req .constraint = False
169
+ # If we're now installing a top level requirement, mark the existing
170
+ # object as top level.
171
+ if install_req .is_direct :
172
+ existing_req .is_direct = True
170
173
existing_req .extras = tuple (sorted (
171
174
set (existing_req .extras ) | set (install_req .extras )
172
175
))
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ def _is_upgrade_allowed(self, req):
195
195
return True
196
196
else :
197
197
assert self .upgrade_strategy == "only-if-needed"
198
- return req .is_direct
198
+ return req .is_direct or req . constraint
199
199
200
200
def _set_req_to_reinstall (self , req ):
201
201
# type: (InstallRequirement) -> None
You can’t perform that action at this time.
0 commit comments