Skip to contentSkip to conversation

python3-native: Drop opt-1 and opt-2 pyc files

PATCH Richard Purdie 2 participants 2 messages Mar 3, 2022 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 19 lines · Richard Purdie via lists.openembedded.org

There are over 3,000 of these in python3-native (of 8,000+ files total) and copying them to sysroots all the time seems pointless, particularly since they're only used if python is run with the -O or -OO parameters.

Get rid of them and save the overhead. This is particularly pronounced in builds using the api-documentation distro feature.

---
 meta/recipes-devtools/python/python3_3.10.2.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-devtools/python/python3_3.10.2.bb +0 -0
index 429839b6226..b28aa6505a0 100644
@@ -152,6 +152,11 @@ do_install:append:class-native() {
         # (these often end up too long for the #! parser in the kernel as the

meta/recipes-devtools/python/python3_3.10.2.bb do_install:append:class-native() { · line 162

Quoted 10 lines
meta/recipes-devtools/python/python3_3.10.2.bb +5 -0
         # buffer is 128 bytes long).
         ln -s python3-native/python3 ${D}${bindir}/nativepython3
+
+        # Remove the opt-1.pyc and opt-2.pyc files. There are over 3,000 of them
+        # and the overhead in each recipe-sysroot-native isn't worth it, particularly
+        # when they're only used for python called with -O or -OO.
+        find ${D} -name *opt-*.pyc -delete
 }
 
 do_install:append() {

This does pose an interesting dilemma. We could just go this far, or should we remove the remaining pyc files (~1,500 of them) and let python create them as needed, or do we disable them from python entirely?

Cheers,

Richard

#2 lore raw

Richard Purdie <[email protected]> escreveu no dia quinta, 3/03/2022 à(s) 14:37:

Quoted 35 lines
Quoted 1 line · Richard Purdie via lists.openembedded.org

There are over 3,000 of these in python3-native (of 8,000+ files total)

and

Quoted 6 lines

copying them to sysroots all the time seems pointless, particularly since they're only used if python is run with the -O or -OO parameters.

Get rid of them and save the overhead. This is particularly pronounced in builds using the api-documentation distro feature.

Review

Quoted 6 lines
---
 meta/recipes-devtools/python/python3_3.10.2.bb | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/meta/recipes-devtools/python/python3_3.10.2.bb

meta/recipes-devtools/python/python3_3.10.2.bb do_install:append:class-native() { · line 152

Quoted 5 lines

index 429839b6226..b28aa6505a0 100644

meta/recipes-devtools/python/python3_3.10.2.bb +0 -0
@@ -152,6 +152,11 @@ do_install:append:class-native() {
         # (these often end up too long for the #! parser in the kernel

as the

meta/recipes-devtools/python/python3_3.10.2.bb do_install:append:class-native() { · line 156

Quoted 4 lines
meta/recipes-devtools/python/python3_3.10.2.bb +2 -0
         # buffer is 128 bytes long).
         ln -s python3-native/python3 ${D}${bindir}/nativepython3
+
+        # Remove the opt-1.pyc and opt-2.pyc files. There are over

3,000 of them

meta/recipes-devtools/python/python3_3.10.2.bb do_install:append:class-native() { · line 157

Quoted 1 line
meta/recipes-devtools/python/python3_3.10.2.bb +1 -0
+        # and the overhead in each recipe-sysroot-native isn't worth

it, particularly

Quoted 4 lines
meta/recipes-devtools/python/python3_3.10.2.bb +2 -0
+        # when they're only used for python called with -O or -OO.
+        find ${D} -name *opt-*.pyc -delete
 }
 
Quoted 9 lines

meta/recipes-devtools/python/python3_3.10.2.bb do_install:append:class-native() { · line 162

Quoted 2 lines
meta/recipes-devtools/python/python3_3.10.2.bb +0 -0
 do_install:append() {

This does pose an interesting dilemma. We could just go this far, or should we
remove the remaining pyc files (~1,500 of them) and let python create them as
needed, or do we disable them from python entirely?

I think that for native recipes it can be created at runtime as needed.

Jose

Quoted 17 lines

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#162656):
https://lists.openembedded.org/g/openembedded-core/message/162656
Mute This Topic: https://lists.openembedded.org/mt/89525809/5052612
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Best regards,

José Quaresma