summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES13
-rw-r--r--__init__.py4
-rw-r--r--ext/_ruamel_yaml.h2
-rw-r--r--ext/yaml_private.h2
-rw-r--r--setup.py31
5 files changed, 40 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index d2488d1..f7590e6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,16 @@
+0.10.11: 2015-09-17
+- Fix issue 13: dependency on libyaml to be installed for yaml.h
+
+0.10.10: 2015-09-15
+- Python 3.5 tested with tox
+- pypy full test (old PyYAML tests failed on too many open file handles)
+
+0.10.6-0.10.9: 2015-09-14
+- Fix for issue 9
+- Fix for issue 11: double dump losing comments
+- Include libyaml code
+- move code from 'py' subdir for proper namespace packaging.
+
0.10.5: 2015-08-25
- preservation of newlines after block scalars. Contributed by Sam Thursfield.
diff --git a/__init__.py b/__init__.py
index 0d57477..37653cb 100644
--- a/__init__.py
+++ b/__init__.py
@@ -9,7 +9,7 @@ from __future__ import absolute_import
_package_data = dict(
full_package_name="ruamel.yaml",
- version_info=[0, 10, 10],
+ version_info=[0, 10, 11],
author="Anthon van der Neut",
author_email="a.van.der.neut@ruamel.eu",
description="ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order", # NOQA
@@ -25,7 +25,7 @@ _package_data = dict(
"ext/loader.c", "ext/reader.c", "ext/scanner.c", "ext/parser.c",
"ext/emitter.c"],
lib=[],
- test="#include <yaml.h>\n\nint main(int argc, char* argv[])\n{\nyaml_parser_t parser;\nparser = parser; /* prevent warning */\nreturn 0;\n}\n" # NOQA
+ # test='#include "ext/yaml.h"\n\nint main(int argc, char* argv[])\n{\nyaml_parser_t parser;\nparser = parser; /* prevent warning */\nreturn 0;\n}\n' # NOQA
)
],
classifiers=[
diff --git a/ext/_ruamel_yaml.h b/ext/_ruamel_yaml.h
index 21fd6a9..568db50 100644
--- a/ext/_ruamel_yaml.h
+++ b/ext/_ruamel_yaml.h
@@ -1,5 +1,5 @@
-#include <yaml.h>
+#include "yaml.h"
#if PY_MAJOR_VERSION < 3
diff --git a/ext/yaml_private.h b/ext/yaml_private.h
index f9fec05..9f39776 100644
--- a/ext/yaml_private.h
+++ b/ext/yaml_private.h
@@ -1,7 +1,7 @@
#include "config.h"
-#include <yaml.h>
+#include "yaml.h"
#include <assert.h>
#include <limits.h>
diff --git a/setup.py b/setup.py
index f9277e4..933e5e6 100644
--- a/setup.py
+++ b/setup.py
@@ -47,6 +47,8 @@ def literal_eval(node_or_string):
node_or_string = parse(node_or_string, mode='eval')
if isinstance(node_or_string, Expression):
node_or_string = node_or_string.body
+ else:
+ raise TypeError("only string or AST nodes supported")
def _convert(node):
if isinstance(node, (Str, Bytes)):
@@ -85,10 +87,16 @@ def literal_eval(node_or_string):
return left + right
else:
return left - right
- elif isinstance(node, Call) and node.func.id == 'dict':
- return dict((k.arg, _convert(k.value)) for k in node.keywords)
- elif isinstance(node, Call) and node.func.id == 'set':
- return set(_convert(k) for k in node.args)
+ elif isinstance(node, Call):
+ func_id = getattr(node.func, 'id', None)
+ if func_id == 'dict':
+ return dict((k.arg, _convert(k.value)) for k in node.keywords)
+ elif func_id == 'set':
+ return set(_convert(node.args[0]))
+ elif func_id == 'date':
+ return datetime.date(*[_convert(k) for k in node.args])
+ elif func_id == 'datetime':
+ return datetime.datetime(*[_convert(k) for k in node.args])
err = SyntaxError('malformed node or string: ' + repr(node))
err.filename = '<string>'
err.lineno = node.lineno
@@ -289,15 +297,19 @@ class NameSpacePackager(object):
@property
def package_dir(self):
- return {
+ d = {
# don't specify empty dir, clashes with package_data spec
self.full_package_name: '.',
- self.split[0]: self.namespace_directories(1)[0],
}
+ if len(self.split) > 1: # only if package namespace
+ d[self.split[0]] = self.namespace_directories(1)[0]
+ return d
def create_dirs(self):
"""create the directories necessary for namespace packaging"""
directories = self.namespace_directories(self.depth)
+ if not directories:
+ return
if not os.path.exists(directories[0]):
for d in directories:
os.mkdir(d)
@@ -374,8 +386,11 @@ class NameSpacePackager(object):
@property
def url(self):
- return 'https://bitbucket.org/{0}/{1}'.format(
- *self.full_package_name.split('.', 1))
+ if self.full_package_name.startswith('ruamel.'):
+ sp = self.full_package_name.split('.', 1)
+ else:
+ sp = ['ruamel', self.full_package_name]
+ return 'https://bitbucket.org/{0}/{1}'.format(*sp)
@property
def author(self):