Upgrade cachecontrol, setuptools, and pytoml

This commit is contained in:
Donald Stufft 2017-09-07 12:20:10 -04:00
parent 4b5a0d559e
commit b14a62f36e
9 changed files with 92 additions and 52 deletions

View File

@ -1 +1 @@
Upgraded CacheControl to 0.12.2.
Upgraded CacheControl to 0.12.3.

1
news/pytoml.vendor Normal file
View File

@ -0,0 +1 @@
Upgraded pytoml to 0.1.14.

View File

@ -1 +1 @@
Upgraded pkg_resources (via setuptools) to 36.2.6.
Upgraded pkg_resources (via setuptools) to 36.4.0.

View File

@ -4,7 +4,7 @@ Make it easy to import from cachecontrol without long namespaces.
"""
__author__ = 'Eric Larson'
__email__ = 'eric@ionrock.org'
__version__ = '0.12.2'
__version__ = '0.12.3'
from .wrapper import CacheControl
from .adapter import CacheControlAdapter

View File

@ -9,7 +9,7 @@ try:
FileNotFoundError
except NameError:
# py2.X
FileNotFoundError = IOError
FileNotFoundError = OSError
def _secure_open_write(filename, fmode):

View File

@ -34,6 +34,7 @@ import platform
import collections
import plistlib
import email.parser
import errno
import tempfile
import textwrap
import itertools
@ -80,6 +81,11 @@ __import__('pip._vendor.packaging.markers')
if (3, 0) < sys.version_info < (3, 3):
raise RuntimeError("Python 3.3 or later is required")
if six.PY2:
# Those builtin exceptions are only defined in Python 3
PermissionError = None
NotADirectoryError = None
# declare some globals that will be defined later to
# satisfy the linters.
require = None
@ -852,7 +858,10 @@ class WorkingSet(object):
# distribution
env = Environment([])
ws = WorkingSet([])
dist = best[req.key] = env.best_match(req, ws, installer)
dist = best[req.key] = env.best_match(
req, ws, installer,
replace_conflicting=replace_conflicting
)
if dist is None:
requirers = required_by.get(req, None)
raise DistributionNotFound(req, requirers)
@ -1104,7 +1113,7 @@ class Environment(object):
dists.append(dist)
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
def best_match(self, req, working_set, installer=None):
def best_match(self, req, working_set, installer=None, replace_conflicting=False):
"""Find distribution best matching `req` and usable on `working_set`
This calls the ``find(req)`` method of the `working_set` to see if a
@ -1117,7 +1126,12 @@ class Environment(object):
calling the environment's ``obtain(req, installer)`` method will be
returned.
"""
dist = working_set.find(req)
try:
dist = working_set.find(req)
except VersionConflict:
if not replace_conflicting:
raise
dist = None
if dist is not None:
return dist
for dist in self[req.key]:
@ -2008,46 +2022,57 @@ def find_on_path(importer, path_item, only=False):
"""Yield distributions accessible on a sys.path directory"""
path_item = _normalize_cached(path_item)
if os.path.isdir(path_item) and os.access(path_item, os.R_OK):
if _is_unpacked_egg(path_item):
yield Distribution.from_filename(
path_item, metadata=PathMetadata(
path_item, os.path.join(path_item, 'EGG-INFO')
)
if _is_unpacked_egg(path_item):
yield Distribution.from_filename(
path_item, metadata=PathMetadata(
path_item, os.path.join(path_item, 'EGG-INFO')
)
else:
# scan for .egg and .egg-info in directory
path_item_entries = _by_version_descending(os.listdir(path_item))
for entry in path_item_entries:
lower = entry.lower()
if lower.endswith('.egg-info') or lower.endswith('.dist-info'):
fullpath = os.path.join(path_item, entry)
if os.path.isdir(fullpath):
# egg-info directory, allow getting metadata
if len(os.listdir(fullpath)) == 0:
# Empty egg directory, skip.
continue
metadata = PathMetadata(path_item, fullpath)
else:
metadata = FileMetadata(fullpath)
yield Distribution.from_location(
path_item, entry, metadata, precedence=DEVELOP_DIST
)
elif not only and _is_egg_path(entry):
dists = find_distributions(os.path.join(path_item, entry))
for dist in dists:
yield dist
elif not only and lower.endswith('.egg-link'):
with open(os.path.join(path_item, entry)) as entry_file:
entry_lines = entry_file.readlines()
for line in entry_lines:
if not line.strip():
continue
path = os.path.join(path_item, line.rstrip())
dists = find_distributions(path)
for item in dists:
yield item
break
)
else:
try:
entries = os.listdir(path_item)
except (PermissionError, NotADirectoryError):
return
except OSError as e:
# Ignore the directory if does not exist, not a directory or we
# don't have permissions
if (e.errno in (errno.ENOTDIR, errno.EACCES, errno.ENOENT)
# Python 2 on Windows needs to be handled this way :(
or hasattr(e, "winerror") and e.winerror == 267):
return
raise
# scan for .egg and .egg-info in directory
path_item_entries = _by_version_descending(entries)
for entry in path_item_entries:
lower = entry.lower()
if lower.endswith('.egg-info') or lower.endswith('.dist-info'):
fullpath = os.path.join(path_item, entry)
if os.path.isdir(fullpath):
# egg-info directory, allow getting metadata
if len(os.listdir(fullpath)) == 0:
# Empty egg directory, skip.
continue
metadata = PathMetadata(path_item, fullpath)
else:
metadata = FileMetadata(fullpath)
yield Distribution.from_location(
path_item, entry, metadata, precedence=DEVELOP_DIST
)
elif not only and _is_egg_path(entry):
dists = find_distributions(os.path.join(path_item, entry))
for dist in dists:
yield dist
elif not only and lower.endswith('.egg-link'):
with open(os.path.join(path_item, entry)) as entry_file:
entry_lines = entry_file.readlines()
for line in entry_lines:
if not line.strip():
continue
path = os.path.join(path_item, line.rstrip())
dists = find_distributions(path)
for item in dists:
yield item
break
register_finder(pkgutil.ImpImporter, find_on_path)

View File

@ -209,6 +209,14 @@ def _p_key(s):
r = _p_basicstr_content(s, _basicstr_re)
s.expect('"')
return r
if s.consume('\''):
if s.consume('\'\''):
r = s.expect_re(_litstr_ml_re).group(0)
s.expect('\'\'\'')
else:
r = s.expect_re(_litstr_re).group(0)
s.expect('\'')
return r
return s.expect_re(_key_re).group(0)
_float_re = re.compile(r'[+-]?(?:0|[1-9](?:_?\d)*)(?:\.\d(?:_?\d)*)?(?:[eE][+-]?(?:\d(?:_?\d)*))?')

View File

@ -1,5 +1,5 @@
from __future__ import unicode_literals
import io, datetime, sys
import io, datetime, math, sys
if sys.version_info[0] == 3:
long = int
@ -61,7 +61,10 @@ def _format_value(v):
if isinstance(v, int) or isinstance(v, long):
return unicode(v)
if isinstance(v, float):
return repr(v)
if math.isnan(v) or math.isinf(v):
raise ValueError("{0} is not a valid TOML value".format(v))
else:
return repr(v)
elif isinstance(v, unicode) or isinstance(v, bytes):
return _escape_string(v)
elif isinstance(v, datetime.datetime):
@ -102,6 +105,7 @@ def dump(obj, fout, sort_keys=False):
table_keys = sorted(table.keys()) if sort_keys else table.keys()
new_tables = []
has_kv = False
for k in table_keys:
v = table[k]
if isinstance(v, dict):
@ -112,10 +116,12 @@ def dump(obj, fout, sort_keys=False):
# based on mojombo's comment: https://github.com/toml-lang/toml/issues/146#issuecomment-25019344
fout.write(
'#{} = null # To use: uncomment and replace null with value\n'.format(_escape_id(k)))
has_kv = True
else:
fout.write('{0} = {1}\n'.format(_escape_id(k), _format_value(v)))
has_kv = True
tables.extend(reversed(new_tables))
if tables:
if (name or has_kv) and tables:
fout.write('\n')

View File

@ -4,15 +4,15 @@ distro==1.0.4
html5lib==1.0b10
six==1.10.0
colorama==0.3.9
CacheControl==0.12.2
CacheControl==0.12.3
msgpack-python==0.4.8
lockfile==0.12.2
progress==1.3
ipaddress==1.0.18 # Only needed on 2.6 and 2.7
packaging==16.8
pyparsing==2.2.0
pytoml==0.1.12
pytoml==0.1.14
retrying==1.3.3
requests==2.14.2
setuptools==36.2.6
setuptools==36.4.0
webencodings==0.5.1