Skip to content

Commit fb722fe

Browse files
committed
cargo: Repleace unmaintained toml with tomlkit
Closes #480
1 parent 5c5a6de commit fb722fe

File tree

4 files changed

+20
-33
lines changed

4 files changed

+20
-33
lines changed

cargo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Tool to automatically generate `flatpak-builder` manifest json from a `Cargo.loc
77
Poetry users can run `poetry install` and skip this.
88

99
Otherwise install Python 3.8+ with these modules:
10-
- toml
10+
- tomlkit
1111
- aiohttp
1212
- (Optional) PyYAML>=6.0.2 for YAML output instead of JSON
1313

cargo/flatpak-cargo-generator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from urllib.parse import ParseResult, parse_qs, urlparse
2525

2626
import aiohttp
27-
import toml
27+
import tomlkit
2828

2929
try:
3030
import yaml
@@ -112,7 +112,7 @@ async def get_remote_sha256(url: str) -> str:
112112

113113
def load_toml(tomlfile: str = "Cargo.lock") -> _TomlType:
114114
with open(tomlfile, "r", encoding="utf-8") as f:
115-
toml_data = toml.load(f)
115+
toml_data = tomlkit.parse(f.read())
116116
return toml_data
117117

118118

@@ -348,7 +348,7 @@ async def get_git_package_sources(
348348
},
349349
{
350350
"type": "inline",
351-
"contents": toml.dumps(git_pkg.normalized),
351+
"contents": tomlkit.dumps(git_pkg.normalized),
352352
"dest": f"{CARGO_CRATES}/{name}", # -{version}',
353353
"dest-filename": "Cargo.toml",
354354
},
@@ -445,7 +445,7 @@ async def generate_sources(
445445
sources.append(
446446
{
447447
"type": "inline",
448-
"contents": toml.dumps(
448+
"contents": tomlkit.dumps(
449449
{
450450
"source": cargo_vendored_sources,
451451
}

cargo/poetry.lock

Lines changed: 14 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cargo/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ readme = "README.md"
1010
requires-python = "<4.0,>=3.9"
1111
dependencies = [
1212
"aiohttp<4.0.0,>=3.9.5",
13-
"toml<1.0.0,>=0.10.2",
1413
"PyYAML<7.0.0,>=6.0.2",
14+
"tomlkit>=0.13.3,<1.0"
1515
]
1616

1717
[tool.poetry.group.dev.dependencies]
1818
ruff = "^0.6.7"
1919
mypy = "^1.11.2"
20-
types-toml = "^0.10.8"
2120
types-pyyaml = "^6.0.12"
2221

2322
[tool.ruff]

0 commit comments

Comments
 (0)