xbps-triggers: improve removal of __pycache__ dirs.

This commit is contained in:
Juan RP 2014-06-18 11:47:39 +02:00
parent cdcf493249
commit 70b72587a6

View File

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