Skip to content

Commit

Permalink
Merge branch 'master' into fix-unicode-error
Browse files Browse the repository at this point in the history
  • Loading branch information
techalchemy authored Jun 29, 2018
2 parents a670971 + e8f00b6 commit 35f309f
Show file tree
Hide file tree
Showing 15 changed files with 137 additions and 16 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ black = {version="*", markers="python_version >= '3.6'"}
pytz = "*"
towncrier = {git = "https://github.com/hawkowl/towncrier.git", editable = true, ref = "master"}
parver = "*"
invoke = "*"

[packages]

Expand Down
11 changes: 10 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions news/2453.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed a bug causing requirements input as relative paths to be output as absolute paths or URIs.
Fixed a bug affecting normalization of ``git+git@host`` uris.
1 change: 1 addition & 0 deletions news/2453.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated ``requirementslib`` to version ``1.0.8``
2 changes: 1 addition & 1 deletion pipenv/patched/piptools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ._compat import InstallRequirement

from first import first
from pip._vendor.packaging.specifiers import SpecifierSet, InvalidSpecifier
from pipenv.patched.notpip._vendor.packaging.specifiers import SpecifierSet, InvalidSpecifier
from .click import style


Expand Down
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.7"
__version__ = "1.0.8"


from .exceptions import RequirementError
Expand Down
22 changes: 14 additions & 8 deletions pipenv/vendor/requirementslib/models/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ def get_link_from_line(cls, line):
# This is an URI. We'll need to perform some elaborated parsing.

parsed_url = urllib_parse.urlsplit(fixed_line)
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.
original_scheme = parsed_url.scheme
Expand Down Expand Up @@ -203,7 +208,8 @@ def get_link_from_line(cls, line):
)

if added_ssh_scheme:
uri = strip_ssh_from_git_uri(uri)
original_uri = urllib_parse.urlunsplit(original_url._replace(scheme=original_scheme, fragment=""))
uri = strip_ssh_from_git_uri(original_uri)

# Re-attach VCS prefix to build a Link.
link = Link(
Expand Down Expand Up @@ -389,14 +395,14 @@ def from_pipfile(cls, name, pipfile):

@property
def line_part(self):
if (
if self._uri_scheme and self._uri_scheme == 'path':
seed = self.path or unquote(self.link.url_without_fragment) or self.uri
elif (
(self._uri_scheme and self._uri_scheme == "file")
or (self.link.is_artifact or self.link.is_wheel)
and self.link.url
or ((self.link.is_artifact or self.link.is_wheel)
and self.link.url)
):
seed = unquote(self.link.url_without_fragment) or self.uri
else:
seed = self.formatted_path or unquote(self.link.url_without_fragment) or self.uri
# add egg fragments to remote artifacts (valid urls only)
if not self._has_hashed_name and self.is_remote_artifact:
seed += "#egg={0}".format(self.name)
Expand Down Expand Up @@ -528,8 +534,8 @@ def get_requirement(self):
and "git+ssh://" in self.link.url
and "git+git@" in self.uri
):
req.line = strip_ssh_from_git_uri(req.line)
req.uri = strip_ssh_from_git_uri(req.uri)
req.line = self.uri
req.uri = self.uri
if not req.name:
raise ValueError(
"pipenv requires an #egg fragment for version controlled "
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def strip_ssh_from_git_uri(uri):


def add_ssh_scheme_to_git_uri(uri):
"""Cleans VCS uris from pip format"""
"""Cleans VCS uris from pipenv.patched.notpip 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 Down
2 changes: 1 addition & 1 deletion pipenv/vendor/shellingham/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os


__version__ = '1.0.0.dev1'
__version__ = '1.1.0'


class ShellDetectionFailure(EnvironmentError):
Expand Down
39 changes: 39 additions & 0 deletions pipenv/vendor/shellingham/posix/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import os
import platform

from .._consts import SHELL_NAMES


def _get_process_mapping():
system = platform.system()
if system == 'Linux':
from . import linux as impl
else:
from . import _default as impl
return impl.get_process_mapping()


def get_shell(pid=None, max_depth=6):
"""Get the shell that the supplied pid or os.getpid() is running in.
"""
pid = str(pid or os.getpid())
mapping = _get_process_mapping()
login_shell = os.environ.get('SHELL', '')
for _ in range(max_depth):
try:
proc = mapping[pid]
except KeyError:
break
name = os.path.basename(proc.args[0]).lower()
if name in SHELL_NAMES:
return (name, proc.args[0])
elif proc.args[0].startswith('-'):
# This is the login shell. Use the SHELL environ if possible
# because it provides better information.
if login_shell:
name = login_shell.lower()
else:
name = proc.args[0][1:].lower()
return (os.path.basename(name), name)
pid = proc.ppid # Go up one level.
return None
27 changes: 27 additions & 0 deletions pipenv/vendor/shellingham/posix/_default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import collections
import shlex
import subprocess
import sys


Process = collections.namedtuple('Process', 'args pid ppid')


def get_process_mapping():
"""Try to look up the process tree via the output of `ps`.
"""
output = subprocess.check_output([
'ps', '-ww', '-o', 'pid=', '-o', 'ppid=', '-o', 'args=',
])
if not isinstance(output, str):
output = output.decode(sys.stdout.encoding)
processes = {}
for line in output.split('\n'):
try:
pid, ppid, args = line.strip().split(None, 2)
except ValueError:
continue
processes[pid] = Process(
args=tuple(shlex.split(args)), pid=pid, ppid=ppid,
)
return processes
35 changes: 35 additions & 0 deletions pipenv/vendor/shellingham/posix/linux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
import re

from ._default import Process


STAT_PPID = 3
STAT_TTY = 6


def get_process_mapping():
"""Try to look up the process tree via Linux's /proc
"""
with open('/proc/{0}/stat'.format(os.getpid())) as f:
self_tty = f.read().split()[STAT_TTY]
processes = {}
for pid in os.listdir('/proc'):
if not pid.isdigit():
continue
try:
stat = '/proc/{0}/stat'.format(pid)
cmdline = '/proc/{0}/cmdline'.format(pid)
with open(stat) as fstat, open(cmdline) as fcmdline:
stat = re.findall(r'\(.+\)|\S+', fstat.read())
cmd = fcmdline.read().split('\x00')[:-1]
ppid = stat[STAT_PPID]
tty = stat[STAT_TTY]
if tty == self_tty:
processes[pid] = Process(
args=tuple(cmd), pid=pid, ppid=ppid,
)
except IOError:
# Process has disappeared - just ignore it.
continue
return processes
4 changes: 2 additions & 2 deletions pipenv/vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ requests==2.19.1
idna==2.7
urllib3==1.23
certifi==2018.4.16
requirementslib==1.0.7
requirementslib==1.0.8
attrs==18.1.0
distlib==0.2.7
packaging==17.1
pyparsing==2.2.0
pytoml==0.1.16
requirements-parser==0.2.0
shellingham==1.1.0dev0
shellingham==1.1.0
six==1.11.0
semver==2.8.0
shutilwhich==1.1.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def run(self):
"pipenv.patched.notpip._vendor.distlib": ["t32.exe", "t64.exe", "w32.exe", "w64.exe"],
},
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
setup_requires=['invoke', 'parver'],
install_requires=required,
extras_require={},
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion tasks/vendoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def license_destination(vendor_dir, libname, filename):
normal = vendor_dir / libname
if normal.is_dir():
return normal / filename
lowercase = vendor_dir / libname.lower()
lowercase = vendor_dir / libname.lower().replace('-', '_')
if lowercase.is_dir():
return lowercase / filename
rename_dict = LIBRARY_RENAMES if vendor_dir.name != 'patched' else PATCHED_RENAMES
Expand Down

0 comments on commit 35f309f

Please sign in to comment.