[Python-modules-commits] [python-pip] 01/08: Import python-pip_8.0.3.orig.tar.gz
Barry Warsaw
barry at moszumanska.debian.org
Thu Feb 25 22:09:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
barry pushed a commit to branch master
in repository python-pip.
commit cf2f0c79999bcec7ace285b22565952637cebbd5
Author: Barry Warsaw <barry at python.org>
Date: Thu Feb 25 16:14:56 2016 -0500
Import python-pip_8.0.3.orig.tar.gz
---
CHANGES.txt | 19 ++++++++++++++
PKG-INFO | 2 +-
pip.egg-info/PKG-INFO | 2 +-
pip.egg-info/requires.txt | 1 +
pip/__init__.py | 6 +----
pip/_vendor/distlib/__init__.py | 4 +--
pip/_vendor/distlib/compat.py | 2 +-
pip/_vendor/distlib/database.py | 21 ++++++++++-----
pip/_vendor/distlib/locators.py | 16 ++++++------
pip/_vendor/distlib/metadata.py | 16 +++++++++---
pip/_vendor/distlib/resources.py | 2 +-
pip/_vendor/distlib/scripts.py | 55 +++++++++++++++++++++++++++-------------
pip/_vendor/distlib/util.py | 40 +++++++++++++++++++----------
pip/_vendor/distlib/version.py | 6 ++---
pip/_vendor/distlib/wheel.py | 2 +-
pip/_vendor/vendor.txt | 2 +-
pip/index.py | 4 +--
pip/req/req_install.py | 6 ++++-
pip/utils/__init__.py | 55 ++++++++++++++++++++++++++++++----------
pip/utils/deprecation.py | 32 +++++++++++------------
pip/utils/ui.py | 5 ++++
pip/wheel.py | 2 +-
setup.cfg | 4 +--
setup.py | 3 ++-
24 files changed, 205 insertions(+), 102 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index cb00519..8816460 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,22 @@
+**8.0.3 (2016-02-25)**
+
+* Make ``install --quiet`` really quiet. See :issue:`3418`.
+
+* Fix a bug when removing packages in python 3: disable INI-style parsing of the
+ entry_point.txt file to allow entry point names with colons (:pull:`3434`)
+
+* Normalize generated script files path in RECORD files. (:pull:`3448`)
+
+* Fix bug introduced in 8.0.0 where subcommand output was not shown,
+ even when the user specified ``-v`` / ``--verbose``. :issue:`3486`.
+
+* Enable python -W with respect to PipDeprecationWarning. (:pull:`3455`)
+
+* Upgrade distlib to 0.2.2 (fix :issue:`3467`):
+
+ * Improved support for Jython when quoting executables in output scripts.
+
+
**8.0.2 (2016-01-21)**
* Stop attempting to trust the system CA trust store because it's extremely
diff --git a/PKG-INFO b/PKG-INFO
index ecc2142..0abff38 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pip
-Version: 8.0.2
+Version: 8.0.3
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
diff --git a/pip.egg-info/PKG-INFO b/pip.egg-info/PKG-INFO
index ecc2142..0abff38 100644
--- a/pip.egg-info/PKG-INFO
+++ b/pip.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pip
-Version: 8.0.2
+Version: 8.0.3
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
diff --git a/pip.egg-info/requires.txt b/pip.egg-info/requires.txt
index 6413f1c..26b980b 100644
--- a/pip.egg-info/requires.txt
+++ b/pip.egg-info/requires.txt
@@ -4,3 +4,4 @@ pytest
virtualenv>=1.10
scripttest>=1.3
mock
+pretend
diff --git a/pip/__init__.py b/pip/__init__.py
index 0603ca1..6be4612 100755
--- a/pip/__init__.py
+++ b/pip/__init__.py
@@ -30,7 +30,7 @@ import pip.cmdoptions
cmdoptions = pip.cmdoptions
# The version as used in the setup.py and the docs conf.py
-__version__ = "8.0.2"
+__version__ = "8.0.3"
logger = logging.getLogger(__name__)
@@ -197,10 +197,6 @@ def main(args=None):
if args is None:
args = sys.argv[1:]
- # Enable our Deprecation Warnings
- for deprecation_warning in deprecation.DEPRECATIONS:
- warnings.simplefilter("default", deprecation_warning)
-
# Configure our deprecation warnings to be sent through loggers
deprecation.install_warning_logger()
diff --git a/pip/_vendor/distlib/__init__.py b/pip/_vendor/distlib/__init__.py
index 20a4e0c..c2421d8 100644
--- a/pip/_vendor/distlib/__init__.py
+++ b/pip/_vendor/distlib/__init__.py
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2012-2014 Vinay Sajip.
+# Copyright (C) 2012-2016 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import logging
-__version__ = '0.2.1'
+__version__ = '0.2.2'
class DistlibException(Exception):
pass
diff --git a/pip/_vendor/distlib/compat.py b/pip/_vendor/distlib/compat.py
index 5ed8643..069ec77 100644
--- a/pip/_vendor/distlib/compat.py
+++ b/pip/_vendor/distlib/compat.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2013-2014 Vinay Sajip.
+# Copyright (C) 2013-2016 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
diff --git a/pip/_vendor/distlib/database.py b/pip/_vendor/distlib/database.py
index 29c62fb..7bc1914 100644
--- a/pip/_vendor/distlib/database.py
+++ b/pip/_vendor/distlib/database.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2012-2014 The Python Software Foundation.
+# Copyright (C) 2012-2016 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""PEP 376 implementation."""
@@ -20,7 +20,7 @@ import zipimport
from . import DistlibException, resources
from .compat import StringIO
from .version import get_scheme, UnsupportedVersionError
-from .metadata import Metadata, METADATA_FILENAME
+from .metadata import Metadata, METADATA_FILENAME, WHEEL_METADATA_FILENAME
from .util import (parse_requirement, cached_property, parse_name_and_version,
read_exports, write_exports, CSVReader, CSVWriter)
@@ -132,13 +132,17 @@ class DistributionPath(object):
if not r or r.path in seen:
continue
if self._include_dist and entry.endswith(DISTINFO_EXT):
- metadata_path = posixpath.join(entry, METADATA_FILENAME)
- pydist = finder.find(metadata_path)
- if not pydist:
+ possible_filenames = [METADATA_FILENAME, WHEEL_METADATA_FILENAME]
+ for metadata_filename in possible_filenames:
+ metadata_path = posixpath.join(entry, metadata_filename)
+ pydist = finder.find(metadata_path)
+ if pydist:
+ break
+ else:
continue
- metadata = Metadata(fileobj=pydist.as_stream(),
- scheme='legacy')
+ with contextlib.closing(pydist.as_stream()) as stream:
+ metadata = Metadata(fileobj=stream, scheme='legacy')
logger.debug('Found %s', r.path)
seen.add(r.path)
yield new_dist_class(r.path, metadata=metadata,
@@ -532,6 +536,9 @@ class InstalledDistribution(BaseInstalledDistribution):
metadata = env._cache.path[path].metadata
elif metadata is None:
r = finder.find(METADATA_FILENAME)
+ # Temporary - for Wheel 0.23 support
+ if r is None:
+ r = finder.find(WHEEL_METADATA_FILENAME)
# Temporary - for legacy support
if r is None:
r = finder.find('METADATA')
diff --git a/pip/_vendor/distlib/locators.py b/pip/_vendor/distlib/locators.py
index ef584d5..1e14638 100644
--- a/pip/_vendor/distlib/locators.py
+++ b/pip/_vendor/distlib/locators.py
@@ -14,7 +14,7 @@ import posixpath
import re
try:
import threading
-except ImportError:
+except ImportError: # pragma: no cover
import dummy_threading as threading
import zlib
@@ -36,7 +36,7 @@ logger = logging.getLogger(__name__)
HASHER_HASH = re.compile('^(\w+)=([a-f0-9]+)')
CHARSET = re.compile(r';\s*charset\s*=\s*(.*)\s*$', re.I)
HTML_CONTENT_TYPE = re.compile('text/html|application/x(ht)?ml')
-DEFAULT_INDEX = 'http://python.org/pypi'
+DEFAULT_INDEX = 'https://pypi.python.org/pypi'
def get_all_distribution_names(url=None):
"""
@@ -354,7 +354,7 @@ class Locator(object):
else:
logger.debug('skipping pre-release '
'version %s of %s', k, matcher.name)
- except Exception:
+ except Exception: # pragma: no cover
logger.warning('error matching %s with %r', matcher, k)
pass # slist.append(k)
if len(slist) > 1:
@@ -763,18 +763,18 @@ class SimpleScrapingLocator(Locator):
encoding = m.group(1)
try:
data = data.decode(encoding)
- except UnicodeError:
+ except UnicodeError: # pragma: no cover
data = data.decode('latin-1') # fallback
result = Page(data, final_url)
self._page_cache[final_url] = result
except HTTPError as e:
if e.code != 404:
logger.exception('Fetch failed: %s: %s', url, e)
- except URLError as e:
+ except URLError as e: # pragma: no cover
logger.exception('Fetch failed: %s: %s', url, e)
with self._lock:
self._bad_hosts.add(host)
- except Exception as e:
+ except Exception as e: # pragma: no cover
logger.exception('Fetch failed: %s: %s', url, e)
finally:
self._page_cache[url] = result # even if None (failure)
@@ -812,7 +812,7 @@ class DirectoryLocator(Locator):
self.recursive = kwargs.pop('recursive', True)
super(DirectoryLocator, self).__init__(**kwargs)
path = os.path.abspath(path)
- if not os.path.isdir(path):
+ if not os.path.isdir(path): # pragma: no cover
raise DistlibException('Not a directory: %r' % path)
self.base_dir = path
@@ -1083,7 +1083,7 @@ class DependencyFinder(object):
"""
try:
matcher = self.scheme.matcher(reqt)
- except UnsupportedVersionError:
+ except UnsupportedVersionError: # pragma: no cover
# XXX compat-mode if cannot read the version
name = reqt.split()[0]
matcher = self.scheme.matcher(name)
diff --git a/pip/_vendor/distlib/metadata.py b/pip/_vendor/distlib/metadata.py
index 55bd75f..71525dd 100644
--- a/pip/_vendor/distlib/metadata.py
+++ b/pip/_vendor/distlib/metadata.py
@@ -50,7 +50,8 @@ PKG_INFO_ENCODING = 'utf-8'
# to 1.2 once PEP 345 is supported everywhere
PKG_INFO_PREFERRED_VERSION = '1.1'
-_LINE_PREFIX = re.compile('\n \|')
+_LINE_PREFIX_1_2 = re.compile('\n \|')
+_LINE_PREFIX_PRE_1_2 = re.compile('\n ')
_241_FIELDS = ('Metadata-Version', 'Name', 'Version', 'Platform',
'Summary', 'Description',
'Keywords', 'Home-page', 'Author', 'Author-email',
@@ -295,7 +296,10 @@ class LegacyMetadata(object):
return 'UNKNOWN'
def _remove_line_prefix(self, value):
- return _LINE_PREFIX.sub('\n', value)
+ if self.metadata_version in ('1.0', '1.1'):
+ return _LINE_PREFIX_PRE_1_2.sub('\n', value)
+ else:
+ return _LINE_PREFIX_1_2.sub('\n', value)
def __getattr__(self, name):
if name in _ATTR2FIELD:
@@ -374,7 +378,10 @@ class LegacyMetadata(object):
continue
if field not in _LISTFIELDS:
if field == 'Description':
- values = values.replace('\n', '\n |')
+ if self.metadata_version in ('1.0', '1.1'):
+ values = values.replace('\n', '\n ')
+ else:
+ values = values.replace('\n', '\n |')
values = [values]
if field in _LISTTUPLEFIELDS:
@@ -548,7 +555,7 @@ class LegacyMetadata(object):
('description', 'Description'),
('keywords', 'Keywords'),
('platform', 'Platform'),
- ('classifier', 'Classifier'),
+ ('classifiers', 'Classifier'),
('download_url', 'Download-URL'),
)
@@ -617,6 +624,7 @@ class LegacyMetadata(object):
METADATA_FILENAME = 'pydist.json'
+WHEEL_METADATA_FILENAME = 'metadata.json'
class Metadata(object):
diff --git a/pip/_vendor/distlib/resources.py b/pip/_vendor/distlib/resources.py
index c8e2f82..9dd8ca0 100644
--- a/pip/_vendor/distlib/resources.py
+++ b/pip/_vendor/distlib/resources.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2013 Vinay Sajip.
+# Copyright (C) 2013-2016 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
diff --git a/pip/_vendor/distlib/scripts.py b/pip/_vendor/distlib/scripts.py
index 2aa6eb7..c9996d5 100644
--- a/pip/_vendor/distlib/scripts.py
+++ b/pip/_vendor/distlib/scripts.py
@@ -63,6 +63,22 @@ if __name__ == '__main__':
'''
+def _enquote_executable(executable):
+ if ' ' in executable:
+ # make sure we quote only the executable in case of env
+ # for example /usr/bin/env "/dir with spaces/bin/jython"
+ # instead of "/usr/bin/env /dir with spaces/bin/jython"
+ # otherwise whole
+ if executable.startswith('/usr/bin/env '):
+ env, _executable = executable.split(' ', 1)
+ if ' ' in _executable and not _executable.startswith('"'):
+ executable = '%s "%s"' % (env, _executable)
+ else:
+ if not executable.startswith('"'):
+ executable = '"%s"' % executable
+ return executable
+
+
class ScriptMaker(object):
"""
A class to copy or create scripts from source scripts or callable
@@ -85,8 +101,11 @@ class ScriptMaker(object):
self.variants = set(('', 'X.Y'))
self._fileop = fileop or FileOperator(dry_run)
+ self._is_nt = os.name == 'nt' or (
+ os.name == 'java' and os._name == 'nt')
+
def _get_alternate_executable(self, executable, options):
- if options.get('gui', False) and os.name == 'nt':
+ if options.get('gui', False) and self._is_nt: # pragma: no cover
dn, fn = os.path.split(executable)
fn = fn.replace('python', 'pythonw')
executable = os.path.join(dn, fn)
@@ -124,10 +143,10 @@ class ScriptMaker(object):
enquote = False # assume this will be taken care of
elif not sysconfig.is_python_build():
executable = get_executable()
- elif in_venv():
+ elif in_venv(): # pragma: no cover
executable = os.path.join(sysconfig.get_path('scripts'),
'python%s' % sysconfig.get_config_var('EXE'))
- else:
+ else: # pragma: no cover
executable = os.path.join(
sysconfig.get_config_var('BINDIR'),
'python%s%s' % (sysconfig.get_config_var('VERSION'),
@@ -141,14 +160,14 @@ class ScriptMaker(object):
executable = os.path.normcase(executable)
# If the user didn't specify an executable, it may be necessary to
# cater for executable paths with spaces (not uncommon on Windows)
- if enquote and ' ' in executable:
- executable = '"%s"' % executable
+ if enquote:
+ executable = _enquote_executable(executable)
# Issue #51: don't use fsencode, since we later try to
# check that the shebang is decodable using utf-8.
executable = executable.encode('utf-8')
# in case of IronPython, play safe and enable frames support
if (sys.platform == 'cli' and '-X:Frames' not in post_interp
- and '-X:FullFrames' not in post_interp):
+ and '-X:FullFrames' not in post_interp): # pragma: no cover
post_interp += b' -X:Frames'
shebang = b'#!' + executable + post_interp + b'\n'
# Python parser starts to read a script using UTF-8 until
@@ -158,7 +177,7 @@ class ScriptMaker(object):
# UTF-8.
try:
shebang.decode('utf-8')
- except UnicodeDecodeError:
+ except UnicodeDecodeError: # pragma: no cover
raise ValueError(
'The shebang (%r) is not decodable from utf-8' % shebang)
# If the script is encoded to a custom encoding (use a
@@ -167,7 +186,7 @@ class ScriptMaker(object):
if encoding != 'utf-8':
try:
shebang.decode(encoding)
- except UnicodeDecodeError:
+ except UnicodeDecodeError: # pragma: no cover
raise ValueError(
'The shebang (%r) is not decodable '
'from the script encoding (%r)' % (shebang, encoding))
@@ -184,11 +203,11 @@ class ScriptMaker(object):
return self.manifest % base
def _write_script(self, names, shebang, script_bytes, filenames, ext):
- use_launcher = self.add_launchers and os.name == 'nt'
+ use_launcher = self.add_launchers and self._is_nt
linesep = os.linesep.encode('utf-8')
if not use_launcher:
script_bytes = shebang + linesep + script_bytes
- else:
+ else: # pragma: no cover
if ext == 'py':
launcher = self._get_launcher('t')
else:
@@ -200,7 +219,7 @@ class ScriptMaker(object):
script_bytes = launcher + shebang + linesep + zip_data
for name in names:
outname = os.path.join(self.target_dir, name)
- if use_launcher:
+ if use_launcher: # pragma: no cover
n, e = os.path.splitext(outname)
if e.startswith('.py'):
outname = n
@@ -223,7 +242,7 @@ class ScriptMaker(object):
except Exception:
pass # still in use - ignore error
else:
- if os.name == 'nt' and not outname.endswith('.' + ext):
+ if self._is_nt and not outname.endswith('.' + ext): # pragma: no cover
outname = '%s.%s' % (outname, ext)
if os.path.exists(outname) and not self.clobber:
logger.warning('Skipping existing file %s', outname)
@@ -269,15 +288,13 @@ class ScriptMaker(object):
# script.
try:
f = open(script, 'rb')
- except IOError:
+ except IOError: # pragma: no cover
if not self.dry_run:
raise
f = None
else:
- encoding, lines = detect_encoding(f.readline)
- f.seek(0)
first_line = f.readline()
- if not first_line:
+ if not first_line: # pragma: no cover
logger.warning('%s: %s is an empty file (skipping)',
self.get_command_name(), script)
return
@@ -298,8 +315,10 @@ class ScriptMaker(object):
logger.info('copying and adjusting %s -> %s', script,
self.target_dir)
if not self._fileop.dry_run:
+ encoding, lines = detect_encoding(f.readline)
+ f.seek(0)
shebang = self._get_shebang(encoding, post_interp)
- if b'pythonw' in first_line:
+ if b'pythonw' in first_line: # pragma: no cover
ext = 'pyw'
else:
ext = 'py'
@@ -316,7 +335,7 @@ class ScriptMaker(object):
def dry_run(self, value):
self._fileop.dry_run = value
- if os.name == 'nt':
+ if os.name == 'nt' or (os.name == 'java' and os._name == 'nt'): # pragma: no cover
# Executable launcher support.
# Launchers are from https://bitbucket.org/vinay.sajip/simple_launcher/
diff --git a/pip/_vendor/distlib/util.py b/pip/_vendor/distlib/util.py
index 7555c1e..1aa4cdd 100644
--- a/pip/_vendor/distlib/util.py
+++ b/pip/_vendor/distlib/util.py
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2012-2014 The Python Software Foundation.
+# Copyright (C) 2012-2016 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
@@ -20,6 +20,8 @@ import subprocess
import sys
import tarfile
import tempfile
+import textwrap
+
try:
import threading
except ImportError:
@@ -28,8 +30,8 @@ import time
from . import DistlibException
from .compat import (string_types, text_type, shutil, raw_input, StringIO,
- cache_from_source, urlopen, httplib, xmlrpclib, splittype,
- HTTPHandler, HTTPSHandler as BaseHTTPSHandler,
+ cache_from_source, urlopen, urljoin, httplib, xmlrpclib,
+ splittype, HTTPHandler, HTTPSHandler as BaseHTTPSHandler,
BaseConfigurator, valid_ident, Container, configparser,
URLError, match_hostname, CertificateError, ZipFile)
@@ -199,8 +201,8 @@ def read_exports(stream):
data = stream.read()
stream = StringIO(data)
try:
- data = json.load(stream)
- result = data['extensions']['python.exports']['exports']
+ jdata = json.load(stream)
+ result = jdata['extensions']['python.exports']['exports']
for group, entries in result.items():
for k, v in entries.items():
s = '%s = %s' % (k, v)
@@ -210,11 +212,22 @@ def read_exports(stream):
return result
except Exception:
stream.seek(0, 0)
+
+ def read_stream(cp, stream):
+ if hasattr(cp, 'read_file'):
+ cp.read_file(stream)
+ else:
+ cp.readfp(stream)
+
cp = configparser.ConfigParser()
- if hasattr(cp, 'read_file'):
- cp.read_file(stream)
- else:
- cp.readfp(stream)
+ try:
+ read_stream(cp, stream)
+ except configparser.MissingSectionHeaderError:
+ stream.close()
+ data = textwrap.dedent(data)
+ stream = StringIO(data)
+ read_stream(cp, stream)
+
result = {}
for key in cp.sections():
result[key] = entries = {}
@@ -758,16 +771,17 @@ def _get_external_data(url):
logger.exception('Failed to get external data for %s: %s', url, e)
return result
+_external_data_base_url = 'https://www.red-dove.com/pypi/projects/'
def get_project_data(name):
- url = ('https://www.red-dove.com/pypi/projects/'
- '%s/%s/project.json' % (name[0].upper(), name))
+ url = '%s/%s/project.json' % (name[0].upper(), name)
+ url = urljoin(_external_data_base_url, url)
result = _get_external_data(url)
return result
def get_package_data(name, version):
- url = ('https://www.red-dove.com/pypi/projects/'
- '%s/%s/package-%s.json' % (name[0].upper(), name, version))
+ url = '%s/%s/package-%s.json' % (name[0].upper(), name, version)
+ url = urljoin(_external_data_base_url, url)
return _get_external_data(url)
diff --git a/pip/_vendor/distlib/version.py b/pip/_vendor/distlib/version.py
index d9c438a..d3dcfa0 100644
--- a/pip/_vendor/distlib/version.py
+++ b/pip/_vendor/distlib/version.py
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2012-2014 The Python Software Foundation.
+# Copyright (C) 2012-2016 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""
-Implementation of a flexible versioning scheme providing support for PEP-386,
-distribute-compatible and semantic versioning.
+Implementation of a flexible versioning scheme providing support for PEP-440,
+setuptools-compatible and semantic versioning.
"""
import logging
diff --git a/pip/_vendor/distlib/wheel.py b/pip/_vendor/distlib/wheel.py
index a537681..a08fb54 100644
--- a/pip/_vendor/distlib/wheel.py
+++ b/pip/_vendor/distlib/wheel.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2013-2014 Vinay Sajip.
+# Copyright (C) 2013-2016 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
diff --git a/pip/_vendor/vendor.txt b/pip/_vendor/vendor.txt
index 72231f7..1804aed 100644
--- a/pip/_vendor/vendor.txt
+++ b/pip/_vendor/vendor.txt
@@ -1,4 +1,4 @@
-distlib==0.2.1
+distlib==0.2.2
html5lib==1.0b8
six==1.10.0
colorama==0.3.6
diff --git a/pip/index.py b/pip/index.py
index 18c8fc6..69b7e0e 100644
--- a/pip/index.py
+++ b/pip/index.py
@@ -19,7 +19,7 @@ from pip.compat import ipaddress
from pip.utils import (
cached_property, splitext, normalize_path,
ARCHIVE_EXTENSIONS, SUPPORTED_EXTENSIONS, canonicalize_name)
-from pip.utils.deprecation import RemovedInPip9Warning
+from pip.utils.deprecation import RemovedInPip9Warning, RemovedInPip10Warning
from pip.utils.logging import indent_log
from pip.exceptions import (
DistributionNotFound, BestVersionAlreadyInstalled, InvalidWheelFilename,
@@ -1019,7 +1019,7 @@ def fmt_ctl_no_use_wheel(fmt_ctl):
fmt_ctl_no_binary(fmt_ctl)
warnings.warn(
'--no-use-wheel is deprecated and will be removed in the future. '
- ' Please use --no-binary :all: instead.', DeprecationWarning,
+ ' Please use --no-binary :all: instead.', RemovedInPip10Warning,
stacklevel=2)
diff --git a/pip/req/req_install.py b/pip/req/req_install.py
index 3b48431..b3076e5 100644
--- a/pip/req/req_install.py
+++ b/pip/req/req_install.py
@@ -727,7 +727,11 @@ class InstallRequirement(object):
# find console_scripts
if dist.has_metadata('entry_points.txt'):
- config = configparser.SafeConfigParser()
+ if six.PY2:
+ options = {}
+ else:
+ options = {"delimiters": ('=', )}
+ config = configparser.SafeConfigParser(**options)
config.readfp(
FakeFile(dist.get_metadata_lines('entry_points.txt'))
)
diff --git a/pip/utils/__init__.py b/pip/utils/__init__.py
index 4768ecb..368d539 100644
--- a/pip/utils/__init__.py
+++ b/pip/utils/__init__.py
@@ -635,6 +635,31 @@ def call_subprocess(cmd, show_stdout=True, cwd=None,
on_returncode='raise',
command_level=std_logging.DEBUG, command_desc=None,
extra_environ=None, spinner=None):
+ # This function's handling of subprocess output is confusing and I
+ # previously broke it terribly, so as penance I will write a long comment
+ # explaining things.
+ #
+ # The obvious thing that affects output is the show_stdout=
+ # kwarg. show_stdout=True means, let the subprocess write directly to our
+ # stdout. Even though it is nominally the default, it is almost never used
+ # inside pip (and should not be used in new code without a very good
+ # reason); as of 2016-02-22 it is only used in a few places inside the VCS
+ # wrapper code. Ideally we should get rid of it entirely, because it
+ # creates a lot of complexity here for a rarely used feature.
+ #
+ # Most places in pip set show_stdout=False. What this means is:
+ # - We connect the child stdout to a pipe, which we read.
+ # - By default, we hide the output but show a spinner -- unless the
+ # subprocess exits with an error, in which case we show the output.
+ # - If the --verbose option was passed (= loglevel is DEBUG), then we show
+ # the output unconditionally. (But in this case we don't want to show
+ # the output a second time if it turns out that there was an error.)
+ #
+ # stderr is always merged with stdout (even if show_stdout=True).
+ if show_stdout:
+ stdout = None
+ else:
+ stdout = subprocess.PIPE
if command_desc is None:
cmd_parts = []
for part in cmd:
@@ -648,24 +673,28 @@ def call_subprocess(cmd, show_stdout=True, cwd=None,
env.update(extra_environ)
try:
proc = subprocess.Popen(
- cmd, stderr=subprocess.STDOUT, stdin=None, stdout=subprocess.PIPE,
+ cmd, stderr=subprocess.STDOUT, stdin=None, stdout=stdout,
cwd=cwd, env=env)
except Exception as exc:
logger.critical(
"Error %s while executing command %s", exc, command_desc,
)
raise
- all_output = []
- while True:
- line = console_to_str(proc.stdout.readline())
- if not line:
- break
- line = line.rstrip()
- all_output.append(line + '\n')
- if show_stdout:
- logger.debug(line)
- if spinner is not None:
- spinner.spin()
+ if stdout is not None:
+ all_output = []
+ while True:
+ line = console_to_str(proc.stdout.readline())
+ if not line:
+ break
+ line = line.rstrip()
+ all_output.append(line + '\n')
+ if logger.getEffectiveLevel() <= std_logging.DEBUG:
+ # Show the line immediately
+ logger.debug(line)
+ else:
+ # Update the spinner
+ if spinner is not None:
+ spinner.spin()
proc.wait()
if spinner is not None:
if proc.returncode:
@@ -674,7 +703,7 @@ def call_subprocess(cmd, show_stdout=True, cwd=None,
spinner.finish("done")
if proc.returncode:
if on_returncode == 'raise':
- if all_output:
+ if logger.getEffectiveLevel() > std_logging.DEBUG:
logger.info(
'Complete output from command %s:', command_desc,
)
diff --git a/pip/utils/deprecation.py b/pip/utils/deprecation.py
index d336cee..2fb1d1e 100644
--- a/pip/utils/deprecation.py
+++ b/pip/utils/deprecation.py
@@ -11,23 +11,20 @@ class PipDeprecationWarning(Warning):
pass
-class RemovedInPip9Warning(PipDeprecationWarning, DeprecationWarning):
+class Pending(object):
pass
-class RemovedInPip10Warning(PipDeprecationWarning, PendingDeprecationWarning):
+class RemovedInPip9Warning(PipDeprecationWarning):
pass
-class Python26DeprecationWarning(
- PipDeprecationWarning, PendingDeprecationWarning
-):
+class RemovedInPip10Warning(PipDeprecationWarning, Pending):
pass
-DEPRECATIONS = [
- RemovedInPip9Warning, RemovedInPip10Warning, Python26DeprecationWarning
-]
+class Python26DeprecationWarning(PipDeprecationWarning, Pending):
+ pass
# Warnings <-> Logging Integration
@@ -53,15 +50,15 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
# want it to appear as if someone typed this entire message out.
log_message = "DEPRECATION: %s" % message
- # Things that are DeprecationWarnings will be removed in the very
- # next version of pip. We want these to be more obvious so we
- # use the ERROR logging level while the PendingDeprecationWarnings
- # are still have at least 2 versions to go until they are removed
- # so they can just be warnings.
- if issubclass(category, DeprecationWarning):
- logger.error(log_message)
- else:
+ # PipDeprecationWarnings that are Pending still have at least 2
+ # versions to go until they are removed so they can just be
+ # warnings. Otherwise, they will be removed in the very next
+ # version of pip. We want these to be more obvious so we use the
+ # ERROR logging level.
+ if issubclass(category, Pending):
logger.warning(log_message)
+ else:
+ logger.error(log_message)
else:
_warnings_showwarning(
message, category, filename, lineno, file, line,
@@ -69,6 +66,9 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
def install_warning_logger():
+ # Enable our Deprecation Warnings
+ warnings.simplefilter("default", PipDeprecationWarning, append=True)
+
global _warnings_showwarning
if _warnings_showwarning is None:
diff --git a/pip/utils/ui.py b/pip/utils/ui.py
index 973bc64..bba73e3 100644
--- a/pip/utils/ui.py
+++ b/pip/utils/ui.py
@@ -219,6 +219,11 @@ def hidden_cursor(file):
# even via colorama. So don't even try.
if WINDOWS:
yield
+ # We don't want to clutter the output with control characters if we're
+ # writing to a file, or if the user is running with --quiet.
+ # See https://github.com/pypa/pip/issues/3418
+ elif not file.isatty() or logger.getEffectiveLevel() > logging.INFO:
+ yield
else:
file.write(HIDE_CURSOR)
try:
diff --git a/pip/wheel.py b/pip/wheel.py
index ffda773..350a717 100644
--- a/pip/wheel.py
+++ b/pip/wheel.py
@@ -519,7 +519,7 @@ if __name__ == '__main__':
writer.writerow(row)
for f in generated:
h, l = rehash(f)
- writer.writerow((f, h, l))
+ writer.writerow((normpath(f, lib_dir), h, l))
for f in installed:
writer.writerow((installed[f], '', ''))
shutil.move(temp_record, record)
diff --git a/setup.cfg b/setup.cfg
index 5874bd4..f5e8921 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -5,7 +5,7 @@ addopts = --ignore pip/_vendor --ignore tests/tests_cache
universal = 1
[egg_info]
-tag_date = 0
-tag_build =
tag_svn_revision = 0
+tag_build =
+tag_date = 0
diff --git a/setup.py b/setup.py
index 43bab40..488ff08 100644
--- a/setup.py
+++ b/setup.py
@@ -41,7 +41,8 @@ def find_version(*file_paths):
long_description = read('README.rst')
-tests_require = ['pytest', 'virtualenv>=1.10', 'scripttest>=1.3', 'mock']
+tests_require = ['pytest', 'virtualenv>=1.10', 'scripttest>=1.3', 'mock',
+ 'pretend']
setup(
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pip.git
More information about the Python-modules-commits
mailing list