Re: [PATCH v2 07/13] vt: introduce gen_ucs_recompose_table.py to create ucs_recompose_table.h

From: Jiri Slaby
Date: Wed Apr 16 2025 - 00:29:19 EST


On 15. 04. 25, 21:17, Nicolas Pitre wrote:
From: Nicolas Pitre <npitre@xxxxxxxxxxxx>

The generated table maps base character + combining mark pairs to their
precomposed equivalents using Python's unicodedata module.

The default script behavior is to create a table with most commonly used
Latin, Greek, and Cyrillic recomposition pairs only. It is much smaller
than the table with all possible recomposition pairs (71 entries vs 1000
entries). But if one needs/wants the full table then simply running the
script with the --full argument will generate it.

Signed-off-by: Nicolas Pitre <npitre@xxxxxxxxxxxx>
---
drivers/tty/vt/gen_ucs_recompose_table.py | 255 ++++++++++++++++++++++
1 file changed, 255 insertions(+)
create mode 100755 drivers/tty/vt/gen_ucs_recompose_table.py

diff --git a/drivers/tty/vt/gen_ucs_recompose_table.py b/drivers/tty/vt/gen_ucs_recompose_table.py
new file mode 100755
index 0000000000..91e81fb1c9
--- /dev/null
+++ b/drivers/tty/vt/gen_ucs_recompose_table.py
@@ -0,0 +1,255 @@
+#!/usr/bin/env python3
...
+ # Generate implementation file
+ with open(out_file, 'w') as f:
+ f.write(f"""\
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * {out_file} - Unicode character recomposition
+ *
+ * Auto-generated by {this_file}{generation_mode}
+ *
+ * Unicode Version: {unicodedata.unidata_version}
+ *
+{textwrap.fill(
+ f"This file contains a table with {table_description_detail}. " +
+ f"To generate a table with {alt_description_detail} instead, run:",
+ width=75, initial_indent=" * ", subsequent_indent=" * ")}
+ *
+ * python {this_file}{alternative_mode}

This should be python3. Or no 'python' at all -- I assume the script is executable given "new file mode 100755".

Reviewed-by: Jiri Slaby <jirislaby@xxxxxxxxxx>

--
js
suse labs