1import pkgutil
2import sys
3import fontTools
4import importlib
5import os
6from pathlib import Path
7
8
9def main():
10    """Show this help"""
11    path = fontTools.__path__
12    descriptions = {}
13    for pkg in sorted(
14        mod.name
15        for mod in pkgutil.walk_packages([fontTools.__path__[0]], prefix="fontTools.")
16    ):
17        try:
18            imports = __import__(pkg, globals(), locals(), ["main"])
19        except ImportError as e:
20            continue
21        try:
22            description = imports.main.__doc__
23            if description:
24                pkg = pkg.replace("fontTools.", "").replace(".__main__", "")
25                descriptions[pkg] = description
26        except AttributeError as e:
27            pass
28    for pkg, description in descriptions.items():
29        print("fonttools %-12s %s" % (pkg, description), file=sys.stderr)
30
31
32if __name__ == "__main__":
33    print("fonttools v%s\n" % fontTools.__version__, file=sys.stderr)
34    main()
35