2 """Check that all exported symbols are specified in the symbol version scripts.
4 If this fails, please update the appropriate .map file (adding new version
13 top_srcdir = pathlib.Path(os.environ['top_srcdir'])
16 def symbols_from_map(path):
17 return re.findall(r'^\s+(xkb_.*);', path.read_text('utf-8'), re.MULTILINE)
20 def symbols_from_src(path):
21 return re.findall(r'XKB_EXPORT.*\n(xkb_.*)\(', path.read_text('utf-8'))
24 def diff(map_path, src_paths):
25 map_symbols = set(symbols_from_map(map_path))
26 src_symbols = set.union(set(), *(symbols_from_src(path) for path in src_paths))
27 return sorted(map_symbols - src_symbols), sorted(src_symbols - map_symbols)
34 top_srcdir/'xkbcommon.map',
36 *(top_srcdir/'src').glob('*.c'),
37 *(top_srcdir/'src'/'xkbcomp').glob('*.c'),
38 *(top_srcdir/'src'/'compose').glob('*.c'),
42 print('xkbcommon map has extra symbols:', ' '.join(left))
45 print('xkbcommon src has extra symbols:', ' '.join(right))
48 # xkbcommon-x11 symbols
50 top_srcdir/'xkbcommon-x11.map',
52 *(top_srcdir/'src'/'x11').glob('*.c'),
56 print('xkbcommon-x11 map has extra symbols:', ' '.join(left))
59 print('xkbcommon-x11 src has extra symbols:', ' '.join(right))