Browse Source

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>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Michael Klein 2 years ago
parent
commit
adf8a8dcde
1 changed files with 3 additions and 0 deletions
  1. 3 0
      support/scripts/size-stats

+ 3 - 0
support/scripts/size-stats

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