Control: tags -1 + patch On Tue, 02 Jan 2018 at 15:07:52 +0000, Simon McVittie wrote: > Expected result: all installed files are cleaned up by the time the > Python packages have been purged > > Actual result: > /usr/lib/python3.6/distutils/ owned by: python3-distutils
Please consider applying the attached patch. I assumed you're deliberately not using dh_python3 (to avoid a circular dependency or some reason like that?) and NIH'd it, but if switching to dh_python3 would be acceptable and straightforward, that would probably also be a good solution. (It would also be great if you could mention in d/README.source why this package isn't using dh_python3, so that future contributors don't have to guess.) Thanks, smcv
>From ba7b5d7282ae7cb27d34801dc21411096d2493e2 Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Wed, 14 Feb 2018 11:30:12 +0000 Subject: [PATCH] Clean up empty __pycache__ directories in prerm I implemented this the same way as dh_python3's fallback mode when py3clean isn't found. Closes: #886124 --- debian/changelog | 9 +++++++++ debian/python3-distutils.prerm | 1 + debian/python3-lib2to3.prerm | 1 + debian/python3-tk.prerm | 1 + 4 files changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index b7635f8..f5ec622 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +python3-stdlib-extensions (3.6.4-4.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Clean up empty __pycache__ directories in prerm, the same way as + dh_python3's fallback mode when py3clean isn't found + (Closes: #886124) + + -- Simon McVittie <s...@debian.org> Wed, 14 Feb 2018 10:58:21 +0000 + python3-stdlib-extensions (3.6.4-4) unstable; urgency=medium * Update to 20180212 from the 3.6 branch. diff --git a/debian/python3-distutils.prerm b/debian/python3-distutils.prerm index bdc8320..0c680e2 100644 --- a/debian/python3-distutils.prerm +++ b/debian/python3-distutils.prerm @@ -10,6 +10,7 @@ remove_bytecode() | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ | xargs --max-chars="$max" echo \ | while read files; do rm -f $files; done + find /usr/lib/python3.? -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir } case "$1" in diff --git a/debian/python3-lib2to3.prerm b/debian/python3-lib2to3.prerm index a70657c..6dc4dbc 100644 --- a/debian/python3-lib2to3.prerm +++ b/debian/python3-lib2to3.prerm @@ -10,6 +10,7 @@ remove_bytecode() | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ | xargs --max-chars="$max" echo \ | while read files; do rm -f $files; done + find /usr/lib/python3.? -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir } case "$1" in diff --git a/debian/python3-tk.prerm b/debian/python3-tk.prerm index 92ae334..ad6619b 100644 --- a/debian/python3-tk.prerm +++ b/debian/python3-tk.prerm @@ -10,6 +10,7 @@ remove_bytecode() | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ | xargs --max-chars="$max" echo \ | while read files; do rm -f $files; done + find /usr/lib/python3.? -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir } case "$1" in -- 2.16.1