21
21
from pip ._internal .network .utils import raise_for_status
22
22
from pip ._internal .utils .encoding import auto_decode
23
23
from pip ._internal .utils .typing import MYPY_CHECK_RUNNING
24
- from pip ._internal .utils .urls import get_url_scheme
24
+ from pip ._internal .utils .urls import get_url_scheme , url_to_path
25
25
26
26
if MYPY_CHECK_RUNNING :
27
27
from optparse import Values
@@ -572,16 +572,7 @@ def get_file_content(url, session, comes_from=None):
572
572
'Requirements file {} references URL {}, '
573
573
'which is local' .format (comes_from , url )
574
574
)
575
-
576
- path = url .split (':' , 1 )[1 ]
577
- path = path .replace ('\\ ' , '/' )
578
- match = _url_slash_drive_re .match (path )
579
- if match :
580
- path = match .group (1 ) + ':' + path .split ('|' , 1 )[1 ]
581
- path = urllib_parse .unquote (path )
582
- if path .startswith ('/' ):
583
- path = '/' + path .lstrip ('/' )
584
- url = path
575
+ url = url_to_path (url )
585
576
586
577
try :
587
578
with open (url , 'rb' ) as f :
@@ -591,6 +582,3 @@ def get_file_content(url, session, comes_from=None):
591
582
'Could not open requirements file: {}' .format (exc )
592
583
)
593
584
return url , content
594
-
595
-
596
- _url_slash_drive_re = re .compile (r'/*([a-z])\|' , re .I )
0 commit comments