mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-25 11:30:37 -09:00
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>
This commit is contained in:
committed by
Arnout Vandecappelle
parent
07f7ad9898
commit
8cde69e101
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user