From cb4e02c6ac0eddf9b7aecdf2871076d5b32ef0d1 Mon Sep 17 00:00:00 2001 From: Fiona Klute Date: Sun, 26 Apr 2026 17:33:34 +0200 Subject: [PATCH] support/scripts/pkg-stats: run main function only if called as script The __name__ == '__main__' guard allows importing pkg-stats as a module using importlib, circumventing the normal module filename requirements. This in turn makes it possible to test/debug individual functions. Signed-off-by: Fiona Klute Signed-off-by: Arnout Vandecappelle (cherry picked from commit 8cde69e1011e82e44447803d6dbbaac96375d0a7) Signed-off-by: Thomas Perale --- support/scripts/pkg-stats | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index 5dcc812e2b..2b2194b9a5 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -1334,7 +1334,7 @@ def is_newer_version_available(pkg): ) -def __main__(): +def main(): global cvecheck args = parse_args() @@ -1403,4 +1403,5 @@ def __main__(): dump_json(packages, defconfigs, stats, date, commit, args.json) -__main__() +if __name__ == '__main__': + main()