mirror of
https://github.com/pentoo/pentoo-overlay
synced 2025-12-06 00:16:22 +01:00
2173 lines
82 KiB
Diff
2173 lines
82 KiB
Diff
From 3e1871f11d239e7a63abdb22dd2752b3ce973a1b Mon Sep 17 00:00:00 2001
|
|
From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
|
|
Date: Mon, 10 Nov 2025 20:25:39 +0200
|
|
Subject: [PATCH] Add OSMOCOM pySim and its dependencies
|
|
|
|
Add ebuild for pySim tool [1] and all its dependencies unavailable from
|
|
the main repository.
|
|
|
|
There are no fresh pySim release, so, ebuild installs latest available
|
|
version from the repository. ATM, this is commit 94811ab ("pySim-shell:
|
|
allow user friendly selection of the pin type").
|
|
|
|
All tests runs smoothly except some of asn1tools: some pyparsing tests
|
|
have been removed due to extreme sensitivity to the exception messages,
|
|
C/Rust code generation tests have been removed due to compilation
|
|
complexity, and, finally, some command line utility tests have been
|
|
disabled due to a strange PromptSession issue which I do not want to fix
|
|
now.
|
|
|
|
The most debatable ebuild here is asn1tools-osmocom. Essentially it is
|
|
asn1tools-0.166.0 plus one change making SET and SEQUENCE ordered [2].
|
|
It is unclear what side-effects can come with this change and why
|
|
OSMOCOM folks have choosen the custom fork path. We have a few options
|
|
here, like collaborate with upstream to push the change there, manually
|
|
patch existing asn1tools, etc. I have created a dedicated ebuild for
|
|
OSMOCOM fork to keep things simple at this specific moment. Then we can
|
|
see does it work and have time to talk to upstream/OSMOCOM to streamline
|
|
the ebuilds tree.
|
|
|
|
1. https://osmocom.org/projects/pysim/wiki
|
|
2. https://github.com/osmocom/asn1tools/commit/44277cdb34959196f317b6a02af20a4a1c3c4e2d
|
|
---
|
|
dev-python/asn1tools-osmocom/Manifest | 5 +
|
|
.../asn1tools-osmocom-0.166.0.ebuild | 37 +
|
|
....0-disable-pyparsing-sensitive-tests.patch | 158 ++
|
|
...md-tests-due-to-PromptSession-issues.patch | 158 ++
|
|
...sn1tools-0.166.0-remove-c-rust-tests.patch | 1296 +++++++++++++++++
|
|
dev-python/gsm0338/Manifest | 2 +
|
|
dev-python/gsm0338/gsm0338-1.1.0.ebuild | 24 +
|
|
dev-python/pycryptodomex/Manifest | 2 +
|
|
.../pycryptodomex/pycryptodomex-3.23.0.ebuild | 23 +
|
|
dev-python/pyosmocom/Manifest | 2 +
|
|
dev-python/pyosmocom/pyosmocom-0.0.9.ebuild | 29 +
|
|
dev-python/pytlv/Manifest | 2 +
|
|
dev-python/pytlv/pytlv-0.71.ebuild | 22 +
|
|
dev-python/smpp-pdu-hologramio/Manifest | 3 +
|
|
.../smpp.pdu-0.3-drop-pkgutil-namespace.patch | 41 +
|
|
.../smpp-pdu-hologramio-0.3.ebuild | 30 +
|
|
dev-python/smpp-twisted3/Manifest | 3 +
|
|
....twisted3-0.8-drop-pkgutil-namespace.patch | 42 +
|
|
.../smpp-twisted3/smpp-twisted3-0.8.ebuild | 41 +
|
|
sys-apps/pysim/Manifest | 1 +
|
|
sys-apps/pysim/pysim-9999.ebuild | 50 +
|
|
21 files changed, 1971 insertions(+)
|
|
create mode 100644 dev-python/asn1tools-osmocom/Manifest
|
|
create mode 100644 dev-python/asn1tools-osmocom/asn1tools-osmocom-0.166.0.ebuild
|
|
create mode 100644 dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-disable-pyparsing-sensitive-tests.patch
|
|
create mode 100644 dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-disable-shell-cmd-tests-due-to-PromptSession-issues.patch
|
|
create mode 100644 dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-remove-c-rust-tests.patch
|
|
create mode 100644 dev-python/gsm0338/Manifest
|
|
create mode 100644 dev-python/gsm0338/gsm0338-1.1.0.ebuild
|
|
create mode 100644 dev-python/pycryptodomex/Manifest
|
|
create mode 100644 dev-python/pycryptodomex/pycryptodomex-3.23.0.ebuild
|
|
create mode 100644 dev-python/pyosmocom/Manifest
|
|
create mode 100644 dev-python/pyosmocom/pyosmocom-0.0.9.ebuild
|
|
create mode 100644 dev-python/pytlv/Manifest
|
|
create mode 100644 dev-python/pytlv/pytlv-0.71.ebuild
|
|
create mode 100644 dev-python/smpp-pdu-hologramio/Manifest
|
|
create mode 100644 dev-python/smpp-pdu-hologramio/files/smpp.pdu-0.3-drop-pkgutil-namespace.patch
|
|
create mode 100644 dev-python/smpp-pdu-hologramio/smpp-pdu-hologramio-0.3.ebuild
|
|
create mode 100644 dev-python/smpp-twisted3/Manifest
|
|
create mode 100644 dev-python/smpp-twisted3/files/smpp.twisted3-0.8-drop-pkgutil-namespace.patch
|
|
create mode 100644 dev-python/smpp-twisted3/smpp-twisted3-0.8.ebuild
|
|
create mode 100644 sys-apps/pysim/Manifest
|
|
create mode 100644 sys-apps/pysim/pysim-9999.ebuild
|
|
|
|
diff --git a/dev-python/asn1tools-osmocom/Manifest b/dev-python/asn1tools-osmocom/Manifest
|
|
new file mode 100644
|
|
index 0000000000..c7a637e220
|
|
--- /dev/null
|
|
+++ b/dev-python/asn1tools-osmocom/Manifest
|
|
@@ -0,0 +1,5 @@
|
|
+AUX asn1tools-0.166.0-disable-pyparsing-sensitive-tests.patch 7015 BLAKE2B 69eb2b8f2d4f42b9e81a2b76f7a37fe2d9c9aececf6f058452106006979c28e2a7f9f4b4fb938b643b724f8d1438619003dfb1b425c8a68f995994c8da908423 SHA512 ed279abad313b7b543a50e52e94e3de5f334186387970287e9113bcdd86ff687382e70e0b73bfa769311d16aeeb7f79b1914c1b6904f5ef007e39008338de62e
|
|
+AUX asn1tools-0.166.0-disable-shell-cmd-tests-due-to-PromptSession-issues.patch 4585 BLAKE2B 78ffb841948cf609c4ddeeb9b7d2ffc0f26691e39def903103b34a522a7358cb603c0d39854a00f44824db927d3e1d228c00e5ad18d0384d0f60dbd2a5190dee SHA512 eb9e87987deb1a78aaf808b1164d6c9537bd78498c3e529ab5de082b769da4f8ec172f0a36446524664d19426cc5956bf5b5fd20e2dea172b40956178c58ce05
|
|
+AUX asn1tools-0.166.0-remove-c-rust-tests.patch 45295 BLAKE2B f8440a4d4be162c20978d61f188d4a5c44a131e69fb36064fdaf8bd19d17d32a52c86d002d1e69e24cfeb0d9e905100e096725ed14e159dae7dc3f08cd12dfde SHA512 58340bde4ab1fbc77a83747b694bcbd23325d7cf78cd3d703b4a23a4f3ecc5bf5ebe9806b4f631746f9f01db8d5b4e02e37e49d5e42077995a4854766c42af83
|
|
+DIST asn1tools-osmocom-0.166.0.gh.tar.gz 1123425 BLAKE2B 822608ce8cece89a4b1d224a521938f2a30b5ffe9f4903a1af40c327d2b3c118e9fcbb676792530038344cc6148466cd79e6cd6b3d3d33a2d3adf6129ea692f1 SHA512 70146c1d2b9a045b10992e0ecc409c15e0088dc1c6cb4747ccf10dad18a69ce906241037b7cfa1ddd3b9a910b7b532c3b23a7b9ca95f895803fa868c7444886b
|
|
+EBUILD asn1tools-osmocom-0.166.0.ebuild 1017 BLAKE2B 688ec56f1e26fc6530a954d3b704649c022744750ebc06b71762fa230d324552597a0f5a7d443c66f9e3738b96ae248cd049b7d057153ab093f7605351f4c20d SHA512 f06b9e3d38f78d0afd5ba2b763c48b3d7289238f9565cb6434782e8b20c0e95add8200a7adba7b7c1446ec3ed04453f9171578be2724f49e01a1d4bc1f8e0a41
|
|
diff --git a/dev-python/asn1tools-osmocom/asn1tools-osmocom-0.166.0.ebuild b/dev-python/asn1tools-osmocom/asn1tools-osmocom-0.166.0.ebuild
|
|
new file mode 100644
|
|
index 0000000000..767a116d90
|
|
--- /dev/null
|
|
+++ b/dev-python/asn1tools-osmocom/asn1tools-osmocom-0.166.0.ebuild
|
|
@@ -0,0 +1,37 @@
|
|
+EAPI=8
|
|
+
|
|
+DISTUTILS_USE_PEP517=setuptools
|
|
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
|
|
+
|
|
+inherit distutils-r1
|
|
+
|
|
+MY_PN="asn1tools"
|
|
+MY_COMMIT="44277cdb34959196f317b6a02af20a4a1c3c4e2d"
|
|
+DESCRIPTION="ASN.1 parsing, encoding and decoding - OSMOCOM patched"
|
|
+HOMEPAGE="https://github.com/osmocom/asn1tools"
|
|
+SRC_URI="https://github.com/osmocom/${MY_PN}/archive/${MY_COMMIT}.tar.gz -> ${P}.gh.tar.gz"
|
|
+S="${WORKDIR}/${MY_PN}-${MY_COMMIT}"
|
|
+
|
|
+LICENSE="MIT"
|
|
+SLOT="0"
|
|
+KEYWORDS="~amd64"
|
|
+
|
|
+RDEPEND="
|
|
+ !dev-python/asn1tools
|
|
+ >=dev-python/pyparsing-3.0.6[${PYTHON_USEDEP}]
|
|
+ dev-python/bitstruct[${PYTHON_USEDEP}]
|
|
+ dev-python/diskcache[${PYTHON_USEDEP}]
|
|
+"
|
|
+
|
|
+PATCHES=(
|
|
+ "${FILESDIR}/asn1tools-0.166.0-remove-c-rust-tests.patch"
|
|
+ "${FILESDIR}/asn1tools-0.166.0-disable-pyparsing-sensitive-tests.patch"
|
|
+ "${FILESDIR}/asn1tools-0.166.0-disable-shell-cmd-tests-due-to-PromptSession-issues.patch"
|
|
+)
|
|
+
|
|
+distutils_enable_tests unittest
|
|
+
|
|
+python_test() {
|
|
+ local tests=$(find tests -name "test_*.py")
|
|
+ "${EPYTHON}" -m unittest -v $tests || die -n "Tests failed with ${EPYTHON}"
|
|
+}
|
|
diff --git a/dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-disable-pyparsing-sensitive-tests.patch b/dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-disable-pyparsing-sensitive-tests.patch
|
|
new file mode 100644
|
|
index 0000000000..7d82af5d84
|
|
--- /dev/null
|
|
+++ b/dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-disable-pyparsing-sensitive-tests.patch
|
|
@@ -0,0 +1,158 @@
|
|
+Disable tests that are too sensitive for pyparsing version. E.g. depends
|
|
+on the exception text string, etc.
|
|
+
|
|
+--- a/tests/test_compile.py
|
|
++++ b/tests/test_compile.py
|
|
+@@ -212,18 +212,6 @@ class Asn1ToolsCompileTest(unittest.TestCase):
|
|
+ "Parameterized type 'B' in module 'A' takes 2 parameters, "
|
|
+ "but 1 are given in type 'B-Integer' in module 'A'.")
|
|
+
|
|
+- def test_missing_parameterized_value(self):
|
|
+- with self.assertRaises(asn1tools.CompileError) as cm:
|
|
+- asn1tools.compile_string(
|
|
+- 'A DEFINITIONS ::= BEGIN'
|
|
+- ' A { a } ::= INTEGER (a..5) '
|
|
+- ' B ::= A { missing-value } '
|
|
+- 'END ',
|
|
+- 'uper')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Value 'missing-value' not found in module 'A'.")
|
|
+-
|
|
+
|
|
+ if __name__ == '__main__':
|
|
+ unittest.main()
|
|
+--- a/tests/test_parse.py
|
|
++++ b/tests/test_parse.py
|
|
+@@ -169,9 +169,6 @@ class Asn1ToolsParseTest(unittest.TestCase):
|
|
+ def test_parse_import_imported(self):
|
|
+ self.parse_and_verify('import_imported')
|
|
+
|
|
+- def test_parse_parameterization(self):
|
|
+- self.parse_and_verify('parameterization')
|
|
+-
|
|
+ def test_parse_imports_global_module_reference(self):
|
|
+ actual = asn1tools.parse_string('A DEFINITIONS ::= BEGIN '
|
|
+ 'IMPORTS '
|
|
+@@ -324,28 +321,6 @@ class Asn1ToolsParseTest(unittest.TestCase):
|
|
+ "'A DEFINITIONS ::= BEGIN a INTEGER >!<END': "
|
|
+ "Expected ::=.")
|
|
+
|
|
+- def test_parse_error_sequence_missing_type(self):
|
|
+- with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+- asn1tools.parse_string('A DEFINITIONS ::= BEGIN'
|
|
+- ' A ::= SEQUENCE { a } '
|
|
+- 'END')
|
|
+-
|
|
+- self.assertEqual(
|
|
+- str(cm.exception),
|
|
+- "Invalid ASN.1 syntax at line 1, column 43: 'A DEFINITIONS ::= BEGIN "
|
|
+- " A ::= SEQUENCE { >!<a } END': Expected Type.")
|
|
+-
|
|
+- def test_parse_error_sequence_missing_member_name(self):
|
|
+- with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+- asn1tools.parse_string('A DEFINITIONS ::= BEGIN'
|
|
+- ' A ::= SEQUENCE { A } '
|
|
+- 'END')
|
|
+-
|
|
+- self.assertEqual(
|
|
+- str(cm.exception),
|
|
+- "Invalid ASN.1 syntax at line 1, column 43: 'A DEFINITIONS ::= "
|
|
+- "BEGIN A ::= SEQUENCE { >!<A } END': Expected Type.")
|
|
+-
|
|
+ def test_parse_error_definitive_identifier(self):
|
|
+ with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+ asn1tools.parse_string('A {} DEFINITIONS ::= BEGIN '
|
|
+@@ -358,39 +333,6 @@ class Asn1ToolsParseTest(unittest.TestCase):
|
|
+ "definitiveNumberForm - Suppress:(')')} | identifier | "
|
|
+ "definitiveNumberForm}.")
|
|
+
|
|
+- def test_parse_error_missing_union_member_beginning(self):
|
|
+- with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+- asn1tools.parse_string('A DEFINITIONS ::= BEGIN '
|
|
+- 'B ::= INTEGER (| SIZE (1))'
|
|
+- 'END')
|
|
+-
|
|
+- self.assertEqual(
|
|
+- str(cm.exception),
|
|
+- "Invalid ASN.1 syntax at line 1, column 39: 'A DEFINITIONS ::= BEGIN "
|
|
+- "B ::= INTEGER >!<(| SIZE (1))END': Expected END.")
|
|
+-
|
|
+- def test_parse_error_missing_union_member_middle(self):
|
|
+- with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+- asn1tools.parse_string('A DEFINITIONS ::= BEGIN '
|
|
+- 'B ::= INTEGER (SIZE (1) | | (0))'
|
|
+- 'END')
|
|
+-
|
|
+- self.assertEqual(
|
|
+- str(cm.exception),
|
|
+- "Invalid ASN.1 syntax at line 1, column 39: \'A DEFINITIONS "
|
|
+- "::= BEGIN B ::= INTEGER >!<(SIZE (1) | | (0))END\': Expected END.")
|
|
+-
|
|
+- def test_parse_error_missing_union_member_end(self):
|
|
+- with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+- asn1tools.parse_string('A DEFINITIONS ::= BEGIN '
|
|
+- 'B ::= INTEGER (SIZE (1) |)'
|
|
+- 'END')
|
|
+-
|
|
+- self.assertEqual(
|
|
+- str(cm.exception),
|
|
+- "Invalid ASN.1 syntax at line 1, column 39: \'A DEFINITIONS "
|
|
+- "::= BEGIN B ::= INTEGER >!<(SIZE (1) |)END\': Expected END.")
|
|
+-
|
|
+ def test_parse_error_size_constraint_missing_parentheses(self):
|
|
+ with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+ asn1tools.parse_string('A DEFINITIONS ::= BEGIN '
|
|
+@@ -446,49 +388,6 @@ class Asn1ToolsParseTest(unittest.TestCase):
|
|
+ "Invalid ASN.1 syntax at line 3, column 11: "
|
|
+ "'::= BEGIN >!<': Expected END.")
|
|
+
|
|
+- def test_parse_error_late_extension_additions(self):
|
|
+- with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+- asn1tools.parse_string('A DEFINITIONS ::= BEGIN '
|
|
+- 'Foo ::= SEQUENCE { '
|
|
+- 'a BOOLEAN, '
|
|
+- '..., '
|
|
+- '..., '
|
|
+- '[[ '
|
|
+- 'c BOOLEAN '
|
|
+- ']] '
|
|
+- '} '
|
|
+- 'END')
|
|
+-
|
|
+- self.assertEqual(
|
|
+- str(cm.exception),
|
|
+- "Invalid ASN.1 syntax at line 1, column 63: \'A DEFINITIONS ::= "
|
|
+- "BEGIN Foo ::= SEQUENCE { a BOOLEAN, ..., ...>!<, [[ c BOOLEAN ]] "
|
|
+- "} END\': Expected Type.")
|
|
+-
|
|
+- def test_parse_error_too_many_extension_markers(self):
|
|
+- with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+- asn1tools.parse_string('A DEFINITIONS ::= BEGIN '
|
|
+- 'Foo ::= SEQUENCE { '
|
|
+- 'a BOOLEAN, '
|
|
+- '..., '
|
|
+- '[[ '
|
|
+- 'b BOOLEAN '
|
|
+- ']], '
|
|
+- '[[ '
|
|
+- 'c BOOLEAN '
|
|
+- ']], '
|
|
+- '..., '
|
|
+- 'd BOOLEAN, '
|
|
+- '... '
|
|
+- '} '
|
|
+- 'END')
|
|
+-
|
|
+- self.assertEqual(
|
|
+- str(cm.exception),
|
|
+- "Invalid ASN.1 syntax at line 1, column 108: \'A DEFINITIONS ::= "
|
|
+- "BEGIN Foo ::= SEQUENCE { a BOOLEAN, ..., [[ b BOOLEAN ]], [[ c "
|
|
+- "BOOLEAN ]], ..., d BOOLEAN>!<, ... } END\': Expected Type.")
|
|
+-
|
|
+ def test_parse_error_missing_single_line_comment_end(self):
|
|
+ with self.assertRaises(asn1tools.ParseError) as cm:
|
|
+ asn1tools.parse_string('A DEFINITIONS ::= \n'
|
|
+--
|
|
+2.51.0
|
|
+
|
|
diff --git a/dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-disable-shell-cmd-tests-due-to-PromptSession-issues.patch b/dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-disable-shell-cmd-tests-due-to-PromptSession-issues.patch
|
|
new file mode 100644
|
|
index 0000000000..763fe6fbcd
|
|
--- /dev/null
|
|
+++ b/dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-disable-shell-cmd-tests-due-to-PromptSession-issues.patch
|
|
@@ -0,0 +1,158 @@
|
|
+From e6a5b4c00dcd5d18d7d11cb0092c3d2c2d5a1c27 Mon Sep 17 00:00:00 2001
|
|
+From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
|
|
+Date: Sun, 9 Nov 2025 15:08:46 +0200
|
|
+Subject: [PATCH 3/3] Disable 'shell' cmd tests due to PromptSession issues
|
|
+
|
|
+---
|
|
+ tests/test_command_line.py | 135 -------------------------------------
|
|
+ 1 file changed, 135 deletions(-)
|
|
+
|
|
+diff --git a/tests/test_command_line.py b/tests/test_command_line.py
|
|
+index f5f6cc0..d3b6664 100644
|
|
+--- a/tests/test_command_line.py
|
|
++++ b/tests/test_command_line.py
|
|
+@@ -505,141 +505,6 @@ ff0e0201011609497320312b313d333f
|
|
+ str(cm.exception),
|
|
+ "error: Expected one .py-file, but got 2.")
|
|
+
|
|
+- def test_command_line_shell(self):
|
|
+- argv = ['asn1tools', 'shell']
|
|
+- commands = StringIO('''\
|
|
+-help
|
|
+-compile tests/files/foo.asn
|
|
+-convert Question 300e0201011609497320312b313d333f
|
|
+-convert Foo 30
|
|
+-compile -i uper tests/files/foo.asn
|
|
+-convert Question 01010993cd03156c5eb37e
|
|
+-compile -i ber /x/y/missing
|
|
+-missing-command
|
|
+-exit
|
|
+-''')
|
|
+-
|
|
+- class PromptSession(object):
|
|
+-
|
|
+- def __init__(self, *_args, **_kwargs):
|
|
+- pass
|
|
+-
|
|
+- def prompt(*_args, **_kwargs):
|
|
+- return commands.readline()
|
|
+-
|
|
+- expected_output = (
|
|
+- '\n'
|
|
+- 'Welcome to the asn1tools shell!\n'
|
|
+- '\n'
|
|
+- "Commands:\n"
|
|
+- " compile\n"
|
|
+- " convert\n"
|
|
+- " exit\n"
|
|
+- " help\n"
|
|
+- 'question Question ::= {\n'
|
|
+- ' id 1,\n'
|
|
+- ' question "Is 1+1=3?"\n'
|
|
+- '}\n'
|
|
+- 'error: Type \'Foo\' not found in types dictionary.\n'
|
|
+- 'question Question ::= {\n'
|
|
+- ' id 1,\n'
|
|
+- ' question "Is 1+1=3?"\n'
|
|
+- '}\n'
|
|
+- 'error: [Errno 2] No such file or directory: \'/x/y/missing\'\n'
|
|
+- 'missing-command: command not found\n'
|
|
+- )
|
|
+-
|
|
+- stdout = StringIO()
|
|
+-
|
|
+- with patch('asn1tools.PromptSession', PromptSession):
|
|
+- with patch('sys.stdout', stdout):
|
|
+- with patch('sys.argv', argv):
|
|
+- asn1tools._main()
|
|
+-
|
|
+- print(stdout.getvalue())
|
|
+-
|
|
+- self.assertEqual(expected_output, stdout.getvalue())
|
|
+-
|
|
+- def test_command_line_shell_compile_without_arguments(self):
|
|
+- argv = ['asn1tools', 'shell']
|
|
+- commands = StringIO('''\
|
|
+-compile
|
|
+-exit
|
|
+-''')
|
|
+-
|
|
+- class PromptSession(object):
|
|
+-
|
|
+- def __init__(self, *_args, **_kwargs):
|
|
+- pass
|
|
+-
|
|
+- def prompt(*_args, **_kwargs):
|
|
+- return commands.readline()
|
|
+-
|
|
+- stdout = StringIO()
|
|
+-
|
|
+- with patch('asn1tools.PromptSession', PromptSession):
|
|
+- with patch('sys.stdout', stdout):
|
|
+- with patch('sys.argv', argv):
|
|
+- asn1tools._main()
|
|
+-
|
|
+- self.assertIn('compile: error: ', stdout.getvalue())
|
|
+-
|
|
+- def test_command_line_shell_convert_without_compile(self):
|
|
+- argv = ['asn1tools', 'shell']
|
|
+- commands = StringIO('''\
|
|
+-convert A 00
|
|
+-exit
|
|
+-''')
|
|
+-
|
|
+- expected_output = (
|
|
+- '\n'
|
|
+- 'Welcome to the asn1tools shell!\n'
|
|
+- '\n'
|
|
+- "No compiled specification found. Please use the 'compile' command "
|
|
+- "to compile one.\n"
|
|
+- )
|
|
+-
|
|
+- class PromptSession(object):
|
|
+-
|
|
+- def __init__(self, *_args, **_kwargs):
|
|
+- pass
|
|
+-
|
|
+- def prompt(*_args, **_kwargs):
|
|
+- return commands.readline()
|
|
+-
|
|
+- stdout = StringIO()
|
|
+-
|
|
+- with patch('asn1tools.PromptSession', PromptSession):
|
|
+- with patch('sys.stdout', stdout):
|
|
+- with patch('sys.argv', argv):
|
|
+- asn1tools._main()
|
|
+-
|
|
+- self.assertEqual(expected_output, stdout.getvalue())
|
|
+-
|
|
+- def test_command_line_shell_compile_help_no_exit(self):
|
|
+- argv = ['asn1tools', 'shell']
|
|
+- commands = StringIO('''\
|
|
+-compile --help
|
|
+-exit
|
|
+-''')
|
|
+-
|
|
+- class PromptSession(object):
|
|
+-
|
|
+- def __init__(self, *_args, **_kwargs):
|
|
+- pass
|
|
+-
|
|
+- def prompt(*_args, **_kwargs):
|
|
+- return commands.readline()
|
|
+-
|
|
+- stdout = StringIO()
|
|
+-
|
|
+- with patch('asn1tools.PromptSession', PromptSession):
|
|
+- with patch('sys.stdout', stdout):
|
|
+- with patch('sys.argv', argv):
|
|
+- asn1tools._main()
|
|
+-
|
|
+- self.assertIn('usage:', stdout.getvalue())
|
|
+-
|
|
+ def test_command_line_parse(self):
|
|
+ argv = [
|
|
+ 'asn1tools',
|
|
+--
|
|
+2.51.0
|
|
+
|
|
diff --git a/dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-remove-c-rust-tests.patch b/dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-remove-c-rust-tests.patch
|
|
new file mode 100644
|
|
index 0000000000..bc635239d8
|
|
--- /dev/null
|
|
+++ b/dev-python/asn1tools-osmocom/files/asn1tools-0.166.0-remove-c-rust-tests.patch
|
|
@@ -0,0 +1,1296 @@
|
|
+Disable C/Rust source tests to simplify test run. Anyway, we are not
|
|
+using C or Rust code generation at the momemnt.
|
|
+
|
|
+--- a/tests/test_c_source.py
|
|
++++ /dev/null
|
|
+@@ -1,268 +0,0 @@
|
|
+-import unittest
|
|
+-
|
|
+-import asn1tools
|
|
+-
|
|
+-
|
|
+-CODECS_AND_MODULES = [
|
|
+- ('oer', asn1tools.source.c.oer),
|
|
+- ('uper', asn1tools.source.c.uper)
|
|
+-]
|
|
+-
|
|
+-
|
|
+-class Asn1ToolsCSourceTest(unittest.TestCase):
|
|
+-
|
|
+- def test_compile_error_unsupported_type(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= OBJECT IDENTIFIER '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: Unsupported type 'OBJECT IDENTIFIER'.")
|
|
+-
|
|
+- def test_compile_error_unsupported_type_in_sequence(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= SEQUENCE { '
|
|
+- ' a NumericString '
|
|
+- ' } '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A.a: Unsupported type 'NumericString'.")
|
|
+-
|
|
+- def test_compile_error_integer_no_minimum_nor_maximum(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= INTEGER '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: INTEGER has no minimum value.")
|
|
+-
|
|
+- def test_compile_error_integer_no_minimum(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= INTEGER (MIN..10) '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: INTEGER has no minimum value.")
|
|
+-
|
|
+- def test_compile_error_integer_no_maximum(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= INTEGER (1..MAX) '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: INTEGER has no maximum value.")
|
|
+-
|
|
+- def test_compile_error_unsigned_integer_over_64_bits(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= INTEGER (0..18446744073709551616) '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: 18446744073709551616 does not fit in uint64_t.")
|
|
+-
|
|
+- def test_compile_error_unsigned_integer_over_64_signed_bits(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= INTEGER (-1..9223372036854775808) '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: 9223372036854775808 does not fit in int64_t.")
|
|
+-
|
|
+- def test_compile_error_signed_integer_over_64_bits(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= INTEGER (-9223372036854775809..0) '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: -9223372036854775809 does not fit in int64_t.")
|
|
+-
|
|
+- def test_compile_error_octet_string_no_size(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= OCTET STRING '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: OCTET STRING has no maximum length.")
|
|
+-
|
|
+- def test_compile_error_octet_string_no_maximum(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= OCTET STRING (SIZE(1..MAX)) '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: OCTET STRING has no maximum length.")
|
|
+-
|
|
+- def test_compile_error_sequence_of_no_size(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= SEQUENCE OF BOOLEAN '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: SEQUENCE OF has no maximum length.")
|
|
+-
|
|
+- def test_compile_error_sequence_of_no_maximum(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= SEQUENCE (SIZE(1..MAX)) OF BOOLEAN '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: SEQUENCE OF has no maximum length.")
|
|
+-
|
|
+- def test_compile_error_oer_real_not_ieee754(self):
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= REAL '
|
|
+- 'END',
|
|
+- 'oer')
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- asn1tools.source.c.oer.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: REAL not IEEE 754 binary32 or binary64.")
|
|
+-
|
|
+- def test_compile_error_members_backtrace(self):
|
|
+- for codec, module in CODECS_AND_MODULES:
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= SEQUENCE { '
|
|
+- ' a CHOICE { '
|
|
+- ' b INTEGER '
|
|
+- ' } '
|
|
+- ' } '
|
|
+- 'END',
|
|
+- codec)
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- module.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A.a.b: INTEGER has no minimum value.")
|
|
+-
|
|
+- def test_compile_error_oer_enumerated_min(self):
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= ENUMERATED { a(-2147483649) } '
|
|
+- 'END',
|
|
+- 'oer')
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- asn1tools.source.c.oer.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: -2147483649 does not fit in int32_t.")
|
|
+-
|
|
+- def test_compile_error_oer_enumerated_max(self):
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= ENUMERATED { a(2147483649) } '
|
|
+- 'END',
|
|
+- 'oer')
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- asn1tools.source.c.oer.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: 2147483649 does not fit in int32_t.")
|
|
+-
|
|
+- def test_compile_error_bit_strings(self):
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= BIT STRING (SIZE(1..2))'
|
|
+- 'END',
|
|
+- 'oer')
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- asn1tools.source.c.oer.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: BIT STRING with variable SIZE not supported.")
|
|
+-
|
|
+- foo = asn1tools.compile_string(
|
|
+- 'Foo DEFINITIONS AUTOMATIC TAGS ::= BEGIN '
|
|
+- ' A ::= BIT STRING (SIZE(65))'
|
|
+- 'END',
|
|
+- 'oer')
|
|
+-
|
|
+- with self.assertRaises(asn1tools.errors.Error) as cm:
|
|
+- asn1tools.source.c.oer.generate(foo, 'foo')
|
|
+-
|
|
+- self.assertEqual(str(cm.exception),
|
|
+- "Foo.A: BIT STRING with a length of more than 64 bits are "
|
|
+- "not supported.")
|
|
+-
|
|
+-if __name__ == '__main__':
|
|
+- unittest.main()
|
|
+--- a/tests/test_codecs_consistency.py
|
|
++++ b/tests/test_codecs_consistency.py
|
|
+@@ -705,857 +705,6 @@ class Asn1ToolsCodecsConsistencyTest(Asn1ToolsBaseTest):
|
|
+ for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+ self.encode_decode_codec(spec, codec, 'Int32', decoded, encoded)
|
|
+
|
|
+- def test_c_source(self):
|
|
+- specs = []
|
|
+-
|
|
+- for codec in CODECS:
|
|
+- specs.append(asn1tools.compile_files([
|
|
+- 'tests/files/c_source/c_source.asn',
|
|
+- 'examples/programming_types/programming_types.asn'
|
|
+- ], codec))
|
|
+-
|
|
+- # Type A.
|
|
+- decoded = {
|
|
+- 'a': -1,
|
|
+- 'b': -2,
|
|
+- 'c': -3,
|
|
+- 'd': -4,
|
|
+- 'e': 1,
|
|
+- 'f': 2,
|
|
+- 'g': 3,
|
|
+- 'h': 4,
|
|
+- 'i': True,
|
|
+- 'j': 11 * b'\x05'
|
|
+- }
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x28\x80\x01\xff\x81\x01\xfe\x82\x01\xfd\x83\x01\xfc\x84'
|
|
+- b'\x01\x01\x85\x01\x02\x86\x01\x03\x87\x01\x04\x88\x01\xff\x89'
|
|
+- b'\x0b\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05',
|
|
+- b'\x30\x28\x80\x01\xff\x81\x01\xfe\x82\x01\xfd\x83\x01\xfc\x84'
|
|
+- b'\x01\x01\x85\x01\x02\x86\x01\x03\x87\x01\x04\x88\x01\xff\x89'
|
|
+- b'\x0b\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05',
|
|
+- b'{"c":-3,"f":2,"d":-4,"a":-1,"i":true,"e":1,"j":"050505050505'
|
|
+- b'0505050505","h":4,"b":-2,"g":3}',
|
|
+- b'\xff\xff\xfe\xff\xff\xff\xfd\xff\xff\xff\xff\xff\xff\xff\xfc'
|
|
+- b'\x01\x00\x02\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x04'
|
|
+- b'\xff\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05',
|
|
+- b'\x7f\x7f\xfe\xc0\x7f\xff\xff\xfd\xe0\x7f\xff\xff\xff\xff\xff'
|
|
+- b'\xff\xfc\x01\x00\x02\x00\x03\x00\x04\x80\x05\x05\x05\x05\x05'
|
|
+- b'\x05\x05\x05\x05\x05\x05',
|
|
+- b'\x7f\x7f\xfe\x7f\xff\xff\xfd\x7f\xff\xff\xff\xff\xff\xff\xfc'
|
|
+- b'\x01\x00\x02\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x04'
|
|
+- b'\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x80',
|
|
+- b'<A><a>-1</a><b>-2</b><c>-3</c><d>-4</d><e>1</e><f>2</f><g>3<'
|
|
+- b'/g><h>4</h><i><true /></i><j>0505050505050505050505</j></A>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'A', decoded, encoded)
|
|
+-
|
|
+- # Type B, choice a.
|
|
+- decoded = ('a', -10)
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x80\x01\xf6',
|
|
+- b'\x80\x01\xf6',
|
|
+- b'{"a": -10}',
|
|
+- b'\x80\xf6',
|
|
+- b'\x00\x76',
|
|
+- b'\x1d\x80',
|
|
+- b'<B><a>-10</a></B>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'B', decoded, encoded)
|
|
+-
|
|
+- # Type B, choice b.
|
|
+- decoded = (
|
|
+- 'b',
|
|
+- {
|
|
+- 'a': -1,
|
|
+- 'b': -2,
|
|
+- 'c': -3,
|
|
+- 'd': -4,
|
|
+- 'e': 1,
|
|
+- 'f': 2,
|
|
+- 'g': 3,
|
|
+- 'h': 4,
|
|
+- 'i': True,
|
|
+- 'j': 11 * b'\x05'
|
|
+- }
|
|
+- )
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\xa1\x28\x80\x01\xff\x81\x01\xfe\x82\x01\xfd\x83\x01\xfc\x84'
|
|
+- b'\x01\x01\x85\x01\x02\x86\x01\x03\x87\x01\x04\x88\x01\xff\x89'
|
|
+- b'\x0b\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05',
|
|
+- b'\xa1\x28\x80\x01\xff\x81\x01\xfe\x82\x01\xfd\x83\x01\xfc\x84'
|
|
+- b'\x01\x01\x85\x01\x02\x86\x01\x03\x87\x01\x04\x88\x01\xff\x89'
|
|
+- b'\x0b\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05',
|
|
+- b'{"b":{"h":4,"f":2,"i":true,"d":-4,"a":-1,"j":"05050505050505'
|
|
+- b'05050505","e":1,"g":3,"c":-3,"b":-2}}',
|
|
+- b'\x81\xff\xff\xfe\xff\xff\xff\xfd\xff\xff\xff\xff\xff\xff\xff'
|
|
+- b'\xfc\x01\x00\x02\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00'
|
|
+- b'\x04\xff\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05',
|
|
+- b'\x40\x7f\x7f\xfe\xc0\x7f\xff\xff\xfd\xe0\x7f\xff\xff\xff\xff'
|
|
+- b'\xff\xff\xfc\x01\x00\x02\x00\x03\x00\x04\x80\x05\x05\x05\x05'
|
|
+- b'\x05\x05\x05\x05\x05\x05\x05',
|
|
+- b'\x5f\xdf\xff\x9f\xff\xff\xff\x5f\xff\xff\xff\xff\xff\xff\xff'
|
|
+- b'\x00\x40\x00\x80\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x01'
|
|
+- b'\x20\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0',
|
|
+- b'<B><b><a>-1</a><b>-2</b><c>-3</c><d>-4</d><e>1</e><f>2</f><g'
|
|
+- b'>3</g><h>4</h><i><true /></i><j>0505050505050505050505</j></'
|
|
+- b'b></B>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'B', decoded, encoded)
|
|
+-
|
|
+- # Type C - empty.
|
|
+- decoded = []
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x00',
|
|
+- b'\x30\x00',
|
|
+- b'[]',
|
|
+- b'\x01\x00',
|
|
+- b'\x00',
|
|
+- b'\x00',
|
|
+- b'<C />'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'C', decoded, encoded)
|
|
+-
|
|
+- # Type C - 2 elements.
|
|
+- decoded = [('a', -11), ('a', 13)]
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x06\x80\x01\xf5\x80\x01\x0d',
|
|
+- b'\x30\x06\x80\x01\xf5\x80\x01\x0d',
|
|
+- b'[{"a": -11}, {"a": 13}]',
|
|
+- b'\x01\x02\x80\xf5\x80\x0d',
|
|
+- b'\x80\x75\x00\x8d',
|
|
+- b'\x87\x52\x34',
|
|
+- b'<C><a>-11</a><a>13</a></C>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'C', decoded, encoded)
|
|
+-
|
|
+- # Type D.
|
|
+- decoded = [
|
|
+- {
|
|
+- 'a': {
|
|
+- 'b': ('c', 0),
|
|
+- 'e': [None, None, None],
|
|
+- 'f': None
|
|
+- },
|
|
+- 'g': {
|
|
+- 'h': 'j',
|
|
+- 'l': b'\x54\x55'
|
|
+- },
|
|
+- 'm': {
|
|
+- 'n': False,
|
|
+- 'o': 2,
|
|
+- 'p': {
|
|
+- 'q': 5 * b'\x03',
|
|
+- 'r': True
|
|
+- },
|
|
+- 's': True
|
|
+- }
|
|
+- }
|
|
+- ]
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x30\x30\x2e\xa0\x0f\xa0\x03\x80\x01\x00\xa1\x06\x05\x00\x05'
|
|
+- b'\x00\x05\x00\x82\x00\xa1\x04\x81\x02\x54\x55\xa2\x15\x80\x01\x00'
|
|
+- b'\x81\x01\x02\xa2\x0a\x80\x05\x03\x03\x03\x03\x03\x81\x01\xff\x83'
|
|
+- b'\x01\xff',
|
|
+- b'\x30\x30\x30\x2e\xa0\x0f\xa0\x03\x80\x01\x00\xa1\x06\x05\x00\x05'
|
|
+- b'\x00\x05\x00\x82\x00\xa1\x04\x81\x02\x54\x55\xa2\x15\x80\x01\x00'
|
|
+- b'\x81\x01\x02\xa2\x0a\x80\x05\x03\x03\x03\x03\x03\x81\x01\xff\x83'
|
|
+- b'\x01\xff',
|
|
+- b'[{"m":{"p":{"q":"0303030303","r":true},"s":true,"o":2,"n":false}'
|
|
+- b',"g":{"l":"5455","h":"j"},"a":{"b":{"c":0},"e":[null,null,null],'
|
|
+- b'"f":null}}]',
|
|
+- b'\x01\x01\x80\x00\x01\x03\x00\x02\x54\x55\xf0\x00\x02\x80\x03\x03'
|
|
+- b'\x03\x03\x03\xff\xff',
|
|
+- b'\x00\x80\x54\x55\xf4\x80\x03\x03\x03\x03\x03\xc0',
|
|
+- b'\x00\xaa\x2a\xfa\x40\xc0\xc0\xc0\xc0\xf0',
|
|
+- b'<D><SEQUENCE><a><b><c>0</c></b><e><NULL /><NULL /><NULL /></e><f'
|
|
+- b' /></a><g><h><j /></h><l>5455</l></g><m><n><false /></n><o>2</o>'
|
|
+- b'<p><q>0303030303</q><r><true /></r></p><s><true /></s></m></SEQU'
|
|
+- b'ENCE></D>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'D', decoded, encoded)
|
|
+-
|
|
+- # Type D - some missing.
|
|
+- decoded = [
|
|
+- {
|
|
+- 'a': {
|
|
+- 'b': ('d', False),
|
|
+- 'e': [None, None, None],
|
|
+- 'f': None
|
|
+- },
|
|
+- 'g': {
|
|
+- 'h': 'k',
|
|
+- 'l': b'\x54'
|
|
+- },
|
|
+- 'm': {
|
|
+- 'o': 3,
|
|
+- 'p': {
|
|
+- 'q': 5 * b'\x03'
|
|
+- },
|
|
+- 's': False
|
|
+- }
|
|
+- }
|
|
+- ]
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x27\x30\x25\xa0\x0f\xa0\x03\x81\x01\x00\xa1\x06\x05\x00\x05'
|
|
+- b'\x00\x05\x00\x82\x00\xa1\x07\x80\x02\x02\x00\x81\x01\x54\xa2\x09'
|
|
+- b'\xa2\x07\x80\x05\x03\x03\x03\x03\x03',
|
|
+- b'\x30\x27\x30\x25\xa0\x0f\xa0\x03\x81\x01\x00\xa1\x06\x05\x00\x05'
|
|
+- b'\x00\x05\x00\x82\x00\xa1\x07\x80\x02\x02\x00\x81\x01\x54\xa2\x09'
|
|
+- b'\xa2\x07\x80\x05\x03\x03\x03\x03\x03',
|
|
+- b'[{"a":{"b":{"d":false},"e":[null,null,null],"f":null},"g":{"h":"'
|
|
+- b'k","l":"54"},"m":{"o":3,"p":{"q":"0303030303"},"s":false}}]',
|
|
+- b'\x01\x01\x81\x00\x01\x03\x80\x82\x02\x00\x01\x54\x20\x00\x03\x03'
|
|
+- b'\x03\x03\x03',
|
|
+- b'\x09\x80\x54\x20\x03\x03\x03\x03\x03',
|
|
+- b'\x09\x8a\x84\x03\x03\x03\x03\x03',
|
|
+- b'<D><SEQUENCE><a><b><d><false /></d></b><e><NULL /><NULL /><NULL '
|
|
+- b'/></e><f /></a><g><h><k /></h><l>54</l></g><m><o>3</o><p><q>0303'
|
|
+- b'030303</q></p><s><false /></s></m></SEQUENCE></D>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'D', decoded, encoded)
|
|
+-
|
|
+- # Type E.
|
|
+- decoded = {'a': ('b', ('c', True))}
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x07\xa0\x05\xa0\x03\x80\x01\xff',
|
|
+- b'\x30\x07\xa0\x05\xa0\x03\x80\x01\xff',
|
|
+- b'{"a": {"b": {"c": true}}}',
|
|
+- b'\x80\x80\xff',
|
|
+- b'\x80',
|
|
+- b'\x80',
|
|
+- b'<E><a><b><c><true /></c></b></a></E>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'E', decoded, encoded)
|
|
+-
|
|
+- # Type F.
|
|
+- decoded = [[False], [True]]
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'0\n0\x03\x01\x01\x000\x03\x01\x01\xff',
|
|
+- b'0\n0\x03\x01\x01\x000\x03\x01\x01\xff',
|
|
+- b'[[false], [true]]',
|
|
+- b'\x01\x02\x01\x01\x00\x01\x01\xff',
|
|
+- b'\xa0',
|
|
+- b'\xa0',
|
|
+- b'<F><SEQUENCE_OF><false /></SEQUENCE_OF><SEQUENCE_OF><true /></SE'
|
|
+- b'QUENCE_OF></F>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'F', decoded, encoded)
|
|
+-
|
|
+- # Type G.
|
|
+- decoded = {'a': True, 'i': True}
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x06\x80\x01\xff\x88\x01\xff',
|
|
+- b'\x30\x06\x80\x01\xff\x88\x01\xff',
|
|
+- b'{"a": true, "i": true}',
|
|
+- b'\x80\x80\xff\xff',
|
|
+- b'\x80\xe0',
|
|
+- b'\x80\xe0',
|
|
+- b'<G><a><true /></a><i><true /></i></G>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'G', decoded, encoded)
|
|
+-
|
|
+- # Type H.
|
|
+- decoded = None
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x05\x00',
|
|
+- b'\x05\x00',
|
|
+- b'null',
|
|
+- b'',
|
|
+- b'',
|
|
+- b'',
|
|
+- b'<H />'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'H', decoded, encoded)
|
|
+-
|
|
+- # Type I.
|
|
+- decoded = (
|
|
+- b'\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03'
|
|
+- b'\x04\x01\x02\x03\x04\x01\x02\x03\x04'
|
|
+- )
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x04\x18\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01'
|
|
+- b'\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04',
|
|
+- b'\x04\x18\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01'
|
|
+- b'\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04',
|
|
+- b'"010203040102030401020304010203040102030401020304"',
|
|
+- b'\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03'
|
|
+- b'\x04\x01\x02\x03\x04\x01\x02\x03\x04',
|
|
+- b'\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03'
|
|
+- b'\x04\x01\x02\x03\x04\x01\x02\x03\x04',
|
|
+- b'\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03'
|
|
+- b'\x04\x01\x02\x03\x04\x01\x02\x03\x04',
|
|
+- b'<I>010203040102030401020304010203040102030401020304</I>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'I', decoded, encoded)
|
|
+-
|
|
+- # Type J.
|
|
+- decoded = (
|
|
+- b'\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03'
|
|
+- b'\x04\x01\x02\x03\x04\x01\x02'
|
|
+- )
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x04\x16\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01'
|
|
+- b'\x02\x03\x04\x01\x02\x03\x04\x01\x02',
|
|
+- b'\x04\x16\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01'
|
|
+- b'\x02\x03\x04\x01\x02\x03\x04\x01\x02',
|
|
+- b'"01020304010203040102030401020304010203040102"',
|
|
+- b'\x16\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02'
|
|
+- b'\x03\x04\x01\x02\x03\x04\x01\x02',
|
|
+- b'\x00\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02\x03\x04\x01\x02'
|
|
+- b'\x03\x04\x01\x02\x03\x04\x01\x02',
|
|
+- b'\x00\x81\x01\x82\x00\x81\x01\x82\x00\x81\x01\x82\x00\x81\x01'
|
|
+- b'\x82\x00\x81\x01\x82\x00\x81\x00',
|
|
+- b'<J>01020304010203040102030401020304010203040102</J>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'J', decoded, encoded)
|
|
+-
|
|
+- # Type K.
|
|
+- decoded = 'a'
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x0a\x01\x00',
|
|
+- b'\x0a\x01\x00',
|
|
+- b'"a"',
|
|
+- b'\x00',
|
|
+- b'',
|
|
+- b'',
|
|
+- b'<K><a /></K>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'K', decoded, encoded)
|
|
+-
|
|
+- # Type L.
|
|
+- decoded = 260 * b'\xa5'
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x04\x82\x01\x04' + 260 * b'\xa5',
|
|
+- b'\x04\x82\x01\x04' + 260 * b'\xa5',
|
|
+- b'"' + 260 * b'A5' + b'"',
|
|
+- b'\x82\x01\x04' + 260 * b'\xa5',
|
|
+- b'\x01\x04' + 260 * b'\xa5',
|
|
+- b'\x82\x52' + 259 * b'\xd2' + b'\x80',
|
|
+- b'<L>' + 260 * b'A5' + b'</L>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'L', decoded, encoded)
|
|
+-
|
|
+- # Type O.
|
|
+- decoded = 260 * [True]
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x82\x03\x0c' + 260 * b'\x01\x01\xff',
|
|
+- b'\x30\x82\x03\x0c' + 260 * b'\x01\x01\xff',
|
|
+- b'[' + 259 * b'true,' + b'true]',
|
|
+- b'\x02\x01\x04' + 260 * b'\xff',
|
|
+- b'\x01\x03' + 32 * b'\xff' + b'\xf0',
|
|
+- b'\x81' + 32 * b'\xff' + b'\xf8',
|
|
+- b'<O>' + 260 * b'<true />' + b'</O>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'O', decoded, encoded)
|
|
+-
|
|
+- # Type Q.
|
|
+- decoded = ('c256', True)
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x9f\x81\x7f\x01\xff',
|
|
+- b'\x9f\x81\x7f\x01\xff',
|
|
+- b'{"c256": true}',
|
|
+- b'\xbf\x81\x7f\xff',
|
|
+- b'\x00\xff\x80',
|
|
+- b'\x7f\xc0',
|
|
+- b'<Q><c256><true /></c256></Q>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'Q', decoded, encoded)
|
|
+-
|
|
+- # Type Q.
|
|
+- decoded = ('c257', True)
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x9f\x82\x00\x01\xff',
|
|
+- b'\x9f\x82\x00\x01\xff',
|
|
+- b'{"c257": true}',
|
|
+- b'\xbf\x82\x00\xff',
|
|
+- b'\x01\x00\x80',
|
|
+- b'\x80\x40',
|
|
+- b'<Q><c257><true /></c257></Q>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'Q', decoded, encoded)
|
|
+-
|
|
+- # Type R.
|
|
+- decoded = -1
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\xff',
|
|
+- b'\x02\x01\xff',
|
|
+- b'-1',
|
|
+- b'\xff',
|
|
+- b'\x00',
|
|
+- b'\x00',
|
|
+- b'<R>-1</R>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'R', decoded, encoded)
|
|
+-
|
|
+- decoded = 0
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\x00',
|
|
+- b'\x02\x01\x00',
|
|
+- b'0',
|
|
+- b'\x00',
|
|
+- b'\x80',
|
|
+- b'\x80',
|
|
+- b'<R>0</R>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'R', decoded, encoded)
|
|
+-
|
|
+- # Type S.
|
|
+- decoded = -2
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\xfe',
|
|
+- b'\x02\x01\xfe',
|
|
+- b'-2',
|
|
+- b'\xfe',
|
|
+- b'\x00',
|
|
+- b'\x00',
|
|
+- b'<S>-2</S>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'S', decoded, encoded)
|
|
+-
|
|
+- decoded = 1
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\x01',
|
|
+- b'\x02\x01\x01',
|
|
+- b'1',
|
|
+- b'\x01',
|
|
+- b'\xc0',
|
|
+- b'\xc0',
|
|
+- b'<S>1</S>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'S', decoded, encoded)
|
|
+-
|
|
+- # Type T.
|
|
+- decoded = -1
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\xff',
|
|
+- b'\x02\x01\xff',
|
|
+- b'-1',
|
|
+- b'\xff',
|
|
+- b'\x00',
|
|
+- b'\x00',
|
|
+- b'<T>-1</T>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'T', decoded, encoded)
|
|
+-
|
|
+- decoded = 2
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\x02',
|
|
+- b'\x02\x01\x02',
|
|
+- b'2',
|
|
+- b'\x02',
|
|
+- b'\xc0',
|
|
+- b'\xc0',
|
|
+- b'<T>2</T>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'T', decoded, encoded)
|
|
+-
|
|
+- # Type U.
|
|
+- decoded = -64
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\xc0',
|
|
+- b'\x02\x01\xc0',
|
|
+- b'-64',
|
|
+- b'\xc0',
|
|
+- b'\x00',
|
|
+- b'\x00',
|
|
+- b'<U>-64</U>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'U', decoded, encoded)
|
|
+-
|
|
+- # Type V.
|
|
+- decoded = -128
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\x80',
|
|
+- b'\x02\x01\x80',
|
|
+- b'-128',
|
|
+- b'\x80',
|
|
+- b'\x00',
|
|
+- b'\x00',
|
|
+- b'<V>-128</V>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'V', decoded, encoded)
|
|
+-
|
|
+- # Type W.
|
|
+- decoded = -1
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\xff',
|
|
+- b'\x02\x01\xff',
|
|
+- b'-1',
|
|
+- b'\xff\xff',
|
|
+- b'\x00\x00',
|
|
+- b'\x00\x00',
|
|
+- b'<W>-1</W>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'W', decoded, encoded)
|
|
+-
|
|
+- decoded = 510
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x02\x01\xfe',
|
|
+- b'\x02\x02\x01\xfe',
|
|
+- b'510',
|
|
+- b'\x01\xfe',
|
|
+- b'\x01\xff',
|
|
+- b'\xff\x80',
|
|
+- b'<W>510</W>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'W', decoded, encoded)
|
|
+-
|
|
+- # Type X.
|
|
+- decoded = -2
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\xfe',
|
|
+- b'\x02\x01\xfe',
|
|
+- b'-2',
|
|
+- b'\xff\xfe',
|
|
+- b'\x00\x00',
|
|
+- b'\x00\x00',
|
|
+- b'<X>-2</X>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'X', decoded, encoded)
|
|
+-
|
|
+- decoded = 510
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x02\x01\xfe',
|
|
+- b'\x02\x02\x01\xfe',
|
|
+- b'510',
|
|
+- b'\x01\xfe',
|
|
+- b'\x02\x00',
|
|
+- b'\x80\x00',
|
|
+- b'<X>510</X>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'X', decoded, encoded)
|
|
+-
|
|
+- # Type Y.
|
|
+- decoded = 10000
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x02\x27\x10',
|
|
+- b'\x02\x02\x27\x10',
|
|
+- b'10000',
|
|
+- b'\x27\x10',
|
|
+- b'\x00\x00',
|
|
+- b'\x00\x00',
|
|
+- b'<Y>10000</Y>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'Y', decoded, encoded)
|
|
+-
|
|
+- decoded = 10512
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x02\x29\x10',
|
|
+- b'\x02\x02\x29\x10',
|
|
+- b'10512',
|
|
+- b'\x29\x10',
|
|
+- b'\x02\x00',
|
|
+- b'\x80\x00',
|
|
+- b'<Y>10512</Y>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'Y', decoded, encoded)
|
|
+-
|
|
+- # AB.
|
|
+- decoded = {
|
|
+- 'a': 0,
|
|
+- 'b': 10300
|
|
+- }
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x0b\xa0\x03\x02\x01\x00\xa1\x04\x02\x02\x28\x3c',
|
|
+- b'\x30\x0b\xa0\x03\x02\x01\x00\xa1\x04\x02\x02\x28\x3c',
|
|
+- b'{"a": 0, "b": 10300}',
|
|
+- b'\x00\x28\x3c',
|
|
+- b'\x80\x01,',
|
|
+- b'\xa5\x80',
|
|
+- b'<AB><a>0</a><b>10300</b></AB>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AB', decoded, encoded)
|
|
+-
|
|
+- # AE
|
|
+- decoded = {
|
|
+- 'a': False,
|
|
+- 'b': True,
|
|
+- 'c': False
|
|
+- }
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x06\x80\x01\x00\x82\x01\x00',
|
|
+- b'\x30\x06\x80\x01\x00\x82\x01\x00',
|
|
+- b'{"a": false, "b": true, "c": false}',
|
|
+- b'\x40\x00\x00',
|
|
+- b'\x40',
|
|
+- b'\x40',
|
|
+- b'<AE><a><false /></a><b><true /></b><c><false /></c></AE>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AE', decoded, encoded)
|
|
+-
|
|
+- # AF
|
|
+- decoded = {
|
|
+- 'a': True,
|
|
+- 'b': {
|
|
+- 'c': True,
|
|
+- 'd': 17,
|
|
+- 'e': 'g'
|
|
+- },
|
|
+- 'e': 18,
|
|
+- 'f': 19,
|
|
+- 'g': 20,
|
|
+- 'h': 21,
|
|
+- 'i': 22,
|
|
+- 'j': 23,
|
|
+- 'k': 24,
|
|
+- 'l': 25,
|
|
+- }
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x23\x80\x01\xff\xa1\x09\x80\x01\xff\x81\x01\x11\x82\x01\x01'
|
|
+- b'\x82\x01\x12\x83\x01\x13\x84\x01\x14\x85\x01\x15\x86\x01\x16\x87'
|
|
+- b'\x01\x17\x89\x01\x19',
|
|
+- b'\x30\x23\x80\x01\xff\xa1\x09\x80\x01\xff\x81\x01\x11\x82\x01\x01'
|
|
+- b'\x82\x01\x12\x83\x01\x13\x84\x01\x14\x85\x01\x15\x86\x01\x16\x87'
|
|
+- b'\x01\x17\x89\x01\x19',
|
|
+- b'{"a": true, "b": {"c":true, "d":17, "e":"g"}, "e":18, "f":19, "g":20,'
|
|
+- b'"h":21, "i":22, "j":23, "k":24, "l":25}',
|
|
+- b'\x80\xff\x03\x07\xff\x80\x09\x80\xff\x02\x06\xc0\x01\x11\x01\x01'
|
|
+- b'\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19',
|
|
+- b'\xc4\x7f\xc0\x06\xc0\xe0\x01\x11\x01\x40\x01\x12\x01\x13\x01\x14'
|
|
+- b'\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19',
|
|
+- b'\xc4\x7f\xc1\xb0\x38\x08\x88\x0a\x00\x00\x44\x80\x44\xc0\x45\x00'
|
|
+- b'\x45\x40\x45\x80\x45\xc0\x46\x00\x46\x40',
|
|
+- b'<AF><a><true /></a><b><c><true /></c><d>17</d><e><g /></e></b><e>18'
|
|
+- b'</e><f>19</f><g>20</g><h>21</h><i>22</i><j>23</j><k>24</k><l>25'
|
|
+- b'</l></AF>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AF', decoded, encoded)
|
|
+-
|
|
+- # Type AG
|
|
+- decoded = {
|
|
+- 'a': True,
|
|
+- 'b': b'\x84\x55',
|
|
+- 'c': [True, False, True, False],
|
|
+- 'd': 'f',
|
|
+- 'h': None,
|
|
+- 'i': 1.0,
|
|
+- 'j': ('k', 60693),
|
|
+- 'm': b'\xf0\xf1\xf2\xf3\xf4'
|
|
+- }
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x30\x2e\x80\x01\xff\x81\x02\x84\x55\xa2\x0c\x01\x01\xff\x01\x01'
|
|
+- b'\x00\x01\x01\xff\x01\x01\x00\x83\x02\x01\x00\x84\x00\x85\x03\x80'
|
|
+- b'\x00\x01\xa6\x05\x80\x03\x00\xed\x15\x87\x05\xf0\xf1\xf2\xf3\xf4',
|
|
+- b'\x30\x2e\x80\x01\xff\x81\x02\x84\x55\xa2\x0c\x01\x01\xff\x01\x01'
|
|
+- b'\x00\x01\x01\xff\x01\x01\x00\x83\x02\x01\x00\x84\x00\x85\x03\x80'
|
|
+- b'\x00\x01\xa6\x05\x80\x03\x00\xed\x15\x87\x05\xf0\xf1\xf2\xf3\xf4',
|
|
+- b'{"a": true, "b": "8455", "c": [true, false, true, false], "d": "f",'
|
|
+- b'"h": null, "i": 1.0, "j": {"k": 60693}, "m": "F0F1F2F3F4"}',
|
|
+- b'\x80\xff\x02\x01\xfe\x03\x02\x84\x55\x06\x01\x04\xff\x00\xff\x00'
|
|
+- b'\x03\x82\x01\x00\x00\x04\x3f\x80\x00\x00\x03\x80\xed\x15\x05\xf0'
|
|
+- b'\xf1\xf2\xf3\xf4',
|
|
+- b'\xc3\x7f\x03\x20\x84\x55\x01\x3a\x01\x40\x00\x04\x03\x80\x00\x01'
|
|
+- b'\x03\x00\xed\x15\x05\xf0\xf1\xf2\xf3\xf4',
|
|
+- b'\xc3\x7f\x03\x28\x45\x50\x01\x3a\x01\x40\x00\x04\x03\x80\x00\x01'
|
|
+- b'\x03\x76\x8a\x80\x05\xf0\xf1\xf2\xf3\xf4',
|
|
+- b'<AG><a><true /></a><b>8455</b><c><true /><false /><true /><false />'
|
|
+- b'</c><d><f /></d><h /><i>1.0E0</i><j><k>60693</k></j><m>F0F1F2F3F4</'
|
|
+- b'm></AG>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AG', decoded, encoded)
|
|
+-
|
|
+- # Type AL.
|
|
+- decoded = -129
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x02\xff\x7f',
|
|
+- b'\x02\x02\xff\x7f',
|
|
+- b'-129',
|
|
+- b'\xff\x7f',
|
|
+- b'\x00\x00',
|
|
+- b'\x00\x00',
|
|
+- b'<AL>-129</AL>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AL', decoded, encoded)
|
|
+-
|
|
+- decoded = 127
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\x7f',
|
|
+- b'\x02\x01\x7f',
|
|
+- b'127',
|
|
+- b'\x00\x7f',
|
|
+- b'\x01\x00',
|
|
+- b'\x80\x00',
|
|
+- b'<AL>127</AL>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AL', decoded, encoded)
|
|
+-
|
|
+- # Type AM.
|
|
+- decoded = -2
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x01\xfe',
|
|
+- b'\x02\x01\xfe',
|
|
+- b'-2',
|
|
+- b'\xff\xfe',
|
|
+- b'\x00',
|
|
+- b'\x00',
|
|
+- b'<AM>-2</AM>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AM', decoded, encoded)
|
|
+-
|
|
+- decoded = 128
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x02\x00\x80',
|
|
+- b'\x02\x02\x00\x80',
|
|
+- b'128',
|
|
+- b'\x00\x80',
|
|
+- b'\x82',
|
|
+- b'\x82',
|
|
+- b'<AM>128</AM>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AM', decoded, encoded)
|
|
+-
|
|
+- # Type AQ.
|
|
+- decoded = 1234
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x02\x04\xd2',
|
|
+- b'\x02\x02\x04\xd2',
|
|
+- b'1234',
|
|
+- b'\x00\x00\x04\xd2',
|
|
+- b'\x40\x04\xd2',
|
|
+- b'\x00\x04\xd2',
|
|
+- b'<AQ>1234</AQ>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AQ', decoded, encoded)
|
|
+-
|
|
+- decoded = 100001
|
|
+-
|
|
+- encoded_messages = [
|
|
+- b'\x02\x03\x01\x86\xa1',
|
|
+- b'\x02\x03\x01\x86\xa1',
|
|
+- b'100001',
|
|
+- b'\x00\x01\x86\xa1',
|
|
+- b'\x80\x01\x86\xa1',
|
|
+- b'\x01\x86\xa1',
|
|
+- b'<AQ>100001</AQ>'
|
|
+- ]
|
|
+-
|
|
+- for spec, codec, encoded in zip(specs, CODECS, encoded_messages):
|
|
+- self.encode_decode_codec(spec, codec, 'AQ', decoded, encoded)
|
|
+-
|
|
+ def test_parameterization(self):
|
|
+ specs = []
|
|
+
|
|
+--- a/tests/test_command_line.py
|
|
++++ b/tests/test_command_line.py
|
|
+@@ -675,49 +675,6 @@ exit
|
|
+
|
|
+ self.assertEqual(SPECIFICATION, expected_specification)
|
|
+
|
|
+- def test_command_line_generate_c_source_oer(self):
|
|
+- argv = [
|
|
+- 'asn1tools', '--debug',
|
|
+- 'generate_c_source',
|
|
+- '--namespace', 'oer',
|
|
+- '--generate-fuzzer',
|
|
+- 'tests/files/c_source/c_source.asn',
|
|
+- 'tests/files/c_source/programming_types.asn'
|
|
+- ]
|
|
+-
|
|
+- filename_h = 'oer.h'
|
|
+- filename_c = 'oer.c'
|
|
+- fuzzer_filename_c = 'oer_fuzzer.c'
|
|
+- fuzzer_filename_mk = 'oer_fuzzer.mk'
|
|
+-
|
|
+- if os.path.exists(filename_h):
|
|
+- os.remove(filename_h)
|
|
+-
|
|
+- if os.path.exists(filename_c):
|
|
+- os.remove(filename_c)
|
|
+-
|
|
+- if os.path.exists(fuzzer_filename_c):
|
|
+- os.remove(fuzzer_filename_c)
|
|
+-
|
|
+- if os.path.exists(fuzzer_filename_mk):
|
|
+- os.remove(fuzzer_filename_mk)
|
|
+-
|
|
+- with patch('sys.argv', argv):
|
|
+- asn1tools._main()
|
|
+-
|
|
+- self.assertEqual(
|
|
+- read_file('tests/files/c_source/' + filename_h),
|
|
+- read_file(filename_h))
|
|
+- self.assertEqual(
|
|
+- read_file('tests/files/c_source/' + filename_c),
|
|
+- read_file(filename_c))
|
|
+- self.assertEqual(
|
|
+- read_file('tests/files/c_source/' + fuzzer_filename_c),
|
|
+- read_file(fuzzer_filename_c))
|
|
+- self.assertEqual(
|
|
+- read_file('tests/files/c_source/' + fuzzer_filename_mk),
|
|
+- read_file(fuzzer_filename_mk))
|
|
+-
|
|
+ def test_command_line_generate_c_source_oer_minus(self):
|
|
+ argv = [
|
|
+ 'asn1tools',
|
|
+@@ -754,49 +711,6 @@ exit
|
|
+ self.assertFalse(os.path.exists(fuzzer_filename_c))
|
|
+ self.assertFalse(os.path.exists(fuzzer_filename_mk))
|
|
+
|
|
+- def test_command_line_generate_c_source_uper(self):
|
|
+- argv = [
|
|
+- 'asn1tools',
|
|
+- 'generate_c_source',
|
|
+- '--namespace', 'uper',
|
|
+- '--codec', 'uper',
|
|
+- '--generate-fuzzer',
|
|
+- 'tests/files/c_source/c_source.asn'
|
|
+- ]
|
|
+-
|
|
+- filename_h = 'uper.h'
|
|
+- filename_c = 'uper.c'
|
|
+- fuzzer_filename_c = 'uper_fuzzer.c'
|
|
+- fuzzer_filename_mk = 'uper_fuzzer.mk'
|
|
+-
|
|
+- if os.path.exists(filename_h):
|
|
+- os.remove(filename_h)
|
|
+-
|
|
+- if os.path.exists(filename_c):
|
|
+- os.remove(filename_c)
|
|
+-
|
|
+- if os.path.exists(fuzzer_filename_c):
|
|
+- os.remove(fuzzer_filename_c)
|
|
+-
|
|
+- if os.path.exists(fuzzer_filename_mk):
|
|
+- os.remove(fuzzer_filename_mk)
|
|
+-
|
|
+- with patch('sys.argv', argv):
|
|
+- asn1tools._main()
|
|
+-
|
|
+- self.assertEqual(
|
|
+- read_file('tests/files/c_source/' + filename_h),
|
|
+- read_file(filename_h))
|
|
+- self.assertEqual(
|
|
+- read_file('tests/files/c_source/' + filename_c),
|
|
+- read_file(filename_c))
|
|
+- self.assertEqual(
|
|
+- read_file('tests/files/c_source/' + fuzzer_filename_c),
|
|
+- read_file(fuzzer_filename_c))
|
|
+- self.assertEqual(
|
|
+- read_file('tests/files/c_source/' + fuzzer_filename_mk),
|
|
+- read_file(fuzzer_filename_mk))
|
|
+-
|
|
+ def test_command_line_generate_c_source(self):
|
|
+ specs = [
|
|
+ 'boolean',
|
|
+@@ -831,25 +745,6 @@ exit
|
|
+ read_file('tests/files/c_source/' + filename_c),
|
|
+ read_file(filename_c))
|
|
+
|
|
+- def test_command_line_generate_rust_source_uper(self):
|
|
+- argv = [
|
|
+- 'asn1tools',
|
|
+- 'generate_rust_source',
|
|
+- 'tests/files/rust_source/rust_source.asn'
|
|
+- ]
|
|
+-
|
|
+- filename_rs = 'rust_source.rs'
|
|
+-
|
|
+- if os.path.exists(filename_rs):
|
|
+- os.remove(filename_rs)
|
|
+-
|
|
+- with patch('sys.argv', argv):
|
|
+- asn1tools._main()
|
|
+-
|
|
+- self.assertEqual(
|
|
+- read_file('tests/files/rust_source/' + filename_rs),
|
|
+- read_file(filename_rs))
|
|
+-
|
|
+
|
|
+ if __name__ == '__main__':
|
|
+ unittest.main()
|
|
+--- a/tests/test_oer.py
|
|
++++ b/tests/test_oer.py
|
|
+@@ -984,28 +984,6 @@ class Asn1ToolsOerTest(Asn1ToolsBaseTest):
|
|
+ self.assertEqual(str(cm.exception),
|
|
+ "C: out of data (At bit offset: 0)")
|
|
+
|
|
+- def test_c_source(self):
|
|
+- files = [
|
|
+- 'tests/files/c_source/c_source.asn'
|
|
+- ]
|
|
+- foo = asn1tools.compile_files(files, 'oer')
|
|
+-
|
|
+- # Type L - decode error bad length.
|
|
+- with self.assertRaises(asn1tools.codecs.OutOfDataError):
|
|
+- foo.decode('L', b'\x82\x01\xff')
|
|
+-
|
|
+- with self.assertRaises(asn1tools.codecs.OutOfDataError):
|
|
+- foo.decode('L', b'\x83\x01\xff\x00')
|
|
+-
|
|
+- with self.assertRaises(asn1tools.codecs.OutOfDataError):
|
|
+- foo.decode('L', b'\x84\x01\x00\x01\x00')
|
|
+-
|
|
+- with self.assertRaises(asn1tools.codecs.OutOfDataError):
|
|
+- foo.decode('L', b'\x83')
|
|
+-
|
|
+- with self.assertRaises(asn1tools.codecs.OutOfDataError):
|
|
+- foo.decode('L', b'\xff\x00')
|
|
+-
|
|
+ def test_not_support_decode_with_length(self):
|
|
+ foo = asn1tools.compile_string(
|
|
+ "Foo DEFINITIONS AUTOMATIC TAGS ::= "
|
|
+--
|
|
+2.51.0
|
|
+
|
|
diff --git a/dev-python/gsm0338/Manifest b/dev-python/gsm0338/Manifest
|
|
new file mode 100644
|
|
index 0000000000..07bd490291
|
|
--- /dev/null
|
|
+++ b/dev-python/gsm0338/Manifest
|
|
@@ -0,0 +1,2 @@
|
|
+DIST gsm0338-1.1.0.gh.tar.gz 16065 BLAKE2B 192bc3efdabefc872b2e04f22a4e1e93da92be0ae68620f3c0bf3c43597d53c92f5a3b38161768a9a48856cc5da9938f84b750c1c0ec0060ad918b52a34e70b9 SHA512 fbff92386bddb90d8154795edcaf762c7f5fbf352d11ceb0ab69b0a4fae82f740084d68f582597a4c1bbd6ddbe1a3e2db3b99a08a6a36159a5ada0634862e669
|
|
+EBUILD gsm0338-1.1.0.ebuild 469 BLAKE2B e2d8e8691b9859933e9976fb5456ca7612959e497157eac9d8610901b2d748fb5048b5974bfb3eda826248384c3d3fd43ab847945af3619a3775f395303185da SHA512 de0005812a0207e7b0c946a8cf7744d9c5c9b34971cd0a983950ec99bb3d47dae0774134168322e3677a33695599f7cb16148b1a56f356ae5ddb8c14e5615ab3
|
|
diff --git a/dev-python/gsm0338/gsm0338-1.1.0.ebuild b/dev-python/gsm0338/gsm0338-1.1.0.ebuild
|
|
new file mode 100644
|
|
index 0000000000..2d33c1baa5
|
|
--- /dev/null
|
|
+++ b/dev-python/gsm0338/gsm0338-1.1.0.ebuild
|
|
@@ -0,0 +1,24 @@
|
|
+EAPI=8
|
|
+
|
|
+DISTUTILS_USE_PEP517=poetry
|
|
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
|
|
+
|
|
+inherit distutils-r1 pypi
|
|
+
|
|
+DESCRIPTION="Codec for 3GPP TS 23.038 / ETSI GSM 03.38"
|
|
+HOMEPAGE="
|
|
+ https://github.com/dsch/gsm0338
|
|
+ https://pypi.org/project/gsm0338/
|
|
+"
|
|
+# pypi tarball are missing test data
|
|
+SRC_URI="https://github.com/dsch/${PN}/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"
|
|
+
|
|
+LICENSE="MIT"
|
|
+SLOT="0"
|
|
+KEYWORDS="~amd64"
|
|
+
|
|
+distutils_enable_tests pytest
|
|
+
|
|
+python_test() {
|
|
+ epytest tests
|
|
+}
|
|
diff --git a/dev-python/pycryptodomex/Manifest b/dev-python/pycryptodomex/Manifest
|
|
new file mode 100644
|
|
index 0000000000..5b72d18138
|
|
--- /dev/null
|
|
+++ b/dev-python/pycryptodomex/Manifest
|
|
@@ -0,0 +1,2 @@
|
|
+DIST pycryptodomex-3.23.0.tar.gz 4922157 BLAKE2B 257528ec2971713c8c1262748bea20e3e4409cec158332d044c0877820eb7057cdecd76a3e13f77d904549964e12967756fcf3d65536405ab5ca4d3b4a878af0 SHA512 4632f02438a636d728f415a2532c4166eb290735865ab9b68f76c98e0de4b46500be233ee82276199a34f6175f6fff3aa4f8ef7465f45cc65fdef8d2276645a1
|
|
+EBUILD pycryptodomex-3.23.0.ebuild 452 BLAKE2B f183527a2a963a4a58dce5271875e2c258847fb732c263a7a14cff632700e81b4c28046c3d2712b08c6f2ab8816af35d8afc19581471cf95ef5c17e6a0816682 SHA512 5f4bede829a1d8fac312f5e01c127e5983d0d6616d4b9a6dad0f1314be086088c75f546e28c9ccb71ea8629d4770b1c66990943be60bff45a205f875c6670f90
|
|
diff --git a/dev-python/pycryptodomex/pycryptodomex-3.23.0.ebuild b/dev-python/pycryptodomex/pycryptodomex-3.23.0.ebuild
|
|
new file mode 100644
|
|
index 0000000000..34217abf06
|
|
--- /dev/null
|
|
+++ b/dev-python/pycryptodomex/pycryptodomex-3.23.0.ebuild
|
|
@@ -0,0 +1,23 @@
|
|
+EAPI=8
|
|
+
|
|
+DISTUTILS_EXT=1
|
|
+DISTUTILS_USE_PEP517=setuptools
|
|
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
|
|
+
|
|
+inherit distutils-r1 pypi
|
|
+
|
|
+DESCRIPTION="Self-contained package of low-level cryptographic primitives"
|
|
+HOMEPAGE="
|
|
+ https://www.pycryptodome.org
|
|
+ https://pypi.org/project/pycryptodomex/
|
|
+"
|
|
+
|
|
+LICENSE="BSD public-domain"
|
|
+SLOT="0"
|
|
+KEYWORDS="~amd64"
|
|
+
|
|
+DOCS=( README.rst )
|
|
+
|
|
+python_test() {
|
|
+ "${EPYTHON}" setup.py test || die -n "Tests failed with ${EPYTHON}"
|
|
+}
|
|
diff --git a/dev-python/pyosmocom/Manifest b/dev-python/pyosmocom/Manifest
|
|
new file mode 100644
|
|
index 0000000000..d986f7ce47
|
|
--- /dev/null
|
|
+++ b/dev-python/pyosmocom/Manifest
|
|
@@ -0,0 +1,2 @@
|
|
+DIST pyosmocom-0.0.9.tar.gz 50186 BLAKE2B 0635785a1c346d5f0f2b1874309dc458362c236e7f2842b1d770945862e6ecd0c1b478677c1890ce1c49c0fe1cc1c00cc357b9d7d23ea37ac108520213b76e8c SHA512 7ed76b03e05c13cd28dba1dfefa9d8cc71662b7c5fb9e39c9b5af985d08767981aa2cc9b7fc37b1ca310edb6eb7637e7ae57f3be79671b68b72842ac1192e3aa
|
|
+EBUILD pyosmocom-0.0.9.ebuild 517 BLAKE2B a684cf47b8a843a50755ec47ca6accedb8d244ecc6af2f1750f0d75238c511bb5582be0f9e914c1a8d50f42cc0b01233081761fe777da0c92cdd424c4c8b4169 SHA512 63b3dc286843712765617f1398df41ffae3bb4128ad737d091cf68a7a6a50c29eef1ba8e66f82c9fa6eebb55113df687acceeff9082d081b7dbc44fc4aa82ffc
|
|
diff --git a/dev-python/pyosmocom/pyosmocom-0.0.9.ebuild b/dev-python/pyosmocom/pyosmocom-0.0.9.ebuild
|
|
new file mode 100644
|
|
index 0000000000..95e4db5322
|
|
--- /dev/null
|
|
+++ b/dev-python/pyosmocom/pyosmocom-0.0.9.ebuild
|
|
@@ -0,0 +1,29 @@
|
|
+EAPI=8
|
|
+
|
|
+DISTUTILS_USE_PEP517=setuptools
|
|
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
|
|
+
|
|
+inherit distutils-r1 pypi
|
|
+
|
|
+DESCRIPTION="Python implementation of core osmocom utilities / protocols"
|
|
+HOMEPAGE="
|
|
+ https://osmocom.org/projects/pyosmocom/wiki
|
|
+ https://pypi.org/project/pyosmocom/
|
|
+"
|
|
+
|
|
+LICENSE="GPL-2"
|
|
+SLOT="0"
|
|
+KEYWORDS="~amd64"
|
|
+
|
|
+RDEPEND="
|
|
+ dev-python/gsm0338[${PYTHON_USEDEP}]
|
|
+ >=dev-python/construct-2.9.51[${PYTHON_USEDEP}]
|
|
+"
|
|
+
|
|
+DOCS=( README.md )
|
|
+
|
|
+distutils_enable_tests unittest
|
|
+
|
|
+python_test() {
|
|
+ eunittest -s tests
|
|
+}
|
|
diff --git a/dev-python/pytlv/Manifest b/dev-python/pytlv/Manifest
|
|
new file mode 100644
|
|
index 0000000000..d6b0516abf
|
|
--- /dev/null
|
|
+++ b/dev-python/pytlv/Manifest
|
|
@@ -0,0 +1,2 @@
|
|
+DIST pytlv-0.71.tar.gz 15715 BLAKE2B 1d1157d1fb31d91583963306c0c20d4cfccdd0432032b8a2e5fe6fa56abd2d034b0b6ce994a23e3453f0331cca534be9371710c8e3810d959b049950accb87d0 SHA512 291ce16870276e497cfd596e7c42e4f5c12174f196b37b655f0c0bc1dcf7435ecb82bdb7fb0926957b7c1b977c36898f3368bdf94b8ae27a27e674f57467db76
|
|
+EBUILD pytlv-0.71.ebuild 347 BLAKE2B 665cff9ac9e70c6d43a5d336562f8028713398999a04851b692b8ee566170773bfd49968340c139f42d8ccdcb40965a16446c7370e1145f17731a10292eef038 SHA512 ab4a04eb75e376705a98fc7ada3acd2d26b14ebf93bdb0c762e720e6067136c1f9359b1020bbdb83a6bb1380131ff19c604fb51c37ce8395ddc480f87c12456d
|
|
diff --git a/dev-python/pytlv/pytlv-0.71.ebuild b/dev-python/pytlv/pytlv-0.71.ebuild
|
|
new file mode 100644
|
|
index 0000000000..1a524402e7
|
|
--- /dev/null
|
|
+++ b/dev-python/pytlv/pytlv-0.71.ebuild
|
|
@@ -0,0 +1,22 @@
|
|
+EAPI=8
|
|
+
|
|
+DISTUTILS_USE_PEP517=setuptools
|
|
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
|
|
+
|
|
+inherit distutils-r1 pypi
|
|
+
|
|
+DESCRIPTION="TLV (tag length value) data parser"
|
|
+HOMEPAGE="
|
|
+ https://github.com/timgabets/pytlv
|
|
+ https://pypi.org/project/pytlv/
|
|
+"
|
|
+
|
|
+LICENSE="LGPL-2"
|
|
+SLOT="0"
|
|
+KEYWORDS="~amd64"
|
|
+
|
|
+DOCS=( README.md )
|
|
+
|
|
+python_test() {
|
|
+ eunittest -s pytlv
|
|
+}
|
|
diff --git a/dev-python/smpp-pdu-hologramio/Manifest b/dev-python/smpp-pdu-hologramio/Manifest
|
|
new file mode 100644
|
|
index 0000000000..359af820f5
|
|
--- /dev/null
|
|
+++ b/dev-python/smpp-pdu-hologramio/Manifest
|
|
@@ -0,0 +1,3 @@
|
|
+AUX smpp.pdu-0.3-drop-pkgutil-namespace.patch 1607 BLAKE2B 590fdf7b3a4588bde912db5279c0833da13e05594fa404c36ff0ff381b8fa28cc6e220a65f17f1c6591de981a4a09dbb6b0e7446a0d8cbec3a3e6c06657e33d7 SHA512 caae858dd3d713d8e94fa27ca780e0f75260ba25f4c9ba8055fa31ad4015746bd959648edaf02ae1c59571854232e3f82c878dfb7b50df792d6a62b81a94c62d
|
|
+DIST smpp-pdu-hologramio-0.3.gh.tar.gz 33869 BLAKE2B 7f7ff9b562547137496823b6b372b08e5872e48777e0f0c7f3da665429cc4c404c76f35eda9c33bde168790b2005efb4cff2f7718b892989961f74d442e2df0f SHA512 ea260a8436382c5152135a785a1f91537e318c74bed495bcee6cd48f89da74f81b69ea880fd9babbe20a5d0667ef23e20a9165a6e51235ffbac7b2d1196440ca
|
|
+EBUILD smpp-pdu-hologramio-0.3.ebuild 656 BLAKE2B ca0bf779aa0dca1da287d67d13beca1c6ba4c311b1074cfc20a275f51440626bcc630befca2c209ea3aaf30aa26db64c7bb7fb0504fb45f446b20be7b57f8824 SHA512 944c03c49795a7fc6c0ce29bd68f51134c3a2e1b05b573e7a869e9fe1d4d769ffe6df537198eca190042c59f37daab6d93961a59d483b8297b3cd41020a0cd7e
|
|
diff --git a/dev-python/smpp-pdu-hologramio/files/smpp.pdu-0.3-drop-pkgutil-namespace.patch b/dev-python/smpp-pdu-hologramio/files/smpp.pdu-0.3-drop-pkgutil-namespace.patch
|
|
new file mode 100644
|
|
index 0000000000..5df7f8c7b0
|
|
--- /dev/null
|
|
+++ b/dev-python/smpp-pdu-hologramio/files/smpp.pdu-0.3-drop-pkgutil-namespace.patch
|
|
@@ -0,0 +1,41 @@
|
|
+Drop pkgutil-style namespace to prevent collision with other smpp.*
|
|
+packages (e.g., smpp.twisted) and specify the package name/path
|
|
+explicitly.
|
|
+
|
|
+1. https://projects.gentoo.org/python/guide/concept.html#adding-new-namespace-packages-to-gentoo
|
|
+2. https://stackoverflow.com/questions/54430694/python-setup-py-how-to-get-find-packages-to-identify-packages-in-subdirectori
|
|
+--- a/setup.py
|
|
++++ b/setup.py
|
|
+@@ -9,7 +9,11 @@
|
|
+ author_email = "roger.hoover@gmail.com",
|
|
+ description = "Library for parsing Protocol Data Units (PDUs) in SMPP protocol",
|
|
+ license = 'Apache License 2.0',
|
|
+- packages = find_packages(exclude=["tests"]),
|
|
++ packages = ["smpp.pdu"],
|
|
++ package_dir = {
|
|
++ "": ".",
|
|
++ "smpp.pdu": "smpp/pdu",
|
|
++ },
|
|
+ keywords = "smpp pdu",
|
|
+ url = "https://github.com/mozes/smpp.pdu",
|
|
+ py_modules=["smpp.pdu"],
|
|
+--- a/smpp/__init__.py
|
|
++++ /dev/null
|
|
+@@ -1,16 +0,0 @@
|
|
+-"""
|
|
+-Copyright 2009-2010 Mozes, Inc.
|
|
+-
|
|
+- Licensed under the Apache License, Version 2.0 (the "License");
|
|
+- you may not use this file except in compliance with the License.
|
|
+- You may obtain a copy of the License at
|
|
+-
|
|
+- http://www.apache.org/licenses/LICENSE-2.0
|
|
+-
|
|
+- Unless required by applicable law or agreed to in writing, software
|
|
+- distributed under the License is distributed on an "AS IS" BASIS,
|
|
+- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied.
|
|
+- See the License for the specific language governing permissions and
|
|
+- limitations under the License.
|
|
+-"""
|
|
+-__path__ = __import__('pkgutil').extend_path(__path__, __name__)
|
|
+\ No newline at end of file
|
|
diff --git a/dev-python/smpp-pdu-hologramio/smpp-pdu-hologramio-0.3.ebuild b/dev-python/smpp-pdu-hologramio/smpp-pdu-hologramio-0.3.ebuild
|
|
new file mode 100644
|
|
index 0000000000..d923d79a7b
|
|
--- /dev/null
|
|
+++ b/dev-python/smpp-pdu-hologramio/smpp-pdu-hologramio-0.3.ebuild
|
|
@@ -0,0 +1,30 @@
|
|
+EAPI=8
|
|
+
|
|
+DISTUTILS_USE_PEP517=setuptools
|
|
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
|
|
+
|
|
+inherit distutils-r1
|
|
+
|
|
+MY_PN="smpp.pdu"
|
|
+MY_COMMIT="20acc840ded958898eeb35ae9a18df9b29bdaaac"
|
|
+DESCRIPTION="PDUs parsing in SMPP protocol - hologram-io patched"
|
|
+HOMEPAGE="
|
|
+ https://github.com/mozes/smpp.pdu
|
|
+ https://github.com/hologram-io/smpp.pdu
|
|
+"
|
|
+SRC_URI="https://github.com/hologram-io/${MY_PN}/archive/${MY_COMMIT}.tar.gz -> ${P}.gh.tar.gz"
|
|
+S="${WORKDIR}/${MY_PN}-${MY_COMMIT}"
|
|
+
|
|
+LICENSE="Apache-2.0"
|
|
+SLOT="0"
|
|
+KEYWORDS="~amd64"
|
|
+
|
|
+PATCHES=(
|
|
+ "${FILESDIR}/smpp.pdu-0.3-drop-pkgutil-namespace.patch"
|
|
+)
|
|
+
|
|
+distutils_enable_tests unittest
|
|
+
|
|
+python_test() {
|
|
+ eunittest -s tests
|
|
+}
|
|
diff --git a/dev-python/smpp-twisted3/Manifest b/dev-python/smpp-twisted3/Manifest
|
|
new file mode 100644
|
|
index 0000000000..e3a4a364ea
|
|
--- /dev/null
|
|
+++ b/dev-python/smpp-twisted3/Manifest
|
|
@@ -0,0 +1,3 @@
|
|
+AUX smpp.twisted3-0.8-drop-pkgutil-namespace.patch 1683 BLAKE2B 4fd97e7f327c4c7d1dc6f366e9d6171e63e3976a87834d78b964517d5d82beef8c1b372ac6cce8964648c545d567c71e06e8b866f5fccbb3a631c5973f19ac85 SHA512 1f0f5d493fd527d8bc3ad91bc84d5c64d83ab62a7c899fc606afc5aa91b4cc79e7bfa812fe84c2da77653509e681954b701a0b9c821df3856c787263a0e15422
|
|
+DIST smpp-twisted3-0.8.gh.tar.gz 22747 BLAKE2B 30417d4ad5813fba136d11cdefe691dde0ec6c58566b210082e5f4a17a18004643c2ab2187aff8820012aed7512823c910367f6ae53403fde029d6f1ebe2cbe6 SHA512 01014dee787dc61719d41f82552a88cf4c679e19f921732b41f50b7fd3a0c721d1d4b118730636c018d649a544f3ece88611cda93097a95c69640121d1ddc4a8
|
|
+EBUILD smpp-twisted3-0.8.ebuild 879 BLAKE2B 8692fb25ca7122f92cac75606bc092b3ac9bac26cb94eef449540fd833625b84e046f9088971261f6009cd95aef4bd3ecb0a7bc0737607b20c289cf530f0f517 SHA512 266d0592b38537c41c3c50e36e37c4c92fe7ea4f6c05aa5f601db6bd306a46a732b4dc2029e6a997997b19f7a3aacb4eed9b98e4cefb095c6ebb7dabf114f6bc
|
|
diff --git a/dev-python/smpp-twisted3/files/smpp.twisted3-0.8-drop-pkgutil-namespace.patch b/dev-python/smpp-twisted3/files/smpp.twisted3-0.8-drop-pkgutil-namespace.patch
|
|
new file mode 100644
|
|
index 0000000000..43e2851016
|
|
--- /dev/null
|
|
+++ b/dev-python/smpp-twisted3/files/smpp.twisted3-0.8-drop-pkgutil-namespace.patch
|
|
@@ -0,0 +1,42 @@
|
|
+Drop pkgutil-style namespace to prevent collision with other smpp.*
|
|
+packages (e.g., smpp.pdu) and specify the package name/path explicitly.
|
|
+The last one also prevents 'examples' installation into the site
|
|
+packages.
|
|
+
|
|
+1. https://projects.gentoo.org/python/guide/concept.html#adding-new-namespace-packages-to-gentoo
|
|
+2. https://stackoverflow.com/questions/54430694/python-setup-py-how-to-get-find-packages-to-identify-packages-in-subdirectori
|
|
+--- a/setup.py
|
|
++++ b/setup.py
|
|
+@@ -19,7 +19,11 @@ setup(
|
|
+ author_email="roger.hoover@gmail.com",
|
|
+ description="SMPP 3.4 client built on Twisted / Python3",
|
|
+ license='Apache License 2.0',
|
|
+- packages=find_packages(exclude=["tests"]),
|
|
++ packages=["smpp.twisted"],
|
|
++ package_dir={
|
|
++ "": ".",
|
|
++ "smpp.twisted": "smpp/twisted",
|
|
++ },
|
|
+ long_description=read('README.md'),
|
|
+ long_description_content_type='text/markdown',
|
|
+ keywords="smpp twisted",
|
|
+--- a/smpp/__init__.py
|
|
++++ /dev/null
|
|
+@@ -1,16 +0,0 @@
|
|
+-"""
|
|
+-Copyright 2009-2010 Mozes, Inc.
|
|
+-
|
|
+- Licensed under the Apache License, Version 2.0 (the "License");
|
|
+- you may not use this file except in compliance with the License.
|
|
+- You may obtain a copy of the License at
|
|
+-
|
|
+- http://www.apache.org/licenses/LICENSE-2.0
|
|
+-
|
|
+- Unless required by applicable law or agreed to in writing, software
|
|
+- distributed under the License is distributed on an "AS IS" BASIS,
|
|
+- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied.
|
|
+- See the License for the specific language governing permissions and
|
|
+- limitations under the License.
|
|
+-"""
|
|
+-__path__ = __import__('pkgutil').extend_path(__path__, __name__)
|
|
+\ No newline at end of file
|
|
diff --git a/dev-python/smpp-twisted3/smpp-twisted3-0.8.ebuild b/dev-python/smpp-twisted3/smpp-twisted3-0.8.ebuild
|
|
new file mode 100644
|
|
index 0000000000..832a11db50
|
|
--- /dev/null
|
|
+++ b/dev-python/smpp-twisted3/smpp-twisted3-0.8.ebuild
|
|
@@ -0,0 +1,41 @@
|
|
+EAPI=8
|
|
+
|
|
+DISTUTILS_USE_PEP517=setuptools
|
|
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
|
|
+
|
|
+inherit distutils-r1
|
|
+
|
|
+MY_PN="smpp.twisted"
|
|
+MY_COMMIT="c9b266f54e44e7aff964b64cfb05ca1ecbcd7710"
|
|
+DESCRIPTION="SMPP 3.4 client built on Twisted"
|
|
+HOMEPAGE="
|
|
+ https://github.com/jookies/smpp.twisted
|
|
+ https://pypi.org/project/smpp.twisted3/
|
|
+"
|
|
+# Direct download due to smsc_simulator.py absense in PyPi archive causing test failure
|
|
+SRC_URI="https://github.com/jookies/${MY_PN}/archive/${MY_COMMIT}.tar.gz -> ${P}.gh.tar.gz"
|
|
+S="${WORKDIR}/${MY_PN}-${MY_COMMIT}"
|
|
+
|
|
+LICENSE="Apache-2.0"
|
|
+SLOT="0"
|
|
+KEYWORDS="~amd64"
|
|
+IUSE="test"
|
|
+RESTRICT="!test? ( test )"
|
|
+
|
|
+RDEPEND="
|
|
+ dev-python/twisted[${PYTHON_USEDEP}]
|
|
+"
|
|
+BDEPEND="
|
|
+ ${RDEPEND}
|
|
+ test? (
|
|
+ dev-python/mock[${PYTHON_USEDEP}]
|
|
+ )
|
|
+"
|
|
+
|
|
+PATCHES=(
|
|
+ "${FILESDIR}/smpp.twisted3-0.8-drop-pkgutil-namespace.patch"
|
|
+)
|
|
+
|
|
+DOCS=( README.md )
|
|
+
|
|
+distutils_enable_tests unittest
|
|
diff --git a/sys-apps/pysim/Manifest b/sys-apps/pysim/Manifest
|
|
new file mode 100644
|
|
index 0000000000..6b9f211e83
|
|
--- /dev/null
|
|
+++ b/sys-apps/pysim/Manifest
|
|
@@ -0,0 +1 @@
|
|
+EBUILD pysim-9999.ebuild 1189 BLAKE2B f6102ff49995c0be673ff84bf58876dea297001fefd9269f4face23787ba69359b19007da9a908a48d2d1033e9d9ec0da52e5b51b4fc52892f8b705f60079bee SHA512 9e83b839c970b81326f3176a26371596256da17aac7f430e0450c4efc323a8a77ba5eb36dc300b9cbdea414ac897a91060ce28b45e537f52c9b3d4bfdcb71eb0
|
|
diff --git a/sys-apps/pysim/pysim-9999.ebuild b/sys-apps/pysim/pysim-9999.ebuild
|
|
new file mode 100644
|
|
index 0000000000..69a42a644b
|
|
--- /dev/null
|
|
+++ b/sys-apps/pysim/pysim-9999.ebuild
|
|
@@ -0,0 +1,50 @@
|
|
+EAPI=8
|
|
+
|
|
+DISTUTILS_SINGLE_IMPL=1
|
|
+DISTUTILS_USE_PEP517=setuptools
|
|
+PYTHON_COMPAT=( python3_{11..14} )
|
|
+
|
|
+inherit distutils-r1 optfeature
|
|
+
|
|
+EGIT_REPO_URI="https://github.com/osmocom/pysim.git"
|
|
+inherit git-r3
|
|
+
|
|
+DESCRIPTION="Read, Write and Browse Programmable SIM/USIM Cards"
|
|
+HOMEPAGE="https://osmocom.org/projects/pysim/wiki"
|
|
+
|
|
+LICENSE="GPL-2"
|
|
+SLOT="0"
|
|
+KEYWORDS=""
|
|
+
|
|
+RDEPEND="
|
|
+ dev-python/pyscard
|
|
+ dev-python/pyserial
|
|
+ dev-python/pytlv
|
|
+ >=dev-python/cmd2-2.6.2
|
|
+ dev-python/jsonpath-ng
|
|
+ >=dev-python/construct-2.10.70
|
|
+ dev-python/bidict
|
|
+ >=dev-python/pyosmocom-0.0.9
|
|
+ >=dev-python/pyyaml-5.1
|
|
+ dev-python/termcolor
|
|
+ dev-python/colorlog
|
|
+ dev-python/pycryptodomex
|
|
+ dev-python/cryptography
|
|
+ dev-python/asn1tools-osmocom
|
|
+ dev-python/packaging
|
|
+ dev-python/smpp-pdu-hologramio
|
|
+ dev-python/smpp-twisted3
|
|
+"
|
|
+
|
|
+distutils_enable_tests unittest
|
|
+
|
|
+python_test() {
|
|
+ # NB: run only unit tests since all other are integration tests and require
|
|
+ # PCSC reader with physical card.
|
|
+ eunittest -s tests/unittests
|
|
+}
|
|
+
|
|
+pkg_postinst() {
|
|
+ optfeature "CCID driver for compatible smartcard readers" app-crypt/ccid
|
|
+ optfeature "Troubleshoot SIM card and (or) PCSC-compatible reader connectivity issues" sys-apps/pcsc-tools
|
|
+}
|