Skip to content

Commit

Permalink
Fix parsing of usernames in private pypi URIs
Browse files Browse the repository at this point in the history
- Fixes #2459 and #2389

Signed-off-by: Dan Ryan <dan@danryan.co>
  • Loading branch information
techalchemy committed Jul 1, 2018
1 parent cd47835 commit 1fe556a
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 17 deletions.
1 change: 1 addition & 0 deletions news/2484.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Resolved an issue parsing usernames from private PyPI URIs in ``Pipfiles`` by updating ``requirementslib``.
1 change: 1 addition & 0 deletions news/2484.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Resolved an issue parsing usernames from private PyPI URIs in ``Pipfiles`` by updating ``requirementslib``.
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding=utf-8 -*-
__version__ = "1.0.8"
__version__ = "1.0.9"


from .exceptions import RequirementError
Expand Down
10 changes: 0 additions & 10 deletions pipenv/vendor/requirementslib/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,17 @@ def do_import(module_path, subimport=None, old_path=None):


InstallRequirement = do_import("req.req_install", "InstallRequirement")
parse_requirements = do_import("req.req_file", "parse_requirements")
RequirementSet = do_import("req.req_set", "RequirementSet")
user_cache_dir = do_import("utils.appdirs", "user_cache_dir")
FAVORITE_HASH = do_import("utils.hashes", "FAVORITE_HASH")
is_file_url = do_import("download", "is_file_url")
url_to_path = do_import("download", "url_to_path")
path_to_url = do_import("download", "path_to_url")
is_archive_file = do_import("download", "is_archive_file")
_strip_extras = do_import("req.req_install", "_strip_extras")
PackageFinder = do_import("index", "PackageFinder")
FormatControl = do_import("index", "FormatControl")
Link = do_import("index", "Link")
Wheel = do_import("wheel", "Wheel")
Command = do_import("basecommand", "Command")
cmdoptions = do_import("cmdoptions")
get_installed_distributions = do_import(
"utils.misc", "get_installed_distributions", old_path="utils"
)
is_installable_file = do_import("utils.misc", "is_installable_file", old_path="utils")
is_installable_dir = do_import("utils.misc", "is_installable_dir", old_path="utils")
PyPI = do_import("models.index", "PyPI")
make_abstract_dist = do_import(
"operations.prepare", "make_abstract_dist", old_path="req.req_set"
)
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/models/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import requirements

from first import first
from pkg_resources import RequirementParseError
from six.moves.urllib import parse as urllib_parse

from .baserequirement import BaseRequirement
Expand Down Expand Up @@ -60,6 +59,7 @@ class NamedRequirement(BaseRequirement):

@req.default
def get_requirement(self):
from pkg_resources import RequirementParseError
try:
req = first(requirements.parse("{0}{1}".format(self.name, self.version)))
except RequirementParseError:
Expand Down
7 changes: 4 additions & 3 deletions pipenv/vendor/requirementslib/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import six
from attr import validators
from first import first
from packaging.markers import Marker, InvalidMarker
from packaging.specifiers import SpecifierSet, InvalidSpecifier
from .._compat import Link
from ..utils import SCHEME_LIST, VCS_LIST, is_star

Expand Down Expand Up @@ -84,7 +82,7 @@ def strip_ssh_from_git_uri(uri):


def add_ssh_scheme_to_git_uri(uri):
"""Cleans VCS uris from pipenv.patched.notpip format"""
"""Cleans VCS uris from pip format"""
if isinstance(uri, six.string_types):
# Add scheme for parsing purposes, this is also what pip does
if uri.startswith("git+") and "://" not in uri:
Expand All @@ -94,6 +92,7 @@ def add_ssh_scheme_to_git_uri(uri):

def split_markers_from_line(line):
"""Split markers from a dependency"""
from packaging.markers import Marker, InvalidMarker
if not any(line.startswith(uri_prefix) for uri_prefix in SCHEME_LIST):
marker_sep = ";"
else:
Expand Down Expand Up @@ -125,13 +124,15 @@ def validate_path(instance, attr_, value):


def validate_markers(instance, attr_, value):
from packaging.markers import Marker, InvalidMarker
try:
Marker("{0}{1}".format(attr_.name, value))
except InvalidMarker:
raise ValueError("Invalid Marker {0}{1}".format(attr_, value))


def validate_specifiers(instance, attr_, value):
from packaging.specifiers import SpecifierSet, InvalidSpecifier
if value == "":
return True
try:
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def prepare_pip_source_args(sources, pip_args=None):
# Trust the host if it's not verified.
if not sources[0].get("verify_ssl", True):
pip_args.extend(
["--trusted-host", urlparse(sources[0]["url"]).netloc.split(":")[0]]
["--trusted-host", urlparse(sources[0]["url"]).hostname]
)
# Add additional sources as extra indexes.
if len(sources) > 1:
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ requests==2.19.1
idna==2.7
urllib3==1.23
certifi==2018.4.16
requirementslib==1.0.8
requirementslib==1.0.9
attrs==18.1.0
distlib==0.2.7
packaging==17.1
Expand Down

0 comments on commit 1fe556a

Please sign in to comment.