Skip to contentSkip to conversation

vendor.txt: add tomli

PATCH New Ross Burton 1 participant 2 messages Sep 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 vendor.txt: add tomli

tomli is the standalone TOML parser that became tomllib in Python 3.11.

Add it to the vendored libraries so that bitbake/OE can always have a TOML parser. When bitbake depends on 3.11 onwards, this can be dropped.

TOML is increasingly used as a sensible configuration file format, for example Python's pyproject.toml and Rust's Cargo.toml. Currently OE has code to parse Cargo.toml with a nested nativepython3, and pyproject.toml with regular expressions. By vendoring tomli into bitbake we can just import it directly and use it without needing to use nativepython3:

try:
import tomllib
except ImportError
import bb._vendor.tomli as tomllib

---
 vendor.txt | 1 +
 1 file changed, 1 insertion(+)
vendor.txt +1 -0
index 6ce8846c8c..8d5dcad77e 100644
@@ -3,3 +3,4 @@ ply==3.10
 progressbar==2.5
 simplediff==1.1
 typing_extensions==4.15.0
+tomli==2.4.1
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 lib/bb/_vendor: resync to add tomli

---
 lib/bb/_vendor/tomli/LICENSE     |  21 +
 lib/bb/_vendor/tomli/__init__.py |   8 +
 lib/bb/_vendor/tomli/_parser.py  | 793 +++++++++++++++++++++++++++++++
 lib/bb/_vendor/tomli/_re.py      | 119 +++++
 lib/bb/_vendor/tomli/_types.py   |  10 +
 lib/bb/_vendor/tomli/py.typed    |   1 +
 6 files changed, 952 insertions(+)
 create mode 100644 lib/bb/_vendor/tomli/LICENSE
 create mode 100644 lib/bb/_vendor/tomli/__init__.py
 create mode 100644 lib/bb/_vendor/tomli/_parser.py
 create mode 100644 lib/bb/_vendor/tomli/_re.py
 create mode 100644 lib/bb/_vendor/tomli/_types.py
 create mode 100644 lib/bb/_vendor/tomli/py.typed
lib/bb/_vendor/tomli/LICENSE new file +21 -0
new file mode 100644
index 0000000000..e859590f88
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 Taneli Hukkinen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
lib/bb/_vendor/tomli/__init__.py new file +8 -0
new file mode 100644
index 0000000000..ebe9001309
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: MIT
+# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
+# Licensed to PSF under a Contributor Agreement.
+
+__all__ = ("loads", "load", "TOMLDecodeError")
+__version__ = "2.4.1"  # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
+
+from ._parser import TOMLDecodeError, load, loads
lib/bb/_vendor/tomli/_parser.py new file +793 -0

793 lines not on this page · raw message

lib/bb/_vendor/tomli/_re.py new file +119 -0

119 lines not on this page · raw message

lib/bb/_vendor/tomli/_types.py new file +10 -0
new file mode 100644
index 0000000000..d949412e03
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: MIT
+# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
+# Licensed to PSF under a Contributor Agreement.
+
+from typing import Any, Callable, Tuple
+
+# Type annotations
+ParseFloat = Callable[[str], Any]
+Key = Tuple[str, ...]
+Pos = int
lib/bb/_vendor/tomli/py.typed new file +1 -0
new file mode 100644
index 0000000000..7632ecf775
@@ -0,0 +1 @@
+# Marker file for PEP 561
Signature · 1 line
2.43.0