@@ -1320,6 +1320,7 @@ menu "External python modules"
source "package/python-rtoml/Config.in"
source "package/python-rtslib-fb/Config.in"
source "package/python-ruamel-yaml/Config.in"
+ source "package/python-ruamel-yaml-clib/Config.in"
source "package/python-s3transfer/Config.in"
source "package/python-scandir/Config.in"
source "package/python-scapy/Config.in"
new file mode 100644
@@ -0,0 +1,9 @@
+if BR2_PACKAGE_PYTHON_RUAMEL_YAML
+config BR2_PACKAGE_PYTHON_RUAMEL_YAML_CLIB
+ bool "python-ruamel-yaml-clib"
+ help
+ C version of reader, parser and emitter for ruamel.yaml
+ derived from libyaml
+
+ https://sourceforge.net/projects/ruamel-yaml/
+endif
new file mode 100644
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/ruamel.yaml.clib/json
+md5 b72e549363fa1b9c4f9123e98f2b46cc ruamel.yaml.clib-0.2.8.tar.gz
+sha256 beb2e0404003de9a4cab9753a8805a8fe9320ee6673136ed7f04255fe60bb512 ruamel.yaml.clib-0.2.8.tar.gz
+# Locally computed sha256 checksums
+sha256 5458f90e82366f660f956b3c929ba5f7a0efdb99a99a847e2f51f2020ffbe887 LICENSE
new file mode 100644
@@ -0,0 +1,16 @@
+################################################################################
+#
+# python-ruamel-yaml
+#
+################################################################################
+
+PYTHON_RUAMEL_YAML_CLIB_VERSION = 0.2.8
+PYTHON_RUAMEL_YAML_CLIB_SOURCE = ruamel.yaml.clib-$(PYTHON_RUAMEL_YAML_CLIB_VERSION).tar.gz
+PYTHON_RUAMEL_YAML_CLIB_SITE = https://files.pythonhosted.org/packages/46/ab/bab9eb1566cd16f060b54055dd39cf6a34bfa0240c53a7218c43e974295b
+PYTHON_RUAMEL_YAML_CLIB_SETUP_TYPE = setuptools
+PYTHON_RUAMEL_YAML_CLIB_LICENSE = MIT
+PYTHON_RUAMEL_YAML_CLIB_LICENSE_FILES = LICENSE
+PYTHON_RUAMEL_YAML_CLIB_CPE_ID_VENDOR = ruamel.yaml_project
+PYTHON_RUAMEL_YAML_CLIB_CPE_ID_PRODUCT = ruamel.yaml
+
+$(eval $(python-package))
@@ -25,3 +25,15 @@ parsed = yaml.load(yaml_text)
assert parsed['OneMoreRootKey'] == 9.99
assert parsed['ListRoot'][1]['another-int'] == 1111
+
+# Tests the C extension based loader
+# ruamel.yaml automatically falls back to the pure python version, so we need
+# to explicitly check if importing the CLoader works here.
+# Import this here, so it's clearer what part of the test is failing.
+from ruamel.yaml import CLoader # noqa: E402
+assert CLoader is not None
+yaml = YAML(typ='safe')
+parsed_from_c = yaml.load(yaml_text)
+
+assert parsed_from_c['OneMoreRootKey'] == 9.99
+assert parsed_from_c['ListRoot'][1]['another-int'] == 1111
@@ -7,6 +7,7 @@ class TestPythonPy3RuamelYaml(TestPythonPackageBase):
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_RUAMEL_YAML=y
+ BR2_PACKAGE_PYTHON_RUAMEL_YAML_CLIB=y
"""
sample_scripts = ["tests/package/sample_python_ruamel_yaml.py"]
timeout = 40
Add optional c extension for python-ruamel-yaml which can speed up yaml loading/parsing. Extend the ruamel-yaml runtime test to check if the c extension works correctly. Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu> --- package/Config.in | 1 + package/python-ruamel-yaml-clib/Config.in | 9 +++++++++ .../python-ruamel-yaml-clib.hash | 5 +++++ .../python-ruamel-yaml-clib.mk | 16 ++++++++++++++++ .../tests/package/sample_python_ruamel_yaml.py | 12 ++++++++++++ .../tests/package/test_python_ruamel_yaml.py | 1 + 6 files changed, 44 insertions(+) create mode 100644 package/python-ruamel-yaml-clib/Config.in create mode 100644 package/python-ruamel-yaml-clib/python-ruamel-yaml-clib.hash create mode 100644 package/python-ruamel-yaml-clib/python-ruamel-yaml-clib.mk