Skip to content

Commit

Permalink
Merge pull request #6146 from pradyunsg/vendoring/jan-2019-updates
Browse files Browse the repository at this point in the history
Vendoring updates for Jan 2019
  • Loading branch information
pradyunsg authored Jan 20, 2019
2 parents f982845 + 785ecf4 commit 467ee29
Show file tree
Hide file tree
Showing 84 changed files with 3,048 additions and 1,893 deletions.
1 change: 1 addition & 0 deletions news/certifi.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update certifi to 2018.11.29
1 change: 1 addition & 0 deletions news/colorama.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update colorama to 0.4.1
1 change: 1 addition & 0 deletions news/distlib.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update distlib to 0.2.8
1 change: 1 addition & 0 deletions news/idna.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update idna to 2.8
1 change: 1 addition & 0 deletions news/pep517.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update pep517 to 0.5.0
1 change: 1 addition & 0 deletions news/pkg_resources.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update pkg_resources to 40.6.3 (via setuptools)
1 change: 1 addition & 0 deletions news/pyparsing.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update pyparsing to 2.3.1
1 change: 1 addition & 0 deletions news/pytoml.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update pytoml to 0.1.20
1 change: 1 addition & 0 deletions news/requests.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update requests to 2.21.0
1 change: 1 addition & 0 deletions news/six.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update six to 1.12.0
1 change: 1 addition & 0 deletions news/urllib3.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update urllib3 to 1.24.1
4 changes: 2 additions & 2 deletions src/pip/_vendor/certifi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .core import where, old_where
from .core import where

__version__ = "2018.08.24"
__version__ = "2018.11.29"
272 changes: 242 additions & 30 deletions src/pip/_vendor/certifi/cacert.pem

Large diffs are not rendered by default.

17 changes: 0 additions & 17 deletions src/pip/_vendor/certifi/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
This module returns the installation location of cacert.pem.
"""
import os
import warnings


class DeprecatedBundleWarning(DeprecationWarning):
"""
The weak security bundle is being deprecated. Please bother your service
provider to get them to stop using cross-signed roots.
"""


def where():
Expand All @@ -24,14 +16,5 @@ def where():
return os.path.join(f, 'cacert.pem')


def old_where():
warnings.warn(
"The weak security bundle has been removed. certifi.old_where() is now an alias "
"of certifi.where(). Please update your code to use certifi.where() instead. "
"certifi.old_where() will be removed in 2018.",
DeprecatedBundleWarning
)
return where()

if __name__ == '__main__':
print(where())
1 change: 0 additions & 1 deletion src/pip/_vendor/colorama/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

3 changes: 1 addition & 2 deletions src/pip/_vendor/colorama/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
from .ansi import Fore, Back, Style, Cursor
from .ansitowin32 import AnsiToWin32

__version__ = '0.3.9'

__version__ = '0.4.1'
43 changes: 32 additions & 11 deletions src/pip/_vendor/colorama/ansitowin32.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
winterm = WinTerm()


def is_stream_closed(stream):
return not hasattr(stream, 'closed') or stream.closed


def is_a_tty(stream):
return hasattr(stream, 'isatty') and stream.isatty()


class StreamWrapper(object):
'''
Wraps a stream (such as stdout), acting as a transparent proxy for all
Expand All @@ -36,9 +28,38 @@ def __init__(self, wrapped, converter):
def __getattr__(self, name):
return getattr(self.__wrapped, name)

def __enter__(self, *args, **kwargs):
# special method lookup bypasses __getattr__/__getattribute__, see
# https://stackoverflow.com/questions/12632894/why-doesnt-getattr-work-with-exit
# thus, contextlib magic methods are not proxied via __getattr__
return self.__wrapped.__enter__(*args, **kwargs)

def __exit__(self, *args, **kwargs):
return self.__wrapped.__exit__(*args, **kwargs)

def write(self, text):
self.__convertor.write(text)

def isatty(self):
stream = self.__wrapped
if 'PYCHARM_HOSTED' in os.environ:
if stream is not None and (stream is sys.__stdout__ or stream is sys.__stderr__):
return True
try:
stream_isatty = stream.isatty
except AttributeError:
return False
else:
return stream_isatty()

@property
def closed(self):
stream = self.__wrapped
try:
return stream.closed
except AttributeError:
return True


class AnsiToWin32(object):
'''
Expand Down Expand Up @@ -68,12 +89,12 @@ def __init__(self, wrapped, convert=None, strip=None, autoreset=False):

# should we strip ANSI sequences from our output?
if strip is None:
strip = conversion_supported or (not is_stream_closed(wrapped) and not is_a_tty(wrapped))
strip = conversion_supported or (not self.stream.closed and not self.stream.isatty())
self.strip = strip

# should we should convert ANSI sequences into win32 calls?
if convert is None:
convert = conversion_supported and not is_stream_closed(wrapped) and is_a_tty(wrapped)
convert = conversion_supported and not self.stream.closed and self.stream.isatty()
self.convert = convert

# dict of ansi codes to win32 functions and parameters
Expand Down Expand Up @@ -149,7 +170,7 @@ def write(self, text):
def reset_all(self):
if self.convert:
self.call_win32('m', (0,))
elif not self.strip and not is_stream_closed(self.wrapped):
elif not self.strip and not self.stream.closed:
self.wrapped.write(Style.RESET_ALL)


Expand Down
2 changes: 0 additions & 2 deletions src/pip/_vendor/colorama/initialise.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,3 @@ def wrap_stream(stream, convert, strip, autoreset, wrap):
if wrapper.should_wrap():
stream = wrapper.stream
return stream


18 changes: 7 additions & 11 deletions src/pip/_vendor/colorama/win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,25 @@ def __str__(self):
]
_SetConsoleTitleW.restype = wintypes.BOOL

handles = {
STDOUT: _GetStdHandle(STDOUT),
STDERR: _GetStdHandle(STDERR),
}

def _winapi_test(handle):
csbi = CONSOLE_SCREEN_BUFFER_INFO()
success = _GetConsoleScreenBufferInfo(
handle, byref(csbi))
return bool(success)

def winapi_test():
return any(_winapi_test(h) for h in handles.values())
return any(_winapi_test(h) for h in
(_GetStdHandle(STDOUT), _GetStdHandle(STDERR)))

def GetConsoleScreenBufferInfo(stream_id=STDOUT):
handle = handles[stream_id]
handle = _GetStdHandle(stream_id)
csbi = CONSOLE_SCREEN_BUFFER_INFO()
success = _GetConsoleScreenBufferInfo(
handle, byref(csbi))
return csbi

def SetConsoleTextAttribute(stream_id, attrs):
handle = handles[stream_id]
handle = _GetStdHandle(stream_id)
return _SetConsoleTextAttribute(handle, attrs)

def SetConsoleCursorPosition(stream_id, position, adjust=True):
Expand All @@ -129,11 +125,11 @@ def SetConsoleCursorPosition(stream_id, position, adjust=True):
adjusted_position.Y += sr.Top
adjusted_position.X += sr.Left
# Resume normal processing
handle = handles[stream_id]
handle = _GetStdHandle(stream_id)
return _SetConsoleCursorPosition(handle, adjusted_position)

def FillConsoleOutputCharacter(stream_id, char, length, start):
handle = handles[stream_id]
handle = _GetStdHandle(stream_id)
char = c_char(char.encode())
length = wintypes.DWORD(length)
num_written = wintypes.DWORD(0)
Expand All @@ -144,7 +140,7 @@ def FillConsoleOutputCharacter(stream_id, char, length, start):

def FillConsoleOutputAttribute(stream_id, attr, length, start):
''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )'''
handle = handles[stream_id]
handle = _GetStdHandle(stream_id)
attribute = wintypes.WORD(attr)
length = wintypes.DWORD(length)
num_written = wintypes.DWORD(0)
Expand Down
11 changes: 9 additions & 2 deletions src/pip/_vendor/colorama/winterm.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def set_attrs(self, value):
def reset_all(self, on_stderr=None):
self.set_attrs(self._default)
self.set_console(attrs=self._default)
self._light = 0

def fore(self, fore=None, light=False, on_stderr=False):
if fore is None:
Expand Down Expand Up @@ -122,12 +123,15 @@ def erase_screen(self, mode=0, on_stderr=False):
if mode == 0:
from_coord = csbi.dwCursorPosition
cells_to_erase = cells_in_screen - cells_before_cursor
if mode == 1:
elif mode == 1:
from_coord = win32.COORD(0, 0)
cells_to_erase = cells_before_cursor
elif mode == 2:
from_coord = win32.COORD(0, 0)
cells_to_erase = cells_in_screen
else:
# invalid mode
return
# fill the entire screen with blanks
win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
# now set the buffer's attributes accordingly
Expand All @@ -147,12 +151,15 @@ def erase_line(self, mode=0, on_stderr=False):
if mode == 0:
from_coord = csbi.dwCursorPosition
cells_to_erase = csbi.dwSize.X - csbi.dwCursorPosition.X
if mode == 1:
elif mode == 1:
from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
cells_to_erase = csbi.dwCursorPosition.X
elif mode == 2:
from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
cells_to_erase = csbi.dwSize.X
else:
# invalid mode
return
# fill the entire screen with blanks
win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
# now set the buffer's attributes accordingly
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_vendor/distlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
import logging

__version__ = '0.2.7'
__version__ = '0.2.8'

class DistlibException(Exception):
pass
Expand Down
7 changes: 5 additions & 2 deletions src/pip/_vendor/distlib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
from . import DistlibException, resources
from .compat import StringIO
from .version import get_scheme, UnsupportedVersionError
from .metadata import Metadata, METADATA_FILENAME, WHEEL_METADATA_FILENAME
from .metadata import (Metadata, METADATA_FILENAME, WHEEL_METADATA_FILENAME,
LEGACY_METADATA_FILENAME)
from .util import (parse_requirement, cached_property, parse_name_and_version,
read_exports, write_exports, CSVReader, CSVWriter)

Expand Down Expand Up @@ -132,7 +133,9 @@ def _yield_distributions(self):
if not r or r.path in seen:
continue
if self._include_dist and entry.endswith(DISTINFO_EXT):
possible_filenames = [METADATA_FILENAME, WHEEL_METADATA_FILENAME]
possible_filenames = [METADATA_FILENAME,
WHEEL_METADATA_FILENAME,
LEGACY_METADATA_FILENAME]
for metadata_filename in possible_filenames:
metadata_path = posixpath.join(entry, metadata_filename)
pydist = finder.find(metadata_path)
Expand Down
11 changes: 7 additions & 4 deletions src/pip/_vendor/distlib/locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ def same_project(name1, name2):
if path.endswith('.whl'):
try:
wheel = Wheel(path)
if is_compatible(wheel, self.wheel_tags):
if not is_compatible(wheel, self.wheel_tags):
logger.debug('Wheel not compatible: %s', path)
else:
if project_name is None:
include = True
else:
Expand Down Expand Up @@ -613,6 +615,7 @@ def __init__(self, url, timeout=None, num_workers=10, **kwargs):
# as it is for coordinating our internal threads - the ones created
# in _prepare_threads.
self._gplock = threading.RLock()
self.platform_check = False # See issue #112

def _prepare_threads(self):
"""
Expand Down Expand Up @@ -658,8 +661,8 @@ def _get_project(self, name):
del self.result
return result

platform_dependent = re.compile(r'\b(linux-(i\d86|x86_64|arm\w+)|'
r'win(32|-amd64)|macosx-?\d+)\b', re.I)
platform_dependent = re.compile(r'\b(linux_(i\d86|x86_64|arm\w+)|'
r'win(32|_amd64)|macosx_?\d+)\b', re.I)

def _is_platform_dependent(self, url):
"""
Expand All @@ -677,7 +680,7 @@ def _process_download(self, url):
Note that the return value isn't actually used other than as a boolean
value.
"""
if self._is_platform_dependent(url):
if self.platform_check and self._is_platform_dependent(url):
info = None
else:
info = self.convert_url_to_download_info(url, self.project_name)
Expand Down
9 changes: 6 additions & 3 deletions src/pip/_vendor/distlib/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ class MetadataInvalidError(DistlibException):
_426_MARKERS = ('Private-Version', 'Provides-Extra', 'Obsoleted-By',
'Setup-Requires-Dist', 'Extension')

_566_FIELDS = _426_FIELDS + ('Description-Content-Type',)
# See issue #106: Sometimes 'Requires' occurs wrongly in the metadata. Include
# it in the tuple literal below to allow it (for now)
_566_FIELDS = _426_FIELDS + ('Description-Content-Type', 'Requires')

_566_MARKERS = ('Description-Content-Type',)

Expand Down Expand Up @@ -377,8 +379,8 @@ def read_file(self, fileob):
value = msg[field]
if value is not None and value != 'UNKNOWN':
self.set(field, value)
logger.debug('Attempting to set metadata for %s', self)
self.set_metadata_version()
# logger.debug('Attempting to set metadata for %s', self)
# self.set_metadata_version()

def write(self, filepath, skip_unknown=False):
"""Write the metadata fields to filepath."""
Expand Down Expand Up @@ -648,6 +650,7 @@ def __repr__(self):

METADATA_FILENAME = 'pydist.json'
WHEEL_METADATA_FILENAME = 'metadata.json'
LEGACY_METADATA_FILENAME = 'METADATA'


class Metadata(object):
Expand Down
6 changes: 4 additions & 2 deletions src/pip/_vendor/distlib/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ def get_manifest(self, exename):
def _write_script(self, names, shebang, script_bytes, filenames, ext):
use_launcher = self.add_launchers and self._is_nt
linesep = os.linesep.encode('utf-8')
if not shebang.endswith(linesep):
shebang += linesep
if not use_launcher:
script_bytes = shebang + linesep + script_bytes
script_bytes = shebang + script_bytes
else: # pragma: no cover
if ext == 'py':
launcher = self._get_launcher('t')
Expand All @@ -247,7 +249,7 @@ def _write_script(self, names, shebang, script_bytes, filenames, ext):
with ZipFile(stream, 'w') as zf:
zf.writestr('__main__.py', script_bytes)
zip_data = stream.getvalue()
script_bytes = launcher + shebang + linesep + zip_data
script_bytes = launcher + shebang + zip_data
for name in names:
outname = os.path.join(self.target_dir, name)
if use_launcher: # pragma: no cover
Expand Down
Loading

0 comments on commit 467ee29

Please sign in to comment.