Skip to contentSkip to conversation

distutils.bbclass: don't delete .pyo files

PATCH In review Andreas Oberritter 2 participants 3 messages May 21, 2012 – May 24, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 distutils.bbclass: don't delete .pyo files

* Deleting .pyo files causes them to get compiled on the target.
* First boot gets *really* slow for python based projects.
* No space gets saved on the target.
* The package manager doesn't know about the files and therefore fails to uninstall them, occupying space and causing uninstalled python scripts to remain executable.
* It's inconsistent, because python itself and autotools based projects already ship .pyo files.
* Probably .pyo files were deleted because .pyc files were available earlier, but this has changed and OE-Core's python now only generates optimized .pyo files. Deletion of .pyo was introduced in 2008, python/04-default-is-optimized.patch was introduced in 2009.

---
 meta/classes/distutils.bbclass |    4 ----
 1 file changed, 4 deletions(-)
meta/classes/distutils.bbclass +0 -4
index 18ae805..bcddf8d 100644
@@ -65,10 +65,6 @@ distutils_do_install() {
         if test -e ${D}${datadir}/share; then
             mv -f ${D}${datadir}/share/* ${D}${datadir}/
         fi
-
-        # These are generated files, on really slow systems the storage/speed trade off
-        # might be worth it, but in general it isn't 
-        find ${D}${libdir}/${PYTHON_DIR}/site-packages -iname '*.pyo' -exec rm {} \;
 }
 
 EXPORT_FUNCTIONS do_compile do_install
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 python: bump PR of packages after update of distutils.bbclass

* Bump every recipe inheriting distutils or setuptools and not overriding do_install without calling distutils_do_install.

---
 .../python/python-argparse_1.2.1.bb                |    2 +-
 .../python/python-imaging_1.1.7.bb                 |    2 +-
 .../python/python-pycurl_7.19.0.bb                 |    2 +-
 meta/recipes-devtools/python/python-pyrex_0.9.9.bb |    2 +-
 meta/recipes-devtools/python/python-scons_2.1.0.bb |    2 +-
 .../python/python-setuptools_0.6c11.bb             |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
meta/recipes-devtools/python/python-argparse_1.2.1.bb +1 -1
index 789cee1..7c15575 100644
@@ -3,7 +3,7 @@ SECTION = "devel/python"
 LICENSE = "PSF"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=09d08bb5b7047e2688ea3faad6408aa8"
 SRCNAME = "argparse"
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "http://argparse.googlecode.com/files/${SRCNAME}-${PV}.tar.gz"
 SRC_URI[md5sum] = "2fbef8cb61e506c706957ab6e135840c"
meta/recipes-devtools/python/python-imaging_1.1.7.bb +1 -1
index 6d9743e..a36c344 100644
@@ -4,7 +4,7 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://README;beginline=92;endline=120;md5=c4371af4579f1e489cf881c1443dd4ec"
 DEPENDS = "freetype jpeg tiff"
 SRCNAME = "Imaging"
-PR = "r3"
+PR = "r4"
 
 SRC_URI = "http://effbot.org/downloads/Imaging-${PV}.tar.gz \
            file://0001-python-imaging-setup.py-force-paths-for-zlib-freetyp.patch"
meta/recipes-devtools/python/python-pycurl_7.19.0.bb +1 -1
index 8b849d7..122e1bd 100644
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = "file://README;endline=13;md5=fbfe545b1869617123a08c0983ef17b
 DEPENDS = "curl python"
 RDEPENDS_${PN} = "python-core curl"
 SRCNAME = "pycurl"
-PR = "r2"
+PR = "r3"
 
 SRC_URI = "\
   http://${SRCNAME}.sourceforge.net/download/${SRCNAME}-${PV}.tar.gz;name=archive \
meta/recipes-devtools/python/python-pyrex_0.9.9.bb +1 -1
index 568fb0d..0ae35b0 100644
@@ -5,7 +5,7 @@ SECTION = "devel/python"
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=771d472f53f933033f57eeee7808e5bd"
 SRCNAME = "Pyrex"
-PR = "r3"
+PR = "r4"
 
 SRC_URI = "\
   http://www.cosc.canterbury.ac.nz/greg.ewing/python/${SRCNAME}/${SRCNAME}-${PV}.tar.gz \
meta/recipes-devtools/python/python-scons_2.1.0.bb +1 -1
index f0b5b1f..8c5aa07 100644
@@ -4,7 +4,7 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=ab8b65435c2e520ed18e67459f1f9bb9"
 SRCNAME = "scons"
 
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/scons/scons-${PV}.tar.gz"
 
meta/recipes-devtools/python/python-setuptools_0.6c11.bb +1 -1
index 5dd5f31..a769714 100644
@@ -5,7 +5,7 @@ LICENSE = "PSF"
 LIC_FILES_CHKSUM = "file://setup.py;beginline=23;endline=23;md5=8a314270dd7a8dbca741775415f1716e"
 
 SRCNAME = "setuptools"
-PR = "ml3"
+PR = "ml4"
 DEPENDS += "python"
 DEPENDS_virtclass-native += "python-native"
 
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Andreas Oberritter
Quoted 24 lines · Andreas Oberritter

* Deleting .pyo files causes them to get compiled on the target.
* First boot gets *really* slow for python based projects.
* No space gets saved on the target.
* The package manager doesn't know about the files and therefore fails to uninstall them, occupying space and causing uninstalled python scripts to remain executable.
* It's inconsistent, because python itself and autotools based projects already ship .pyo files.
* Probably .pyo files were deleted because .pyc files were available earlier, but this has changed and OE-Core's python now only generates optimized .pyo files. Deletion of .pyo was introduced in 2008, python/04-default-is-optimized.patch was introduced in 2009.

---
  meta/classes/distutils.bbclass |    4 ----
  1 file changed, 4 deletions(-)
meta/classes/distutils.bbclass +0 -0
index 18ae805..bcddf8d 100644

meta/classes/distutils.bbclass distutils_do_install() { · line 70

Quoted 10 lines
meta/classes/distutils.bbclass +0 -4
@@ -65,10 +65,6 @@ distutils_do_install() {
          if test -e ${D}${datadir}/share; then
              mv -f ${D}${datadir}/share/* ${D}${datadir}/
          fi
-
-        # These are generated files, on really slow systems the storage/speed trade off
-        # might be worth it, but in general it isn't
-        find ${D}${libdir}/${PYTHON_DIR}/site-packages -iname '*.pyo' -exec rm {} \;
  }
 
  EXPORT_FUNCTIONS do_compile do_install

Merged these 2 into OE-Core

Thanks
Sau!