From 2cb0a97f53ce90af880fda79090dfb15f219b650 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 9 Feb 2020 03:23:02 -0500 Subject: [PATCH] Debian: postinst/prerm hooks for python bytecode --- debian/python3-notcurses.postinst | 11 +++++++++++ debian/python3-notcurses.prerm | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100755 debian/python3-notcurses.postinst create mode 100755 debian/python3-notcurses.prerm diff --git a/debian/python3-notcurses.postinst b/debian/python3-notcurses.postinst new file mode 100755 index 000000000..afdc3ef03 --- /dev/null +++ b/debian/python3-notcurses.postinst @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# --------------------- copied from dh-python 4.20191017 --------- +if which py3compile >/dev/null 2>&1; then + py3compile -p python3-notcurses +fi +if which pypy3compile >/dev/null 2>&1; then + pypy3compile -p python3-notcurses || true +fi +# --------------------- end material copied from dh-python ------- diff --git a/debian/python3-notcurses.prerm b/debian/python3-notcurses.prerm new file mode 100755 index 000000000..ecb9d1dd7 --- /dev/null +++ b/debian/python3-notcurses.prerm @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# --------------------- copied from dh-python 4.20191017 --------- +if which py3clean >/dev/null 2>&1; then + py3clean -p python3-notcurses.interface +else + dpkg -L python3-notcurses.interface | perl -ne 's,/([^/]*)\.py$,/__pycache__/\1.*, or next; unlink $_ or die $! foreach glob($_)' + find /usr/lib/python3/dist-packages/ -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir +fi +# --------------------- end material copied from dh-python -------