Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 189488 - python_mod_cleanup() non-existing path issue
Summary: python_mod_cleanup() non-existing path issue
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-19 15:53 UTC by Carsten Lohrke (RETIRED)
Modified: 2009-09-14 20:21 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Lohrke (RETIRED) gentoo-dev 2007-08-19 15:53:19 UTC
When called from ebuilds without anything to clean up (e.g. unmerging gimp that has been installed without python support), the function works on non-existing paths. One could argue it's up to the ebuild author, but on unmerging we can't rely on the current use flags set, so checking the path is necessary anyways, so why not do it in python_mod_cleanup() itself. Any reason I should not commit the following!?

--- python.eclass       2007-05-08 19:45:36.000000000 +0200
+++ python.eclass.new   2007-08-19 17:44:54.000000000 +0200
@@ -216,17 +216,19 @@
        fi

        for path in ${SEARCH_PATH}; do
-               einfo "Cleaning orphaned Python bytecode from ${path} .."
-               for obj in $(find ${path} -name *.py[co]); do
-                       src_py="${obj%[co]}"
-                       if [ ! -f "${src_py}" ]; then
-                               einfo "Purging ${src_py}[co]"
-                               rm -f ${src_py}[co]
-                       fi
-               done
-               # attempt to remove directories that maybe empty
-               for dir in $(find ${path} -type d | sort -r); do
-                       rmdir ${dir} 2>/dev/null
-               done
+               if [[ -d "${path}" ]] ; then
+                       einfo "Cleaning orphaned Python bytecode from ${path} .."
+                       for obj in $(find ${path} -name *.py[co]); do
+                               src_py="${obj%[co]}"
+                               if [ ! -f "${src_py}" ]; then
+                                       einfo "Purging ${src_py}[co]"
+                                       rm -f ${src_py}[co]
+                               fi
+                       done
+                       # attempt to remove directories that maybe empty
+                       for dir in $(find ${path} -type d | sort -r); do
+                               rmdir ${dir} 2>/dev/null
+                       done
+               fi
        done
 }
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-08-19 15:57:40 UTC
(In reply to comment #0)
> but on unmerging we can't
> rely on the current use flags set, so checking the path is necessary anyways,

I fails to see what does this have in common with use flags; on unmerge, USE flags from VDB are used, not the current ones.
Comment 2 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-09-14 20:21:04 UTC
Alternative patch was committed some time ago to fix another problem.