From 72948f9230a075b0ad7a8d2a3f971fb8b7e3cbd7 Mon Sep 17 00:00:00 2001 From: fandehui Date: Wed, 27 Dec 2023 10:46:51 +0800 Subject: [PATCH] Add a decoder implementing the `toml-test` protocol Signed-off-by: fandehui --- ...-implementing-the-toml-test-protocol.patch | 41 +++++++++++++++++++ python-pytoml.spec | 4 ++ 2 files changed, 45 insertions(+) create mode 100644 Add-a-decoder-implementing-the-toml-test-protocol.patch diff --git a/Add-a-decoder-implementing-the-toml-test-protocol.patch b/Add-a-decoder-implementing-the-toml-test-protocol.patch new file mode 100644 index 0000000..9fcf1f6 --- /dev/null +++ b/Add-a-decoder-implementing-the-toml-test-protocol.patch @@ -0,0 +1,41 @@ +From f527cd48a3e6232ace55a3e76a2f413eeca04242 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Vejn=C3=A1r?= +Date: Sun, 28 Oct 2018 13:29:01 +0100 +Subject: [PATCH] Add a decoder implementing the `toml-test` protocol + +--- + test/decoder.py | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + create mode 100644 test/decoder.py + +diff --git a/test/decoder.py b/test/decoder.py +new file mode 100644 +index 0000000..26efe79 +--- /dev/null ++++ b/test/decoder.py +@@ -0,0 +1,22 @@ ++#!/usr/bin/env python ++ ++import argparse ++import json ++import pytoml ++import sys ++ ++def _main(): ++ ap = argparse.ArgumentParser() ++ ap.add_argument('-i', '--input', type=argparse.FileType('r', encoding='utf-8')) ++ ap.add_argument('-o', '--output', type=argparse.FileType('w', encoding='utf-8'), default='-') ++ args = ap.parse_args() ++ ++ if not args.input: ++ args.input = sys.stdin.buffer ++ ++ v = pytoml.load(args.input) ++ translated = pytoml.translate_to_test(v) ++ json.dump(translated, args.output) ++ ++if __name__ == '__main__': ++ _main() +-- +2.42.0.windows.2 + diff --git a/python-pytoml.spec b/python-pytoml.spec index 5439d43..b827b18 100644 --- a/python-pytoml.spec +++ b/python-pytoml.spec @@ -11,6 +11,7 @@ Patch0: Add-.vscode-and-.pytest_cache-to-.gitignore.patch Patch1: Fix-datetime-serialization.patch Patch2: Reject-invalid-escapes-in-strings.patch Patch3: Avoid-annoying-SystemExit-breaks-in-vscode.patch +Patch4: Add-a-decoder-implementing-the-toml-test-protocol.patch BuildArch: noarch %global my_description \ @@ -64,6 +65,9 @@ BuildRequires: python3-setuptools %{python3_sitelib}/%{github_name}/ %changelog +* Wed Dec 27 2023 fandehui - 0.1.18-7 +- Add a decoder implementing the `toml-test` protocol + * Mon Dec 11 2023 fandehui - 0.1.18-6 - Avoid annoying SystemExit breaks in vscode