Merge pull request #2617 from pypa/update-requirementslib

Update requirementslib
This commit is contained in:
Dan Ryan
2018-07-21 14:43:15 -04:00
committed by GitHub
6 changed files with 34 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
Update requirementslib to fix a bug which could raise an ``UnboundLocalError`` when parsing malformed VCS URIs.
+1
View File
@@ -0,0 +1 @@
Update requirementslib to fix a bug which could raise an ``UnboundLocalError`` when parsing malformed VCS URIs.
+1 -1
View File
@@ -1,5 +1,5 @@
# -*- coding=utf-8 -*-
__version__ = "1.0.10"
__version__ = "1.0.11"
from .exceptions import RequirementError
+1 -1
View File
@@ -176,10 +176,10 @@ class FileRequirement(BaseRequirement):
# This is an URI. We'll need to perform some elaborated parsing.
parsed_url = urllib_parse.urlsplit(fixed_line)
original_url = parsed_url._replace()
if added_ssh_scheme and ':' in parsed_url.netloc:
original_netloc, original_path_start = parsed_url.netloc.rsplit(':', 1)
uri_path = '/{0}{1}'.format(original_path_start, parsed_url.path)
original_url = parsed_url
parsed_url = original_url._replace(netloc=original_netloc, path=uri_path)
# Split the VCS part out if needed.
+29 -3
View File
@@ -60,6 +60,19 @@ def is_vcs(pipfile_entry):
return False
def check_for_unc_path(path):
""" Checks to see if a pathlib `Path` object is a unc path or not"""
if (
os.name == "nt"
and len(path.drive) > 2
and not path.drive[0].isalpha()
and path.drive[1] != ":"
):
return True
else:
return False
def get_converted_relative_path(path, relative_to=os.curdir):
"""Convert `path` to be relative.
@@ -69,13 +82,26 @@ def get_converted_relative_path(path, relative_to=os.curdir):
This performs additional conversion to ensure the result is of POSIX form,
and starts with `./`, or is precisely `.`.
"""
start = Path(relative_to)
start_path = Path(relative_to)
try:
start = start.resolve()
start = start_path.resolve()
except OSError:
start = start.absolute()
start = start_path.absolute()
# check if there is a drive letter or mount point
# if it is a mountpoint use the original absolute path
# instead of the unc path
if check_for_unc_path(start):
start = start_path.absolute()
path = start.joinpath(path).relative_to(start)
# check and see if the path that was passed into the function is a UNC path
# and raise value error if it is not.
if check_for_unc_path(path):
raise ValueError("The path argument does not currently accept UNC paths")
relpath_s = posixpath.normpath(path.as_posix())
if not (relpath_s == "." or relpath_s.startswith("./")):
relpath_s = posixpath.join(".", relpath_s)
+1 -1
View File
@@ -27,7 +27,7 @@ requests==2.19.1
idna==2.7
urllib3==1.23
certifi==2018.4.16
requirementslib==1.0.10
requirementslib==1.0.11
attrs==18.1.0
distlib==0.2.7
packaging==17.1