Commit 93dbe92f authored by Scott Kitterman's avatar Scott Kitterman

Import pyyaml_3.12.orig.tar.gz

parent b2559d98
Metadata-Version: 1.1
Name: PyYAML
Version: 3.11
Version: 3.12
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.12.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
......@@ -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.
......
This diff is collapsed.
......@@ -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,
......
......@@ -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.12'
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.12'
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]
......
NAME = 'PyYAML'
VERSION = '3.11'
VERSION = '3.12'
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,
)
......@@ -8,7 +8,7 @@ def main(args=None):
if yaml.__with_libyaml__:
import test_yaml_ext
collections.append(test_yaml_ext)
test_appliance.run(collections, args)
return test_appliance.run(collections, args)
if __name__ == '__main__':
main()
......
......@@ -39,6 +39,7 @@ def parse_arguments(args):
args.remove('-v')
if '--verbose' in args:
verbose = True
args.remove('--verbose')
if 'YAML_TEST_VERBOSE' in os.environ:
verbose = True
include_functions = []
......@@ -118,6 +119,7 @@ def display(results, verbose):
sys.stdout.write('FAILURES: %s\n' % failures)
if errors:
sys.stdout.write('ERRORS: %s\n' % errors)
return not (failures or errors)
def run(collections, args=None):
test_functions = find_test_functions(collections)
......@@ -147,5 +149,5 @@ def run(collections, args=None):
else:
result = execute(function, [], verbose)
results.append(result)
display(results, verbose=verbose)
return display(results, verbose=verbose)
......@@ -8,7 +8,7 @@ def main(args=None):
if yaml.__with_libyaml__:
import test_yaml_ext
collections.append(test_yaml_ext)
test_appliance.run(collections, args)
return test_appliance.run(collections, args)
if __name__ == '__main__':
main()
......
......@@ -36,6 +36,7 @@ def parse_arguments(args):
args.remove('-v')
if '--verbose' in args:
verbose = True
args.remove('--verbose')
if 'YAML_TEST_VERBOSE' in os.environ:
verbose = True
include_functions = []
......@@ -112,6 +113,7 @@ def display(results, verbose):
sys.stdout.write('FAILURES: %s\n' % failures)
if errors:
sys.stdout.write('ERRORS: %s\n' % errors)
return not (failures or errors)
def run(collections, args=None):
test_functions = find_test_functions(collections)
......@@ -141,5 +143,5 @@ def run(collections, args=None):
else:
result = execute(function, [], verbose)
results.append(result)
display(results, verbose=verbose)
return display(results, verbose=verbose)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment