Merge branch 'master' into appveyor_update

This commit is contained in:
Dan Ryan
2018-06-28 20:50:37 -04:00
committed by GitHub
16 changed files with 148 additions and 19 deletions
+1
View File
@@ -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]
Generated
+10 -1
View File
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "ee9e8c04f9a6b7ad4cdaa7db728b51b9fef04b6cad9f012edd230a6241b43f92"
"sha256": "0599ae763bc5f1eaa30bd414c1495dc10fdfd3b5b0c109515d71322c8668d7e1"
},
"pipfile-spec": 6,
"requires": {},
@@ -185,6 +185,15 @@
],
"version": "==17.5.0"
},
"invoke": {
"hashes": [
"sha256:21274204515dca62206470b088bbcf9d41ffda82b3715b90e01d71b7a4681921",
"sha256:4a4cc031db311cbfb3fdd8ec93a06c892533c27b931f4be14b24c97cd042b14e",
"sha256:621b6564f992c37166e16090d7e7cccb3b922e03a58e980dfa5e543a931b652f"
],
"index": "pypi",
"version": "==1.0.0"
},
"itsdangerous": {
"hashes": [
"sha256:cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519"
+2
View File
@@ -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
View File
@@ -0,0 +1 @@
Updated ``requirementslib`` to version ``1.0.8``
+12 -4
View File
@@ -9,6 +9,13 @@ from .core import project, system_which, find_python_in_path, python_version
from .pep508checker import lookup
def print_utf(line):
try:
print(line)
except UnicodeEncodeError:
print(line.encode('utf-8'))
def main():
print('<details><summary>$ python -m pipenv.help output</summary>')
print('')
@@ -45,13 +52,13 @@ def main():
for key in os.environ:
print(' - `{0}`'.format(key))
print('')
print(u'Pipenvspecific environment variables:')
print_utf(u'Pipenvspecific environment variables:')
print('')
for key in os.environ:
if key.startswith('PIPENV'):
print(' - `{0}`: `{1}`'.format(key, os.environ[key]))
print('')
print(u'Debugspecific environment variables:')
print_utf(u'Debugspecific environment variables:')
print('')
for key in ('PATH', 'SHELL', 'EDITOR', 'LANG', 'PWD', 'VIRTUAL_ENV'):
if key in os.environ:
@@ -61,7 +68,7 @@ def main():
print('---------------------------')
print('')
if project.pipfile_exists:
print(
print_utf(
u'Contents of `Pipfile` ({0!r}):'.format(project.pipfile_location)
)
print('')
@@ -72,7 +79,7 @@ def main():
print('')
if project.lockfile_exists:
print('')
print(
print_utf(
u'Contents of `Pipfile.lock` ({0!r}):'.format(
project.lockfile_location
)
@@ -87,3 +94,4 @@ def main():
if __name__ == '__main__':
main()
+1 -1
View File
@@ -11,7 +11,7 @@ from contextlib import contextmanager
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
+1 -1
View File
@@ -1,5 +1,5 @@
# -*- coding=utf-8 -*-
__version__ = "1.0.7"
__version__ = "1.0.8"
from .exceptions import RequirementError
+14 -8
View File
@@ -173,6 +173,11 @@ class FileRequirement(BaseRequirement):
# 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
@@ -203,7 +208,8 @@ class FileRequirement(BaseRequirement):
)
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(
@@ -389,14 +395,14 @@ class FileRequirement(BaseRequirement):
@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)
@@ -528,8 +534,8 @@ class VCSRequirement(FileRequirement):
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 "
+1 -1
View File
@@ -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:
+1 -1
View File
@@ -2,7 +2,7 @@ import importlib
import os
__version__ = '1.0.0.dev1'
__version__ = '1.1.0'
class ShellDetectionFailure(EnvironmentError):
+39
View File
@@ -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
View File
@@ -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
View File
@@ -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
+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.7
requirementslib==1.0.8
attrs==18.1.0
distlib==0.2.7
packaging==17.1
+1
View File
@@ -123,6 +123,7 @@ setup(
"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,
+1 -1
View File
@@ -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