support/scripts/size-stats: count compiled python (.pyc) files

Any .pyc files generated by the pycompile script during target
finalization are currently counted in the "Unknown" package,
because packages-file-list.txt only contains the source .py file.

If a .py file is added to filesdict, add the corresponding .pyc
file as well.

Signed-off-by: Michael Klein <m.klein@mvz-labor-lb.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Michael Klein 2022-09-01 13:40:07 +02:00 committed by Thomas Petazzoni
parent 68c32ce338
commit a54a7bf805

View File

@ -54,6 +54,9 @@ class Config:
# pkg: package to which the file belongs # pkg: package to which the file belongs
# #
def add_file(filesdict, relpath, abspath, pkg): def add_file(filesdict, relpath, abspath, pkg):
if relpath.endswith(".py"):
# also check for compiled .pyc file
add_file(filesdict, relpath + "c", abspath + "c", pkg)
if not os.path.exists(abspath): if not os.path.exists(abspath):
return return
if os.path.islink(abspath): if os.path.islink(abspath):