summaryrefslogtreecommitdiffstats
path: root/autoscripts/prerm-py3clean
diff options
context:
space:
mode:
Diffstat (limited to 'autoscripts/prerm-py3clean')
-rw-r--r--autoscripts/prerm-py3clean6
1 files changed, 6 insertions, 0 deletions
diff --git a/autoscripts/prerm-py3clean b/autoscripts/prerm-py3clean
new file mode 100644
index 0000000..3ec270f
--- /dev/null
+++ b/autoscripts/prerm-py3clean
@@ -0,0 +1,6 @@
+if command -v py3clean >/dev/null 2>&1; then
+ py3clean -p #PACKAGE# #ARGS#
+else
+ dpkg -L #PACKAGE# | sed -En -e '/^(.*)\/(.+)\.py$/s,,rm "\1/__pycache__/\2".*,e'
+ find /usr/lib/python3/dist-packages/ -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir
+fi