mirror of https://github.com/pypa/pip
Update distlib to 0.2.6
This commit is contained in:
parent
62a695c4b9
commit
f2cf472d91
|
@ -1 +1 @@
|
|||
Upgraded distlib to 0.2.5.
|
||||
Upgraded distlib to 0.2.6.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2012-2016 Vinay Sajip.
|
||||
# Copyright (C) 2012-2017 Vinay Sajip.
|
||||
# Licensed to the Python Software Foundation under a contributor agreement.
|
||||
# See LICENSE.txt and CONTRIBUTORS.txt.
|
||||
#
|
||||
import logging
|
||||
|
||||
__version__ = '0.2.5'
|
||||
__version__ = '0.2.6'
|
||||
|
||||
class DistlibException(Exception):
|
||||
pass
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2013-2016 Vinay Sajip.
|
||||
# Copyright (C) 2013-2017 Vinay Sajip.
|
||||
# Licensed to the Python Software Foundation under a contributor agreement.
|
||||
# See LICENSE.txt and CONTRIBUTORS.txt.
|
||||
#
|
||||
|
@ -12,7 +12,7 @@ import sys
|
|||
|
||||
try:
|
||||
import ssl
|
||||
except ImportError:
|
||||
except ImportError: # pragma: no cover
|
||||
ssl = None
|
||||
|
||||
if sys.version_info[0] < 3: # pragma: no cover
|
||||
|
@ -272,7 +272,7 @@ from zipfile import ZipFile as BaseZipFile
|
|||
|
||||
if hasattr(BaseZipFile, '__enter__'): # pragma: no cover
|
||||
ZipFile = BaseZipFile
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
from zipfile import ZipExtFile as BaseZipExtFile
|
||||
|
||||
class ZipExtFile(BaseZipExtFile):
|
||||
|
@ -329,7 +329,13 @@ try:
|
|||
fsencode = os.fsencode
|
||||
fsdecode = os.fsdecode
|
||||
except AttributeError: # pragma: no cover
|
||||
_fsencoding = sys.getfilesystemencoding()
|
||||
# Issue #99: on some systems (e.g. containerised),
|
||||
# sys.getfilesystemencoding() returns None, and we need a real value,
|
||||
# so fall back to utf-8. From the CPython 2.7 docs relating to Unix and
|
||||
# sys.getfilesystemencoding(): the return value is "the user’s preference
|
||||
# according to the result of nl_langinfo(CODESET), or None if the
|
||||
# nl_langinfo(CODESET) failed."
|
||||
_fsencoding = sys.getfilesystemencoding() or 'utf-8'
|
||||
if _fsencoding == 'mbcs':
|
||||
_fserrors = 'strict'
|
||||
else:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2012-2016 The Python Software Foundation.
|
||||
# Copyright (C) 2012-2017 The Python Software Foundation.
|
||||
# See LICENSE.txt and CONTRIBUTORS.txt.
|
||||
#
|
||||
"""PEP 376 implementation."""
|
||||
|
@ -265,18 +265,23 @@ class DistributionPath(object):
|
|||
(name, version))
|
||||
|
||||
for dist in self.get_distributions():
|
||||
provided = dist.provides
|
||||
# We hit a problem on Travis where enum34 was installed and doesn't
|
||||
# have a provides attribute ...
|
||||
if not hasattr(dist, 'provides'):
|
||||
logger.debug('No "provides": %s', dist)
|
||||
else:
|
||||
provided = dist.provides
|
||||
|
||||
for p in provided:
|
||||
p_name, p_ver = parse_name_and_version(p)
|
||||
if matcher is None:
|
||||
if p_name == name:
|
||||
yield dist
|
||||
break
|
||||
else:
|
||||
if p_name == name and matcher.match(p_ver):
|
||||
yield dist
|
||||
break
|
||||
for p in provided:
|
||||
p_name, p_ver = parse_name_and_version(p)
|
||||
if matcher is None:
|
||||
if p_name == name:
|
||||
yield dist
|
||||
break
|
||||
else:
|
||||
if p_name == name and matcher.match(p_ver):
|
||||
yield dist
|
||||
break
|
||||
|
||||
def get_file_path(self, name, relative_path):
|
||||
"""
|
||||
|
@ -1025,20 +1030,21 @@ class EggInfoDistribution(BaseInstalledDistribution):
|
|||
:returns: iterator of paths
|
||||
"""
|
||||
record_path = os.path.join(self.path, 'installed-files.txt')
|
||||
skip = True
|
||||
with codecs.open(record_path, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line == './':
|
||||
skip = False
|
||||
continue
|
||||
if not skip:
|
||||
p = os.path.normpath(os.path.join(self.path, line))
|
||||
if p.startswith(self.path):
|
||||
if absolute:
|
||||
yield p
|
||||
else:
|
||||
yield line
|
||||
if os.path.exists(record_path):
|
||||
skip = True
|
||||
with codecs.open(record_path, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line == './':
|
||||
skip = False
|
||||
continue
|
||||
if not skip:
|
||||
p = os.path.normpath(os.path.join(self.path, line))
|
||||
if p.startswith(self.path):
|
||||
if absolute:
|
||||
yield p
|
||||
else:
|
||||
yield line
|
||||
|
||||
def __eq__(self, other):
|
||||
return (isinstance(other, EggInfoDistribution) and
|
||||
|
|
|
@ -24,7 +24,7 @@ from .compat import (urljoin, urlparse, urlunparse, url2pathname, pathname2url,
|
|||
HTTPRedirectHandler as BaseRedirectHandler, text_type,
|
||||
Request, HTTPError, URLError)
|
||||
from .database import Distribution, DistributionPath, make_dist
|
||||
from .metadata import Metadata
|
||||
from .metadata import Metadata, MetadataInvalidError
|
||||
from .util import (cached_property, parse_credentials, ensure_slash,
|
||||
split_filename, get_project_data, parse_requirement,
|
||||
parse_name_and_version, ServerProxy, normalize_name)
|
||||
|
@ -69,7 +69,7 @@ class RedirectHandler(BaseRedirectHandler):
|
|||
if key in headers:
|
||||
newurl = headers[key]
|
||||
break
|
||||
if newurl is None:
|
||||
if newurl is None: # pragma: no cover
|
||||
return
|
||||
urlparts = urlparse(newurl)
|
||||
if urlparts.scheme == '':
|
||||
|
@ -175,7 +175,7 @@ class Locator(object):
|
|||
|
||||
This calls _get_project to do all the work, and just implements a caching layer on top.
|
||||
"""
|
||||
if self._cache is None:
|
||||
if self._cache is None: # pragma: no cover
|
||||
result = self._get_project(name)
|
||||
elif name in self._cache:
|
||||
result = self._cache[name]
|
||||
|
@ -241,7 +241,7 @@ class Locator(object):
|
|||
|
||||
result = None
|
||||
scheme, netloc, path, params, query, frag = urlparse(url)
|
||||
if frag.lower().startswith('egg='):
|
||||
if frag.lower().startswith('egg='): # pragma: no cover
|
||||
logger.debug('%s: version hint in fragment: %r',
|
||||
project_name, frag)
|
||||
m = HASHER_HASH.match(frag)
|
||||
|
@ -250,7 +250,7 @@ class Locator(object):
|
|||
else:
|
||||
algo, digest = None, None
|
||||
origpath = path
|
||||
if path and path[-1] == '/':
|
||||
if path and path[-1] == '/': # pragma: no cover
|
||||
path = path[:-1]
|
||||
if path.endswith('.whl'):
|
||||
try:
|
||||
|
@ -272,13 +272,15 @@ class Locator(object):
|
|||
}
|
||||
except Exception as e: # pragma: no cover
|
||||
logger.warning('invalid path for wheel: %s', path)
|
||||
elif path.endswith(self.downloadable_extensions):
|
||||
elif not path.endswith(self.downloadable_extensions): # pragma: no cover
|
||||
logger.debug('Not downloadable: %s', path)
|
||||
else: # downloadable extension
|
||||
path = filename = posixpath.basename(path)
|
||||
for ext in self.downloadable_extensions:
|
||||
if path.endswith(ext):
|
||||
path = path[:-len(ext)]
|
||||
t = self.split_filename(path, project_name)
|
||||
if not t:
|
||||
if not t: # pragma: no cover
|
||||
logger.debug('No match for project/version: %s', path)
|
||||
else:
|
||||
name, version, pyver = t
|
||||
|
@ -291,7 +293,7 @@ class Locator(object):
|
|||
params, query, '')),
|
||||
#'packagetype': 'sdist',
|
||||
}
|
||||
if pyver:
|
||||
if pyver: # pragma: no cover
|
||||
result['python-version'] = pyver
|
||||
break
|
||||
if result and algo:
|
||||
|
@ -352,7 +354,7 @@ class Locator(object):
|
|||
"""
|
||||
result = None
|
||||
r = parse_requirement(requirement)
|
||||
if r is None:
|
||||
if r is None: # pragma: no cover
|
||||
raise DistlibException('Not a valid requirement: %r' % requirement)
|
||||
scheme = get_scheme(self.scheme)
|
||||
self.matcher = matcher = scheme.matcher(r.requirement)
|
||||
|
@ -390,7 +392,7 @@ class Locator(object):
|
|||
d = {}
|
||||
sd = versions.get('digests', {})
|
||||
for url in result.download_urls:
|
||||
if url in sd:
|
||||
if url in sd: # pragma: no cover
|
||||
d[url] = sd[url]
|
||||
result.digests = d
|
||||
self.matcher = None
|
||||
|
@ -730,11 +732,14 @@ class SimpleScrapingLocator(Locator):
|
|||
continue
|
||||
for link, rel in page.links:
|
||||
if link not in self._seen:
|
||||
self._seen.add(link)
|
||||
if (not self._process_download(link) and
|
||||
self._should_queue(link, url, rel)):
|
||||
logger.debug('Queueing %s from %s', link, url)
|
||||
self._to_fetch.put(link)
|
||||
try:
|
||||
self._seen.add(link)
|
||||
if (not self._process_download(link) and
|
||||
self._should_queue(link, url, rel)):
|
||||
logger.debug('Queueing %s from %s', link, url)
|
||||
self._to_fetch.put(link)
|
||||
except MetadataInvalidError: # e.g. invalid versions
|
||||
pass
|
||||
except Exception as e: # pragma: no cover
|
||||
self.errors.put(text_type(e))
|
||||
finally:
|
||||
|
|
|
@ -119,9 +119,12 @@ def interpret(marker, execution_context=None):
|
|||
:param execution_context: The context used for name lookup.
|
||||
:type execution_context: mapping
|
||||
"""
|
||||
expr, rest = parse_marker(marker)
|
||||
try:
|
||||
expr, rest = parse_marker(marker)
|
||||
except Exception as e:
|
||||
raise SyntaxError('Unable to interpret marker syntax: %s: %s' % (marker, e))
|
||||
if rest and rest[0] != '#':
|
||||
raise SyntaxError('unexpected trailing data: %s' % rest)
|
||||
raise SyntaxError('unexpected trailing data in marker: %s: %s' % (marker, rest))
|
||||
context = dict(DEFAULT_CONTEXT)
|
||||
if execution_context:
|
||||
context.update(execution_context)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2013-2016 Vinay Sajip.
|
||||
# Copyright (C) 2013-2017 Vinay Sajip.
|
||||
# Licensed to the Python Software Foundation under a contributor agreement.
|
||||
# See LICENSE.txt and CONTRIBUTORS.txt.
|
||||
#
|
||||
|
|
|
@ -136,6 +136,37 @@ class ScriptMaker(object):
|
|||
return executable
|
||||
return '/usr/bin/env %s' % executable
|
||||
|
||||
def _build_shebang(self, executable, post_interp):
|
||||
"""
|
||||
Build a shebang line. In the simple case (on Windows, or a shebang line
|
||||
which is not too long or contains spaces) use a simple formulation for
|
||||
the shebang. Otherwise, use /bin/sh as the executable, with a contrived
|
||||
shebang which allows the script to run either under Python or sh, using
|
||||
suitable quoting. Thanks to Harald Nordgren for his input.
|
||||
|
||||
See also: http://www.in-ulm.de/~mascheck/various/shebang/#length
|
||||
https://hg.mozilla.org/mozilla-central/file/tip/mach
|
||||
"""
|
||||
if os.name != 'posix':
|
||||
simple_shebang = True
|
||||
else:
|
||||
# Add 3 for '#!' prefix and newline suffix.
|
||||
shebang_length = len(executable) + len(post_interp) + 3
|
||||
if sys.platform == 'darwin':
|
||||
max_shebang_length = 512
|
||||
else:
|
||||
max_shebang_length = 127
|
||||
simple_shebang = ((b' ' not in executable) and
|
||||
(shebang_length <= max_shebang_length))
|
||||
|
||||
if simple_shebang:
|
||||
result = b'#!' + executable + post_interp + b'\n'
|
||||
else:
|
||||
result = b'#!/bin/sh\n'
|
||||
result += b"'''exec' " + executable + post_interp + b' "$0" "$@"\n'
|
||||
result += b"' '''"
|
||||
return result
|
||||
|
||||
def _get_shebang(self, encoding, post_interp=b'', options=None):
|
||||
enquote = True
|
||||
if self.executable:
|
||||
|
@ -169,7 +200,7 @@ class ScriptMaker(object):
|
|||
if (sys.platform == 'cli' and '-X:Frames' 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'
|
||||
shebang = self._build_shebang(executable, post_interp)
|
||||
# Python parser starts to read a script using UTF-8 until
|
||||
# it gets a #coding:xxx cookie. The shebang has to be the
|
||||
# first line of a file, the #coding:xxx cookie cannot be
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2012-2016 The Python Software Foundation.
|
||||
# Copyright (C) 2012-2017 The Python Software Foundation.
|
||||
# See LICENSE.txt and CONTRIBUTORS.txt.
|
||||
#
|
||||
"""
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2013-2016 Vinay Sajip.
|
||||
# Copyright (C) 2013-2017 Vinay Sajip.
|
||||
# Licensed to the Python Software Foundation under a contributor agreement.
|
||||
# See LICENSE.txt and CONTRIBUTORS.txt.
|
||||
#
|
||||
|
@ -35,11 +35,11 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
cache = None # created when needed
|
||||
|
||||
if hasattr(sys, 'pypy_version_info'):
|
||||
if hasattr(sys, 'pypy_version_info'): # pragma: no cover
|
||||
IMP_PREFIX = 'pp'
|
||||
elif sys.platform.startswith('java'):
|
||||
elif sys.platform.startswith('java'): # pragma: no cover
|
||||
IMP_PREFIX = 'jy'
|
||||
elif sys.platform == 'cli':
|
||||
elif sys.platform == 'cli': # pragma: no cover
|
||||
IMP_PREFIX = 'ip'
|
||||
else:
|
||||
IMP_PREFIX = 'cp'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
appdirs==1.4.3
|
||||
distlib==0.2.5
|
||||
distlib==0.2.6
|
||||
distro==1.0.4
|
||||
html5lib==1.0b10
|
||||
six==1.10.0
|
||||
|
|
Loading…
Reference in New Issue