@@ -150,9 +150,6 @@ async def get_action_kwargs(argv: list[str]) -> tuple[typing.Optional[str], dict
150
150
# Process requirements files
151
151
for req_file in args .requirements or []:
152
152
context = RequirementsContext ()
153
- # If we have a CLI index URL, set it as the initial context
154
- if args .index_url :
155
- context .index_url = args .index_url
156
153
157
154
if not Path (req_file ).exists ():
158
155
warn (f"piplite could not find requirements file { req_file } " )
@@ -168,16 +165,18 @@ async def get_action_kwargs(argv: list[str]) -> tuple[typing.Optional[str], dict
168
165
all_requirements .extend (context .requirements )
169
166
170
167
if all_requirements :
171
- # Group requirements by index URL
172
- by_index = {}
173
- for req , idx in all_requirements :
174
- by_index .setdefault (idx , []).append (req )
175
-
176
168
kwargs ["requirements" ] = []
177
- for idx , reqs in by_index .items ():
169
+ used_index = None
170
+
171
+ for req , idx in all_requirements :
178
172
if idx :
179
- kwargs ["index_urls" ] = idx
180
- kwargs ["requirements" ].extend (reqs )
173
+ used_index = idx
174
+ kwargs ["requirements" ].append (req )
175
+
176
+ # Set the index URL if one was found (either passed to the CLI or
177
+ # passed within the requirements file)
178
+ if used_index :
179
+ kwargs ["index_urls" ] = used_index
181
180
182
181
if args .pre :
183
182
kwargs ["pre" ] = True
0 commit comments