mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Merge pull request #8830 from uranusjr/env-var-req-file
Replace custom URL parsing with url_to_path()
This commit is contained in:
commit
8663855711
1 changed files with 2 additions and 14 deletions
|
@ -21,7 +21,7 @@ from pip._internal.models.search_scope import SearchScope
|
|||
from pip._internal.network.utils import raise_for_status
|
||||
from pip._internal.utils.encoding import auto_decode
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
from pip._internal.utils.urls import get_url_scheme
|
||||
from pip._internal.utils.urls import get_url_scheme, url_to_path
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from optparse import Values
|
||||
|
@ -572,16 +572,7 @@ def get_file_content(url, session, comes_from=None):
|
|||
'Requirements file {} references URL {}, '
|
||||
'which is local'.format(comes_from, url)
|
||||
)
|
||||
|
||||
path = url.split(':', 1)[1]
|
||||
path = path.replace('\\', '/')
|
||||
match = _url_slash_drive_re.match(path)
|
||||
if match:
|
||||
path = match.group(1) + ':' + path.split('|', 1)[1]
|
||||
path = urllib_parse.unquote(path)
|
||||
if path.startswith('/'):
|
||||
path = '/' + path.lstrip('/')
|
||||
url = path
|
||||
url = url_to_path(url)
|
||||
|
||||
try:
|
||||
with open(url, 'rb') as f:
|
||||
|
@ -591,6 +582,3 @@ def get_file_content(url, session, comes_from=None):
|
|||
'Could not open requirements file: {}'.format(exc)
|
||||
)
|
||||
return url, content
|
||||
|
||||
|
||||
_url_slash_drive_re = re.compile(r'/*([a-z])\|', re.I)
|
||||
|
|
Loading…
Reference in a new issue