11
11
import logging
12
12
import os
13
13
import re
14
- from typing import Any , Dict , Optional , Set , Tuple , Union
14
+ from typing import Dict , List , Optional , Set , Tuple , Union
15
15
16
16
from pip ._vendor .packaging .markers import Marker
17
17
from pip ._vendor .packaging .requirements import InvalidRequirement , Requirement
@@ -201,9 +201,11 @@ def parse_req_from_editable(editable_req: str) -> RequirementParts:
201
201
def install_req_from_editable (
202
202
editable_req : str ,
203
203
comes_from : Optional [Union [InstallRequirement , str ]] = None ,
204
+ * ,
204
205
use_pep517 : Optional [bool ] = None ,
205
206
isolated : bool = False ,
206
- options : Optional [Dict [str , Any ]] = None ,
207
+ global_options : Optional [List [str ]] = None ,
208
+ hash_options : Optional [Dict [str , List [str ]]] = None ,
207
209
constraint : bool = False ,
208
210
user_supplied : bool = False ,
209
211
permit_editable_wheels : bool = False ,
@@ -222,8 +224,8 @@ def install_req_from_editable(
222
224
constraint = constraint ,
223
225
use_pep517 = use_pep517 ,
224
226
isolated = isolated ,
225
- global_options = options . get ( " global_options" , []) if options else [] ,
226
- hash_options = options . get ( "hashes" , {}) if options else {} ,
227
+ global_options = global_options ,
228
+ hash_options = hash_options ,
227
229
config_settings = config_settings ,
228
230
extras = parts .extras ,
229
231
)
@@ -375,9 +377,11 @@ def _parse_req_string(req_as_string: str) -> Requirement:
375
377
def install_req_from_line (
376
378
name : str ,
377
379
comes_from : Optional [Union [str , InstallRequirement ]] = None ,
380
+ * ,
378
381
use_pep517 : Optional [bool ] = None ,
379
382
isolated : bool = False ,
380
- options : Optional [Dict [str , Any ]] = None ,
383
+ global_options : Optional [List [str ]] = None ,
384
+ hash_options : Optional [Dict [str , List [str ]]] = None ,
381
385
constraint : bool = False ,
382
386
line_source : Optional [str ] = None ,
383
387
user_supplied : bool = False ,
@@ -398,8 +402,8 @@ def install_req_from_line(
398
402
markers = parts .markers ,
399
403
use_pep517 = use_pep517 ,
400
404
isolated = isolated ,
401
- global_options = options . get ( " global_options" , []) if options else [] ,
402
- hash_options = options . get ( "hashes" , {}) if options else {} ,
405
+ global_options = global_options ,
406
+ hash_options = hash_options ,
403
407
config_settings = config_settings ,
404
408
constraint = constraint ,
405
409
extras = parts .extras ,
@@ -471,11 +475,18 @@ def install_req_from_parsed_requirement(
471
475
comes_from = parsed_req .comes_from ,
472
476
use_pep517 = use_pep517 ,
473
477
isolated = isolated ,
474
- options = parsed_req .options ,
478
+ global_options = (
479
+ parsed_req .options .get ("global_options" , [])
480
+ if parsed_req .options
481
+ else []
482
+ ),
483
+ hash_options = (
484
+ parsed_req .options .get ("hashes" , {}) if parsed_req .options else {}
485
+ ),
475
486
constraint = parsed_req .constraint ,
476
487
line_source = parsed_req .line_source ,
477
488
user_supplied = user_supplied ,
478
- config_settings = config_settings ,
489
+ config_settings = config_settings , # TODO get this from parsed_req.options?
479
490
)
480
491
return req
481
492
0 commit comments