summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2024-02-15 15:58:35 +1000
committerSergey Udaltsov <sergey.udaltsov@gmail.com>2024-05-24 14:08:14 +0000
commiteb68773835e0317f23eced8997f2548d11f84ca6 (patch)
tree102c6ad352fe97648c595485099d41d16a3ab655 /rules
parentd5fc2a7d026acdf0a13c43f2fe8d314f9b984d73 (diff)
rules: use symlinks to resolve mismatches between option names and files
Use in-repository-only symlinks between symbols files that help us to resolve option mismatches, e.g. where we need to map caps:foo to capslock(foo). This effectively reverts symbols: symlink the special rules prefixes to our symbols files
Diffstat (limited to 'rules')
-rwxr-xr-xrules/generate-options-symbols.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/rules/generate-options-symbols.py b/rules/generate-options-symbols.py
index fcd3906a..d4eee5da 100755
--- a/rules/generate-options-symbols.py
+++ b/rules/generate-options-symbols.py
@@ -162,12 +162,20 @@ def resolve_option(option: Option) -> DirectiveSet:
else:
continue
+ if (subdir / filename).is_symlink():
+ resolved_filename = (subdir / filename).resolve().name
+ assert (subdir / filename).exists()
+ else:
+ resolved_filename = filename
+
# Now check if the target file actually has that section
- f = subdir / filename
+ f = subdir / resolved_filename
with open(f) as fd:
found = any(f'{section_header} "{section}"' in line for line in fd)
if found:
- directives[section_header] = Directive(option, filename, section)
+ directives[section_header] = Directive(
+ option, resolved_filename, section
+ )
return DirectiveSet(
option=option,