From 29cbf732dc8a75251a840ff0f955a50fe4d34fd7 Mon Sep 17 00:00:00 2001 From: Mark Gillard Date: Sun, 10 Sep 2023 15:19:02 +0300 Subject: [PATCH] added doxygen version to bug report metadata --- .gitignore | 3 ++- src/poxy/doxygen.py | 21 ++++++++++++++------- src/poxy/main.py | 4 ++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 7bd1fb2..754acf5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ -# test outputs +# misc outputs tests/**/html/ tests/**/xml/ tests/**/latex/ +poxy_bug_report.zip # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/src/poxy/doxygen.py b/src/poxy/doxygen.py index 3875982..750995a 100644 --- a/src/poxy/doxygen.py +++ b/src/poxy/doxygen.py @@ -113,15 +113,22 @@ def test_path(p): return path.val -def version() -> Tuple[int, int, int]: - if not hasattr(version, "val"): +def raw_version_string() -> str: + if not hasattr(raw_version_string, "val"): proc = subprocess.run([str(path()), r'--version'], capture_output=True, encoding=r'utf-8', check=True) - ret = proc.stdout.strip() if proc.stdout is not None else '' - if not ret and proc.stderr.strip(): + val = proc.stdout.strip() if proc.stdout is not None else '' + if not val and proc.stderr.strip(): raise Error(rf'doxygen exited with error: {proc.stderr.strip()}') - ret = re.fullmatch(r'^\s*v?\s*([0-9]+)\s*[.]\s*([0-9]+)\s*[.]\s*([0-9]+)(?:[^0-9].*)?$', ret, flags=re.I) - assert ret - version.val = (int(ret[1]), int(ret[2]), int(ret[3])) + setattr(raw_version_string, 'val', val) + return raw_version_string.val + + +def version() -> Tuple[int, int, int]: + if not hasattr(version, "val"): + val = raw_version_string() + val = re.fullmatch(r'^\s*v?\s*([0-9]+)\s*[.]\s*([0-9]+)\s*[.]\s*([0-9]+)(?:[^0-9].*)?$', val, flags=re.I) + assert val + setattr(version, 'val', (int(val[1]), int(val[2]), int(val[3]))) return version.val diff --git a/src/poxy/main.py b/src/poxy/main.py index d9023db..b99369a 100644 --- a/src/poxy/main.py +++ b/src/poxy/main.py @@ -111,6 +111,10 @@ def bug_report(): f.write(f'version: {VERSION_STRING}\n') f.write(f'args: {bug_report_args}\n') f.write(f'returncode: {result.returncode}\n') + try: + f.write(f'doxygen: {doxygen.raw_version_string()}\n') + except: + f.write(f'doxygen: --version failed\n') # zip file print(r'Zipping files')