File: list-icons-provided.py

package info (click to toggle)
adwaita-icon-theme 48.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,108 kB
  • sloc: python: 1,277; sh: 58; makefile: 11
file content (42 lines) | stat: -rwxr-xr-x 953 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python3

import argparse
import os
import typing
from pathlib import Path

EXTS = (
    '.png',
    '-rtl.png',
    '.svg',
    '-symbolic.symbolic.png',
    '-symbolic.svg',
    '-symbolic-rtl.svg',
)

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('sysroot')

    args = parser.parse_args()
    sysroot = Path(args.sysroot)

    #: name with no extension, -rtl or -symbolic suffix
    available: typing.Set[str] = set()

    for dirpath, dirnames, filenames in os.walk(sysroot / 'usr/share/icons'):
        if 'cursors' in dirnames:
            dirnames.remove('cursors')

        for name in filenames:
            # remove up to 2 extensions (.symbolic.png), but do not
            # remove -rtl or -symbolic
            name = Path(Path(name).stem).stem
            available.add(name)

    print(f'# icons in {sysroot}:')

    for name in sorted(available):
        print(name)

    print('')