GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — codeql/misc/scripts/check-qhelp.py at codeql-cli/v2.25.0 · github/codeql Expand file tree/ Copy pathcheck-qhelp.pyMore file actions executable file ·75 lines (53 loc) · 1.75 KB / Copy pathcheck-qhelp.pyFile metadata and controlsexecutable file ·75 lines (53 loc) · 1.75 KB 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 #!/bin/env python3 """cross platform wrapper around codeql generate query-help to check .qhelp files This takes care of: * providing a temporary directory to --output * finding usages of .inc.qhelp arguments """ import pathlib import subprocess import sys import tempfile import xml.sax include_cache = {} class IncludeHandler(xml.sax.ContentHandler): def __init__(self, xml): super().__init__() self.__xml = xml def startElement(self, name, attrs): if name == "include": src = (self.__xml.parent / attrs["src"]).resolve() include_cache.setdefault(src, set()).add(self.__xml) class IgnoreErrorsHandler(xml.sax.ErrorHandler): def error(self, exc): pass def fatalError(self, exc): pass def warning(self, exc): pass def init_include_cache(): if not include_cache: for qhelp in pathlib.Path().rglob("*.qhelp"): xml.sax.parse(qhelp, IncludeHandler(qhelp), IgnoreErrorsHandler()) def find_inc_qhelp_usages(arg): init_include_cache() return include_cache.get(arg.resolve(), ()) def transform_inputs(args): for arg in args: arg = pathlib.Path(arg) if arg.suffixes == ['.inc', '.qhelp']: for qhelp in find_inc_qhelp_usages(arg): yield str(qhelp) else: yield str(arg) affected_qhelp_files = list(transform_inputs(sys.argv[1:])) if not affected_qhelp_files: # can happen with changes on an unused .inc.qhelp file print("nothing to do!") sys.exit(0) cmd = ["codeql", "generate", "query-help", "--format=markdown"] with tempfile.TemporaryDirectory() as tmp: cmd += [f"--output={tmp}", "--"] cmd += affected_qhelp_files res = subprocess.run(cmd) sys.exit(res.returncode) |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |