xbps-triggers: remove __pycache__ dirs at remove time.

This commit is contained in:
Juan RP 2014-06-18 11:42:58 +02:00
parent 446b11b44f
commit cdcf493249
1 changed files with 6 additions and 0 deletions

View File

@ -64,12 +64,18 @@ remove()
for f in ${pycompile_dirs}; do for f in ${pycompile_dirs}; do
echo "Removing byte-compiled python${pycompile_version} files in ${f}..." echo "Removing byte-compiled python${pycompile_version} files in ${f}..."
find ${f} -type f -name \*.py[co] -delete 2>&1 >/dev/null find ${f} -type f -name \*.py[co] -delete 2>&1 >/dev/null
if [ -d "${f}/__pycache__" ]; then
rm -rf "${f}/__pycache__" 2>&1 >/dev/null
fi
done done
for f in ${pycompile_module}; do for f in ${pycompile_module}; do
echo "Removing byte-compiled python${pycompile_version} code for module ${f}..." echo "Removing byte-compiled python${pycompile_version} code for module ${f}..."
if [ -d usr/lib/python${pycompile_version}/site-packages/${f} ]; then if [ -d usr/lib/python${pycompile_version}/site-packages/${f} ]; then
find usr/lib/python${pycompile_version}/site-packages/${f} \ find usr/lib/python${pycompile_version}/site-packages/${f} \
-type f -name \*.py[co] -delete 2>&1 >/dev/null -type f -name \*.py[co] -delete 2>&1 >/dev/null
if [ -d "usr/lib/python${pycompile_version}/site-packages/${f}/__pycache__" ]; then
rm -rf "usr/lib/python${pycompile_version}/site-packages/${f}/__pycache__" 2>&1 >/dev/null
fi
else else
rm -f usr/lib/python${pycompile_version}/site-packages/${f%.py}.py[co] rm -f usr/lib/python${pycompile_version}/site-packages/${f%.py}.py[co]
fi fi