From 851d22da6e764cf10fc07aacead14f32fba33195 Mon Sep 17 00:00:00 2001 From: deftk Date: Tue, 10 Oct 2023 20:23:42 +0200 Subject: [PATCH] Make check_layout.py independent from dir structure --- check_layout.output | 86 ++++++++++++++++++++++----------------------- check_layout.py | 16 ++++----- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/check_layout.output b/check_layout.output index 13123bd..ff13983 100644 --- a/check_layout.output +++ b/check_layout.output @@ -1,119 +1,119 @@ -# res/xml/arab_alt.xml +# arab_alt Layout includes some ASCII punctuation but not all, missing: !, ", ', +, -, /, :, ;, <, =, >, ?, [, \, ], _, |, ~ Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 2 warnings -# res/xml/arab_pc.xml +# arab_pc Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, | 1 warnings -# res/xml/arab_pc_ckb.xml +# arab_pc_ckb Layout includes some ASCII punctuation but not all, missing: ", %, ', +, ,, ., :, ;, <, =, >, ?, `, |, ~ 1 warnings -# res/xml/arab_pc_ir.xml +# arab_pc_ir Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], `, {, |, } 1 warnings -# res/xml/armenian_ph_am.xml +# armenian_ph_am Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 1 warnings -# res/xml/beng_national.xml +# beng_national Layout includes some ASCII punctuation but not all, missing: $ Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 2 warnings -# res/xml/beng_provat.xml +# beng_provat Layout includes some ASCII punctuation but not all, missing: $, &, *, ., /, <, >, [, \, ], `, {, |, } Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 2 warnings -# res/xml/cyrl_jcuken_ru.xml +# cyrl_jcuken_ru 0 warnings -# res/xml/cyrl_jcuken_uk.xml +# cyrl_jcuken_uk 0 warnings -# res/xml/cyrl_ueishsht.xml +# cyrl_ueishsht 0 warnings -# res/xml/cyrl_yaverti.xml +# cyrl_yaverti Layout includes some ASCII punctuation but not all, missing: ~ 1 warnings -# res/xml/deva_alt.xml +# deva_alt Layout includes some ASCII punctuation but not all, missing: #, $, %, &, ', (, ), +, ., /, :, <, =, >, [, \, ], ^, _, `, {, |, }, ~ Layout doesn't define some important keys, missing: esc, f11_placeholder, f12_placeholder, tab 2 warnings -# res/xml/deva_inscript.xml +# deva_inscript Duplicate keys: , ред Layout includes some ASCII punctuation but not all, missing: ", $, ', ^, _, `, | Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 3 warnings -# res/xml/grek_qwerty.xml +# grek_qwerty Duplicate keys: ; 1 warnings -# res/xml/hang_dubeolsik_kr.xml +# hang_dubeolsik_kr 0 warnings -# res/xml/hebr_1_il.xml +# hebr_1_il Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, } 1 warnings -# res/xml/hebr_2_il.xml +# hebr_2_il Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, } 1 warnings -# res/xml/latn_azerty_fr.xml +# latn_azerty_fr 0 warnings -# res/xml/latn_bepo_fr.xml +# latn_bepo_fr Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 1 warnings -# res/xml/latn_bone.xml +# latn_bone Layout includes some ASCII punctuation but not all, missing: $ Layout redefines the bottom row but some important keys are missing, missing: switch_backward 2 warnings -# res/xml/latn_colemak.xml +# latn_colemak 0 warnings -# res/xml/latn_dvorak.xml +# latn_dvorak 0 warnings -# res/xml/latn_neo2.xml +# latn_neo2 0 warnings -# res/xml/latn_qwerty_br.xml +# latn_qwerty_br 0 warnings -# res/xml/latn_qwerty_cz.xml +# latn_qwerty_cz Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 1 warnings -# res/xml/latn_qwerty_es.xml +# latn_qwerty_es 0 warnings -# res/xml/latn_qwerty_hu.xml +# latn_qwerty_hu 0 warnings -# res/xml/latn_qwerty_lv.xml +# latn_qwerty_lv 0 warnings -# res/xml/latn_qwerty_no.xml +# latn_qwerty_no 0 warnings -# res/xml/latn_qwerty_pl.xml +# latn_qwerty_pl 0 warnings -# res/xml/latn_qwerty_ro.xml +# latn_qwerty_ro 0 warnings -# res/xml/latn_qwerty_se.xml +# latn_qwerty_se Duplicate keys: !, ', ,, -, ., ? 1 warnings -# res/xml/latn_qwerty_tr.xml +# latn_qwerty_tr Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 1 warnings -# res/xml/latn_qwerty_us.xml +# latn_qwerty_us 0 warnings -# res/xml/latn_qwerty_vi.xml +# latn_qwerty_vi Layout includes some ASCII punctuation but not all, missing: \ 1 warnings -# res/xml/latn_qwertz.xml +# latn_qwertz 0 warnings -# res/xml/latn_qwertz_cz.xml +# latn_qwertz_cz Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 1 warnings -# res/xml/latn_qwertz_cz_multifunctional.xml +# latn_qwertz_cz_multifunctional Layout includes some ASCII punctuation but not all, missing: ` Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 2 warnings -# res/xml/latn_qwertz_de.xml +# latn_qwertz_de 0 warnings -# res/xml/latn_qwertz_fr_ch.xml +# latn_qwertz_fr_ch 0 warnings -# res/xml/latn_qwertz_hu.xml +# latn_qwertz_hu 0 warnings -# res/xml/latn_qwertz_sk.xml +# latn_qwertz_sk Layout includes some ASCII punctuation but not all, missing: \, ` Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder 2 warnings -# res/xml/urdu_phonetic_ur.xml +# urdu_phonetic_ur Duplicate keys: Layout includes some ASCII punctuation but not all, missing: <, >, ?, `, |, ~ Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder diff --git a/check_layout.py b/check_layout.py index 66b6bbe..efa34d8 100644 --- a/check_layout.py +++ b/check_layout.py @@ -1,13 +1,12 @@ import xml.etree.ElementTree as ET -import sys +import sys, os warning_count = 0 KNOWN_NOT_LAYOUT = set([ - "res/xml/number_row.xml", "res/xml/numpad.xml", "res/xml/pin.xml", - "res/xml/bottom_row.xml", "res/xml/settings.xml", "res/xml/method.xml", - "res/xml/greekmath.xml", "res/xml/numeric.xml", - "res/xml/emoji_bottom_row.xml" ]) + "number_row", "numpad", "pin", + "bottom_row", "settings", "method", + "greekmath", "numeric", "emoji_bottom_row" ]) def warn(msg): global warning_count @@ -85,13 +84,14 @@ def check_layout(layout): warn("Layout doesn't specify a script.") for fname in sorted(sys.argv[1:]): - if fname in KNOWN_NOT_LAYOUT: + layout_id, _ = os.path.splitext(os.path.basename(fname)) + if layout_id in KNOWN_NOT_LAYOUT: continue layout = parse_layout(fname) if layout == None: - print("Not a layout file: %s" % fname) + print("Not a layout file: %s" % layout_id) else: - print("# %s" % fname) + print("# %s" % layout_id) warning_count = 0 check_layout(layout) print("%d warnings" % warning_count)