Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] size-stats: count compiled python (.pyc) files
@ 2022-09-01 11:40 Michael Klein via buildroot
  2022-09-24  8:35 ` Thomas Petazzoni
  2022-09-30 15:11 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Klein via buildroot @ 2022-09-01 11:40 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas De Schampheleire

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>
---
 support/scripts/size-stats | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/support/scripts/size-stats b/support/scripts/size-stats
index e4389e99b5..79c0dc571e 100755
--- a/support/scripts/size-stats
+++ b/support/scripts/size-stats
@@ -54,6 +54,9 @@ class Config:
 # pkg: package to which the file belongs
 #
 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):
         return
     if os.path.islink(abspath):
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] size-stats: count compiled python (.pyc) files
  2022-09-01 11:40 [Buildroot] [PATCH 1/1] size-stats: count compiled python (.pyc) files Michael Klein via buildroot
@ 2022-09-24  8:35 ` Thomas Petazzoni
  2022-09-30 15:11 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2022-09-24  8:35 UTC (permalink / raw)
  To: Michael Klein via buildroot; +Cc: Michael Klein, Thomas De Schampheleire

On Thu, 1 Sep 2022 13:40:07 +0200
Michael Klein via buildroot <buildroot@buildroot.org> wrote:

> 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>
> ---
>  support/scripts/size-stats | 3 +++
>  1 file changed, 3 insertions(+)

We indeed don't have a very good mechanism to "connect" files generated
during the target-finalize step with their original package in a
generic way, so for now what you did is I believe good enough to solve
this very common case of .pyc files, and therefore I've applied to
master. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] size-stats: count compiled python (.pyc) files
  2022-09-01 11:40 [Buildroot] [PATCH 1/1] size-stats: count compiled python (.pyc) files Michael Klein via buildroot
  2022-09-24  8:35 ` Thomas Petazzoni
@ 2022-09-30 15:11 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2022-09-30 15:11 UTC (permalink / raw)
  To: Michael Klein via buildroot; +Cc: Michael Klein, Thomas De Schampheleire

>>>>> "Michael" == Michael Klein via buildroot <buildroot@buildroot.org> writes:

 > 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>

Committed to 2022.02.x, 2022.05.x and 2022.08.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-30 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-01 11:40 [Buildroot] [PATCH 1/1] size-stats: count compiled python (.pyc) files Michael Klein via buildroot
2022-09-24  8:35 ` Thomas Petazzoni
2022-09-30 15:11 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox