/usr/share/debhelper/autoscripts/postinst-dh-virtualenv is in dh-virtualenv 0.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | # dh-virtualenv postinst autoscript
set -e
#ARGS#
# set to empty to enable verbose output
test "$DH_VERBOSE" = "1" && DH_VENV_DEBUG="" || DH_VENV_DEBUG=:
$DH_VENV_DEBUG set -x
dh_venv_safe_interpreter_update() {
# get Python version used
local pythonX_Y=$(cd "$dh_venv_install_dir/lib" && ls -1d python[2-9].*[0-9] | tail -n1)
local i
for i in python ${pythonX_Y%.*} ${pythonX_Y}; do
local interpreter_path="$dh_venv_install_dir/bin/$i"
# skip any symlinks, and make sure we have an existing target
test ! -L "$interpreter_path" || continue
test -x "$interpreter_path" || continue
# skip if already identical
if cmp "/usr/bin/$pythonX_Y" "$interpreter_path" >/dev/null 2>&1; then
continue
fi
# hardlink or copy new interpreter
cp -fpl "/usr/bin/$pythonX_Y" "$interpreter_path,new" \
|| cp -fp "/usr/bin/$pythonX_Y" "$interpreter_path,new" \
|| rm -f "$interpreter_path,new" \
|| true
# make a backup (once)
test -f "$interpreter_path,orig" || ln "$interpreter_path" "$interpreter_path,orig"
# atomic move
if test -x "$interpreter_path,new" && mv "$interpreter_path,new" "$interpreter_path"; then
echo "Successfully updated $interpreter_path"
else
echo >&2 "WARNING: Some error occured while updating $interpreter_path"
fi
done
}
case "$1" in
configure|reconfigure)
$DH_VENV_DEBUG echo "$0 $1 called with $# args:" "$@"
dh_venv_safe_interpreter_update
;;
triggered)
$DH_VENV_DEBUG echo "$0 $1 called with $# args:" "$@"
for trigger in $2; do
case "$trigger" in
/usr/bin/python?.*)
# this trigger might be for the "wrong" interpreter (other version),
# but the "cmp" in "dh_venv_safe_interpreter_update" and the fact we only
# ever look at our own Python version catches that
dh_venv_safe_interpreter_update
;;
dh-virtualenv-interpreter-update)
dh_venv_safe_interpreter_update
;;
*)
#echo >&2 "ERROR:" $(basename "$0") "called with unknown trigger '$2'"
#exit 1
;;
esac
done
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
#echo >&2 "ERROR:" $(basename "$0") "called with unknown argument '$1'"
#exit 1
;;
esac
$DH_VENV_DEBUG set +x
# END dh-virtualenv postinst autoscript
|