Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 114269 - python.eclass fails to cleanup .pyo files when .pyc files have been removed
Summary: python.eclass fails to cleanup .pyo files when .pyc files have been removed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 145984
  Show dependency tree
 
Reported: 2005-12-02 07:08 UTC by Thierry Carrez (RETIRED)
Modified: 2007-02-03 02:11 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
remove .pyc and .pyo (python-eclass.patch,417 bytes, patch)
2006-08-17 08:31 UTC, Evan Klitzke
Details | Diff
err, this one will really work (python-eclass2.patch,465 bytes, patch)
2006-08-17 08:48 UTC, Evan Klitzke
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thierry Carrez (RETIRED) gentoo-dev 2005-12-02 07:08:07 UTC
When unmerging python, the python_mod_cleanup() function in python.eclass is
called to remove .pyc/.pyo leftovers from /usr/lib/python-X.Y :

   einfo "Cleaning orphaned Python bytecode from ${path} .."
   for obj in $(find ${path} -name *.pyc); do
       src_py="${obj%c}"
       if [ ! -f "${src_py}" ]; then
           einfo "Purging ${src_py}[co]"
           rm -f ${src_py}[co]
       fi
   done

This code fails to cleanup .pyo files if all .pyc files have been manually
removed in between, since the find reports nothing.

This might sound a little unlikely, but that's just what the upcoming Catalyst2
tool does in livecd-stage1 : 

find ${clst_chroot_path}/usr/lib -iname "*.pyc" -exec rm -f {} \;

This results in .pyo leftovers when python is unmerged.
Comment 1 Evan Klitzke 2006-08-17 08:31:23 UTC
Created attachment 94458 [details, diff]
remove .pyc and .pyo

I haven't tested this, but I think it will fix this problem. Does anyone care to give it a look?
Comment 2 Evan Klitzke 2006-08-17 08:48:08 UTC
Created attachment 94459 [details, diff]
err, this one will really work

The other patch was wrong, hopefully this is right... again, someone who is more familiar with this stuff needs to check this.
Comment 3 Alastair Tse (RETIRED) gentoo-dev 2006-08-17 16:59:01 UTC
that doesn't work for .pyc files?

do you mean something like echo ${obj%[co]} 
 
Comment 4 Bryan Østergaard (RETIRED) gentoo-dev 2007-02-03 02:11:16 UTC
Fixed in CVS. I had to fix the patch slightly but thanks for your work.