Bug 1602773 - Update pyyaml to version 3.13. r=ahal

This patch-level version bump makes pyyaml compatible
with glean_parser, which needs to support 3.13 due to
its Python 3.7 support. pyyaml support Python 3.7 from
version 3.13, on.

Differential Revision: https://phabricator.services.mozilla.com/D63633

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alessio Placitelli 2020-02-24 09:42:56 +00:00
Родитель 47f2a10a01
Коммит 7f3255b3bc
16 изменённых файлов: 12487 добавлений и 5443 удалений

19
third_party/python/pyyaml/CHANGES поставляемый
Просмотреть файл

@ -1,6 +1,21 @@
For a complete Mercurial changelog, see
'https://bitbucket.org/xi/pyyaml/commits'.
For a complete changelog, see https://github.com/yaml/pyyaml/commits/
3.13 (2018-07-05)
-----------------
* Rebuilt with the latest Cython to support the new Python 3.7 release.
* No functionality is different from PyYAML 3.12 in this release.
3.12 (2016-08-28)
-----------------
* Wheel packages for Windows binaries.
* Adding an implicit resolver to a derived loader should not affect the base
loader (fixes issue #57).
* Uniform representation for OrderedDict across different versions of Python
(fixes issue #61).
* Fixed comparison to None warning (closes issue #64).
3.11 (2014-03-26)
-----------------

3
third_party/python/pyyaml/LICENSE поставляемый
Просмотреть файл

@ -1,4 +1,5 @@
Copyright (c) 2006 Kirill Simonov
Copyright (c) 2017-2018 Ingy döt Net
Copyright (c) 2006-2016 Kirill Simonov
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

11
third_party/python/pyyaml/PKG-INFO поставляемый
Просмотреть файл

@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: PyYAML
Version: 3.11
Version: 3.13
Summary: YAML parser and emitter for Python
Home-page: http://pyyaml.org/wiki/PyYAML
Author: Kirill Simonov
Author-email: xi@resolvent.net
License: MIT
Download-URL: http://pyyaml.org/download/pyyaml/PyYAML-3.11.tar.gz
Download-URL: http://pyyaml.org/download/pyyaml/PyYAML-3.13.tar.gz
Description: YAML is a data serialization format designed for human readability
and interaction with scripting languages. PyYAML is a YAML parser
and emitter for Python.
@ -25,12 +25,9 @@ Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.0
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup

2
third_party/python/pyyaml/README поставляемый
Просмотреть файл

@ -28,7 +28,7 @@ Post your questions and opinions to the YAML-Core mailing list:
'http://lists.sourceforge.net/lists/listinfo/yaml-core'.
Submit bug reports and feature requests to the PyYAML bug tracker:
'http://pyyaml.org/newticket?component=pyyaml'.
'https://bitbucket.org/xi/pyyaml/issues/new'.
PyYAML is written by Kirill Simonov <xi@resolvent.net>. It is released
under the MIT license. See the file LICENSE for more details.

17746
third_party/python/pyyaml/ext/_yaml.c поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

22
third_party/python/pyyaml/ext/_yaml.pxd поставляемый
Просмотреть файл

@ -86,15 +86,15 @@ cdef extern from "_yaml.h":
YAML_MAPPING_END_EVENT
ctypedef int yaml_read_handler_t(void *data, char *buffer,
int size, int *size_read) except 0
size_t size, size_t *size_read) except 0
ctypedef int yaml_write_handler_t(void *data, char *buffer,
int size) except 0
size_t size) except 0
ctypedef struct yaml_mark_t:
int index
int line
int column
size_t index
size_t line
size_t column
ctypedef struct yaml_version_directive_t:
int major
int minor
@ -113,7 +113,7 @@ cdef extern from "_yaml.h":
char *suffix
ctypedef struct _yaml_token_scalar_data_t:
char *value
int length
size_t length
yaml_scalar_style_t style
ctypedef struct _yaml_token_version_directive_data_t:
int major
@ -152,7 +152,7 @@ cdef extern from "_yaml.h":
char *anchor
char *tag
char *value
int length
size_t length
int plain_implicit
int quoted_implicit
yaml_scalar_style_t style
@ -183,7 +183,7 @@ cdef extern from "_yaml.h":
ctypedef struct yaml_parser_t:
yaml_error_type_t error
char *problem
int problem_offset
size_t problem_offset
int problem_value
yaml_mark_t problem_mark
char *context
@ -210,7 +210,7 @@ cdef extern from "_yaml.h":
int implicit)
int yaml_alias_event_initialize(yaml_event_t *event, char *anchor)
int yaml_scalar_event_initialize(yaml_event_t *event,
char *anchor, char *tag, char *value, int length,
char *anchor, char *tag, char *value, size_t length,
int plain_implicit, int quoted_implicit,
yaml_scalar_style_t style)
int yaml_sequence_start_event_initialize(yaml_event_t *event,
@ -224,7 +224,7 @@ cdef extern from "_yaml.h":
int yaml_parser_initialize(yaml_parser_t *parser)
void yaml_parser_delete(yaml_parser_t *parser)
void yaml_parser_set_input_string(yaml_parser_t *parser,
char *input, int size)
char *input, size_t size)
void yaml_parser_set_input(yaml_parser_t *parser,
yaml_read_handler_t *handler, void *data)
void yaml_parser_set_encoding(yaml_parser_t *parser,
@ -235,7 +235,7 @@ cdef extern from "_yaml.h":
int yaml_emitter_initialize(yaml_emitter_t *emitter)
void yaml_emitter_delete(yaml_emitter_t *emitter)
void yaml_emitter_set_output_string(yaml_emitter_t *emitter,
char *output, int size, int *size_written)
char *output, size_t size, size_t *size_written)
void yaml_emitter_set_output(yaml_emitter_t *emitter,
yaml_write_handler_t *handler, void *data)
void yaml_emitter_set_encoding(yaml_emitter_t *emitter,

4
third_party/python/pyyaml/ext/_yaml.pyx поставляемый
Просмотреть файл

@ -905,7 +905,7 @@ cdef class CParser:
raise error
return 1
cdef int input_handler(void *data, char *buffer, int size, int *read) except 0:
cdef int input_handler(void *data, char *buffer, size_t size, size_t *read) except 0:
cdef CParser parser
parser = <CParser>data
if parser.stream_cache is None:
@ -1515,7 +1515,7 @@ cdef class CEmitter:
self.ascend_resolver()
return 1
cdef int output_handler(void *data, char *buffer, int size) except 0:
cdef int output_handler(void *data, char *buffer, size_t size) except 0:
cdef CEmitter emitter
emitter = <CEmitter>data
if emitter.dump_unicode == 0:

Просмотреть файл

@ -8,7 +8,7 @@ from nodes import *
from loader import *
from dumper import *
__version__ = '3.11'
__version__ = '3.13'
try:
from cyaml import *

Просмотреть файл

@ -139,7 +139,9 @@ class BaseRepresenter(object):
class SafeRepresenter(BaseRepresenter):
def ignore_aliases(self, data):
if data in [None, ()]:
if data is None:
return True
if isinstance(data, tuple) and data == ():
return True
if isinstance(data, (str, unicode, bool, int, float)):
return True

Просмотреть файл

@ -24,7 +24,10 @@ class BaseResolver(object):
def add_implicit_resolver(cls, tag, regexp, first):
if not 'yaml_implicit_resolvers' in cls.__dict__:
cls.yaml_implicit_resolvers = cls.yaml_implicit_resolvers.copy()
implicit_resolvers = {}
for key in cls.yaml_implicit_resolvers:
implicit_resolvers[key] = cls.yaml_implicit_resolvers[key][:]
cls.yaml_implicit_resolvers = implicit_resolvers
if first is None:
first = [None]
for ch in first:

Просмотреть файл

@ -286,7 +286,7 @@ class Scanner(object):
or self.index-key.index > 1024:
if key.required:
raise ScannerError("while scanning a simple key", key.mark,
"could not found expected ':'", self.get_mark())
"could not find expected ':'", self.get_mark())
del self.possible_simple_keys[level]
def save_possible_simple_key(self):
@ -297,10 +297,6 @@ class Scanner(object):
# Check if a simple key is required at the current position.
required = not self.flow_level and self.indent == self.column
# A simple key is required only if it is the first token in the current
# line. Therefore it is always allowed.
assert self.allow_simple_key or not required
# The next token might be a simple key. Let's save it's number and
# position.
if self.allow_simple_key:
@ -317,7 +313,7 @@ class Scanner(object):
if key.required:
raise ScannerError("while scanning a simple key", key.mark,
"could not found expected ':'", self.get_mark())
"could not find expected ':'", self.get_mark())
del self.possible_simple_keys[self.flow_level]

Просмотреть файл

@ -8,7 +8,7 @@ from .nodes import *
from .loader import *
from .dumper import *
__version__ = '3.11'
__version__ = '3.13'
try:
from .cyaml import *
__with_libyaml__ = True

Просмотреть файл

@ -5,7 +5,7 @@ __all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer',
from .error import *
from .nodes import *
import datetime, sys, copyreg, types, base64
import datetime, sys, copyreg, types, base64, collections
class RepresenterError(YAMLError):
pass
@ -132,7 +132,9 @@ class BaseRepresenter:
class SafeRepresenter(BaseRepresenter):
def ignore_aliases(self, data):
if data in [None, ()]:
if data is None:
return True
if isinstance(data, tuple) and data == ():
return True
if isinstance(data, (str, bytes, bool, int, float)):
return True
@ -351,6 +353,14 @@ class Representer(SafeRepresenter):
value['dictitems'] = dictitems
return self.represent_mapping(tag+function_name, value)
def represent_ordered_dict(self, data):
# Provide uniform representation across different Python versions.
data_type = type(data)
tag = 'tag:yaml.org,2002:python/object/apply:%s.%s' \
% (data_type.__module__, data_type.__name__)
items = [[key, value] for key, value in data.items()]
return self.represent_sequence(tag, [items])
Representer.add_representer(complex,
Representer.represent_complex)
@ -360,6 +370,9 @@ Representer.add_representer(tuple,
Representer.add_representer(type,
Representer.represent_name)
Representer.add_representer(collections.OrderedDict,
Representer.represent_ordered_dict)
Representer.add_representer(types.FunctionType,
Representer.represent_name)

Просмотреть файл

@ -25,7 +25,10 @@ class BaseResolver:
@classmethod
def add_implicit_resolver(cls, tag, regexp, first):
if not 'yaml_implicit_resolvers' in cls.__dict__:
cls.yaml_implicit_resolvers = cls.yaml_implicit_resolvers.copy()
implicit_resolvers = {}
for key in cls.yaml_implicit_resolvers:
implicit_resolvers[key] = cls.yaml_implicit_resolvers[key][:]
cls.yaml_implicit_resolvers = implicit_resolvers
if first is None:
first = [None]
for ch in first:

Просмотреть файл

@ -286,7 +286,7 @@ class Scanner:
or self.index-key.index > 1024:
if key.required:
raise ScannerError("while scanning a simple key", key.mark,
"could not found expected ':'", self.get_mark())
"could not find expected ':'", self.get_mark())
del self.possible_simple_keys[level]
def save_possible_simple_key(self):
@ -297,10 +297,6 @@ class Scanner:
# Check if a simple key is required at the current position.
required = not self.flow_level and self.indent == self.column
# A simple key is required only if it is the first token in the current
# line. Therefore it is always allowed.
assert self.allow_simple_key or not required
# The next token might be a simple key. Let's save it's number and
# position.
if self.allow_simple_key:
@ -317,7 +313,7 @@ class Scanner:
if key.required:
raise ScannerError("while scanning a simple key", key.mark,
"could not found expected ':'", self.get_mark())
"could not find expected ':'", self.get_mark())
del self.possible_simple_keys[self.flow_level]

72
third_party/python/pyyaml/setup.py поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
NAME = 'PyYAML'
VERSION = '3.11'
VERSION = '3.13'
DESCRIPTION = "YAML parser and emitter for Python"
LONG_DESCRIPTION = """\
YAML is a data serialization format designed for human readability
@ -27,13 +27,10 @@ CLASSIFIERS = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.5",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.0",
"Programming Language :: Python :: 3.1",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Markup",
]
@ -57,7 +54,7 @@ int main(void) {
"""
import sys, os.path
import sys, os.path, platform
from distutils import log
from distutils.core import setup, Command
@ -66,7 +63,7 @@ from distutils.core import Extension as _Extension
from distutils.dir_util import mkpath
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm
from distutils.errors import CompileError, LinkError, DistutilsPlatformError
from distutils.errors import DistutilsError, CompileError, LinkError, DistutilsPlatformError
if 'setuptools.extension' in sys.modules:
_Extension = sys.modules['setuptools.extension']._Extension
@ -74,21 +71,18 @@ if 'setuptools.extension' in sys.modules:
sys.modules['distutils.extension'].Extension = _Extension
sys.modules['distutils.command.build_ext'].Extension = _Extension
with_pyrex = None
if sys.version_info[0] < 3:
try:
from Cython.Distutils.extension import Extension as _Extension
from Cython.Distutils import build_ext as _build_ext
with_pyrex = 'cython'
except ImportError:
try:
# Pyrex cannot build _yaml.c at the moment,
# but it may get fixed eventually.
from Pyrex.Distutils import Extension as _Extension
from Pyrex.Distutils import build_ext as _build_ext
with_pyrex = 'pyrex'
except ImportError:
pass
with_cython = False
try:
from Cython.Distutils.extension import Extension as _Extension
from Cython.Distutils import build_ext as _build_ext
with_cython = True
except ImportError:
pass
try:
from wheel.bdist_wheel import bdist_wheel
except ImportError:
bdist_wheel = None
class Distribution(_Distribution):
@ -122,7 +116,8 @@ class Distribution(_Distribution):
return False
def ext_status(self, ext):
if 'Java' in sys.version or 'IronPython' in sys.version or 'PyPy' in sys.version:
implementation = platform.python_implementation()
if implementation != 'CPython':
return False
if isinstance(ext, Extension):
with_ext = getattr(self, ext.attr_name)
@ -135,7 +130,7 @@ class Extension(_Extension):
def __init__(self, name, sources, feature_name, feature_description,
feature_check, **kwds):
if not with_pyrex:
if not with_cython:
for filename in sources[:]:
base, ext = os.path.splitext(filename)
if ext == '.pyx':
@ -179,9 +174,7 @@ class build_ext(_build_ext):
self.check_extensions_list(self.extensions)
filenames = []
for ext in self.extensions:
if with_pyrex == 'pyrex':
self.pyrex_sources(ext.sources, ext)
elif with_pyrex == 'cython':
if with_cython:
self.cython_sources(ext.sources, ext)
for filename in ext.sources:
filenames.append(filename)
@ -211,9 +204,7 @@ class build_ext(_build_ext):
with_ext = self.check_extension_availability(ext)
if not with_ext:
continue
if with_pyrex == 'pyrex':
ext.sources = self.pyrex_sources(ext.sources, ext)
elif with_pyrex == 'cython':
if with_cython:
ext.sources = self.cython_sources(ext.sources, ext)
self.build_extension(ext)
@ -308,7 +299,17 @@ class test(Command):
else:
sys.path.insert(0, 'tests/lib3')
import test_all
test_all.main([])
if not test_all.main([]):
raise DistutilsError("Tests failed")
cmdclass = {
'build_ext': build_ext,
'bdist_rpm': bdist_rpm,
'test': test,
}
if bdist_wheel:
cmdclass['bdist_wheel'] = bdist_wheel
if __name__ == '__main__':
@ -335,11 +336,6 @@ if __name__ == '__main__':
],
distclass=Distribution,
cmdclass={
'build_ext': build_ext,
'bdist_rpm': bdist_rpm,
'test': test,
},
cmdclass=cmdclass,
)