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 <fiona.klute@gmx.de>
Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
(cherry picked from commit 8cde69e101)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
Fiona Klute
2026-04-26 17:33:34 +02:00
committed by Thomas Perale
parent 0b36bd22e8
commit 3d586c429b

View File

@@ -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()