mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-01 06:21:56 -09:00
package/python-rtoml: new package
Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
cc6e9231c8
commit
d21d3900bf
@@ -1375,6 +1375,7 @@ F: package/python-pycares/
|
|||||||
F: package/python-pydyf/
|
F: package/python-pydyf/
|
||||||
F: package/python-pypa-build/
|
F: package/python-pypa-build/
|
||||||
F: package/python-pyphen/
|
F: package/python-pyphen/
|
||||||
|
F: package/python-rtoml/
|
||||||
F: package/python-snappy/
|
F: package/python-snappy/
|
||||||
F: package/python-sockjs/
|
F: package/python-sockjs/
|
||||||
F: package/python-terminaltables/
|
F: package/python-terminaltables/
|
||||||
@@ -1389,6 +1390,8 @@ F: package/serd/
|
|||||||
F: package/sord/
|
F: package/sord/
|
||||||
F: package/sratom/
|
F: package/sratom/
|
||||||
F: package/zchunk/
|
F: package/zchunk/
|
||||||
|
F: support/testing/tests/package/sample_python_rtoml.py
|
||||||
|
F: support/testing/tests/package/test_python_rtoml.py
|
||||||
|
|
||||||
N: James Knight <james.knight@collins.com>
|
N: James Knight <james.knight@collins.com>
|
||||||
F: package/atkmm/
|
F: package/atkmm/
|
||||||
|
|||||||
@@ -1223,6 +1223,7 @@ menu "External python modules"
|
|||||||
source "package/python-rpi-gpio/Config.in"
|
source "package/python-rpi-gpio/Config.in"
|
||||||
source "package/python-rpi-ws281x/Config.in"
|
source "package/python-rpi-ws281x/Config.in"
|
||||||
source "package/python-rsa/Config.in"
|
source "package/python-rsa/Config.in"
|
||||||
|
source "package/python-rtoml/Config.in"
|
||||||
source "package/python-rtslib-fb/Config.in"
|
source "package/python-rtslib-fb/Config.in"
|
||||||
source "package/python-ruamel-yaml/Config.in"
|
source "package/python-ruamel-yaml/Config.in"
|
||||||
source "package/python-s3transfer/Config.in"
|
source "package/python-s3transfer/Config.in"
|
||||||
|
|||||||
7
package/python-rtoml/Config.in
Normal file
7
package/python-rtoml/Config.in
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
config BR2_PACKAGE_PYTHON_RTOML
|
||||||
|
bool "python-rtoml"
|
||||||
|
depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
|
||||||
|
help
|
||||||
|
A better TOML library for python implemented in rust.
|
||||||
|
|
||||||
|
https://github.com/samuelcolvin/rtoml
|
||||||
4
package/python-rtoml/python-rtoml.hash
Normal file
4
package/python-rtoml/python-rtoml.hash
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Locally calculated after vendoring
|
||||||
|
sha256 821a430ab6587bdaaf7cb95044e8e0d99c77c6aed0adce5a370045b270f7ee20 rtoml-0.8.0.tar.gz
|
||||||
|
# Locally computed sha256 checksums
|
||||||
|
sha256 cd5ffde80e6d3286a2e2e5f02fb2cb07b823931ca368e7c735a6c5f5aebe7103 LICENSE
|
||||||
22
package/python-rtoml/python-rtoml.mk
Normal file
22
package/python-rtoml/python-rtoml.mk
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# python-rtoml
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
PYTHON_RTOML_VERSION = 0.8.0
|
||||||
|
PYTHON_RTOML_SOURCE = rtoml-$(PYTHON_RTOML_VERSION).tar.gz
|
||||||
|
PYTHON_RTOML_SITE = https://files.pythonhosted.org/packages/33/a6/b42d8e0e28bec9fd7fdbafb2d76db3f8578f151a669eba564d422756d909
|
||||||
|
PYTHON_RTOML_SETUP_TYPE = setuptools
|
||||||
|
PYTHON_RTOML_LICENSE = MIT
|
||||||
|
PYTHON_RTOML_LICENSE_FILES = LICENSE
|
||||||
|
PYTHON_RTOML_DEPENDENCIES = host-python-setuptools-rust host-rustc
|
||||||
|
PYTHON_RTOML_ENV = \
|
||||||
|
$(PKG_CARGO_ENV) \
|
||||||
|
PYO3_CROSS_LIB_DIR="$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)"
|
||||||
|
# We need to vendor the Cargo crates at download time
|
||||||
|
PYTHON_RTOML_DOWNLOAD_POST_PROCESS = cargo
|
||||||
|
PYTHON_RTOML_DOWNLOAD_DEPENDENCIES = host-rustc
|
||||||
|
PYTHON_RTOML_DL_ENV = $(PKG_CARGO_ENV)
|
||||||
|
|
||||||
|
$(eval $(python-package))
|
||||||
48
support/testing/tests/package/sample_python_rtoml.py
Normal file
48
support/testing/tests/package/sample_python_rtoml.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
from datetime import datetime, timezone, timedelta
|
||||||
|
import rtoml
|
||||||
|
|
||||||
|
obj = {
|
||||||
|
'title': 'TOML Example',
|
||||||
|
'owner': {
|
||||||
|
'dob': datetime(1979, 5, 27, 7, 32, tzinfo=timezone(timedelta(hours=-8))),
|
||||||
|
'name': 'Tom Preston-Werner',
|
||||||
|
},
|
||||||
|
'database': {
|
||||||
|
'connection_max': 5000,
|
||||||
|
'enabled': True,
|
||||||
|
'ports': [8001, 8001, 8002],
|
||||||
|
'server': '192.168.1.1',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
loaded_obj = rtoml.load("""\
|
||||||
|
# This is a TOML document.
|
||||||
|
|
||||||
|
title = "TOML Example"
|
||||||
|
|
||||||
|
[owner]
|
||||||
|
name = "Tom Preston-Werner"
|
||||||
|
dob = 1979-05-27T07:32:00-08:00 # First class dates
|
||||||
|
|
||||||
|
[database]
|
||||||
|
server = "192.168.1.1"
|
||||||
|
ports = [8001, 8001, 8002]
|
||||||
|
connection_max = 5000
|
||||||
|
enabled = true
|
||||||
|
""")
|
||||||
|
|
||||||
|
assert loaded_obj == obj
|
||||||
|
|
||||||
|
assert rtoml.dumps(obj) == """\
|
||||||
|
title = "TOML Example"
|
||||||
|
|
||||||
|
[owner]
|
||||||
|
dob = 1979-05-27T07:32:00-08:00
|
||||||
|
name = "Tom Preston-Werner"
|
||||||
|
|
||||||
|
[database]
|
||||||
|
connection_max = 5000
|
||||||
|
enabled = true
|
||||||
|
server = "192.168.1.1"
|
||||||
|
ports = [8001, 8001, 8002]
|
||||||
|
"""
|
||||||
28
support/testing/tests/package/test_python_rtoml.py
Normal file
28
support/testing/tests/package/test_python_rtoml.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
from tests.package.test_python import TestPythonPackageBase
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class TestPythonPy3rtoml(TestPythonPackageBase):
|
||||||
|
__test__ = True
|
||||||
|
config = \
|
||||||
|
"""
|
||||||
|
BR2_arm=y
|
||||||
|
BR2_cortex_a9=y
|
||||||
|
BR2_ARM_ENABLE_NEON=y
|
||||||
|
BR2_ARM_ENABLE_VFP=y
|
||||||
|
BR2_TOOLCHAIN_EXTERNAL=y
|
||||||
|
BR2_PACKAGE_PYTHON3=y
|
||||||
|
BR2_PACKAGE_PYTHON_RTOML=y
|
||||||
|
BR2_TARGET_ROOTFS_CPIO=y
|
||||||
|
# BR2_TARGET_ROOTFS_TAR is not set
|
||||||
|
"""
|
||||||
|
sample_scripts = ["tests/package/sample_python_rtoml.py"]
|
||||||
|
timeout = 30
|
||||||
|
|
||||||
|
def login(self):
|
||||||
|
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||||
|
self.emulator.boot(arch="armv7",
|
||||||
|
kernel="builtin",
|
||||||
|
options=["-initrd", cpio_file])
|
||||||
|
self.emulator.login()
|
||||||
Reference in New Issue
Block a user