summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-16 22:05:31 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-16 22:05:31 +0100
commita813a531d3f18ceba9dc7156e38a1d6124d3a367 (patch)
tree0a797ce09ce215748a23019cbc00ee3b318d0195
parent2e3d79550d9eb09eec4d17720d37ea388e0277ce (diff)
downloadbuildstream-bschubert/optimize-variables.tar.gz
fixup! fixup! fixup! fixup! WIP: _yaml: reimplement using cython for performancebschubert/optimize-variables
-rw-r--r--buildstream/_yaml.pyx13
-rw-r--r--setup.cfg2
2 files changed, 8 insertions, 7 deletions
diff --git a/buildstream/_yaml.pyx b/buildstream/_yaml.pyx
index 374a69782..4e419921d 100644
--- a/buildstream/_yaml.pyx
+++ b/buildstream/_yaml.pyx
@@ -304,7 +304,9 @@ cdef class Representer:
#
# Raises: LoadError
#
-def load(filename, shortname=None, copy_tree=False, *, project=None):
+def load(str filename, shortname=None, bint copy_tree=False, *, project=None):
+ cdef str displayname
+
if not shortname:
shortname = filename
@@ -313,7 +315,7 @@ def load(filename, shortname=None, copy_tree=False, *, project=None):
else:
displayname = shortname
- file_number = len(_FILE_LIST)
+ cdef int file_number = len(_FILE_LIST)
_FILE_LIST.append((filename, shortname, displayname, None, project))
try:
@@ -334,9 +336,6 @@ def load(filename, shortname=None, copy_tree=False, *, project=None):
"{} is a directory. bst command expects a .bst file."
.format(filename)) from e
except LoadError as e:
- print("ERROR HERE", e)
- import traceback
- traceback.print_exc()
raise LoadError(e.reason, "{}: {}".format(displayname, e)) from e
@@ -529,7 +528,9 @@ cdef object _node_get(Node node, object expected_type, str key, object indices,
cdef list __trim_list_provenance(list value):
- ret = []
+ cdef list ret = []
+ cdef object entry
+
for entry in value:
if type(entry) is not Node:
entry = Node(entry, None, 0, 0)
diff --git a/setup.cfg b/setup.cfg
index efdca7091..711d0a520 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -11,7 +11,7 @@ parentdir_prefix = BuildStream-
test=pytest
[tool:pytest]
-addopts = --verbose --basetemp ./tmp --durations=20
+addopts = --verbose --basetemp /workspace/pytest --durations=20
norecursedirs = tests/integration/project integration-cache tmp __pycache__ .eggs
python_files = tests/*/*.py
env =