[Buildroot] [PATCH v2 6/6] support/scripts/pkg-stats: run main function only if called as script
Thomas Perale
thomas.perale at mind.be
Fri May 15 17:46:35 UTC 2026
In reply of:
> 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 at gmx.de>
Applied to 2025.02.x & 2026.02.x. Thanks
> ---
> 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()
> --
> 2.53.0
>
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
More information about the buildroot
mailing list