python-coverage.preinst 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #! /bin/sh
  2. # Pre-install script for ‘python-coverage’.
  3. #
  4. # Manpage: ‘dh_installdeb(1)’
  5. set -e
  6. # Summary of ways this script can be called:
  7. # * <new-preinst> install
  8. # * <new-preinst> install <old-version>
  9. # * <new-preinst> upgrade <old-version>
  10. # * <old-preinst> abort-upgrade <new-version>
  11. # For details, see the Debian Policy §6.5 in the ‘debian-policy’ package
  12. # or on the web at <URL:http://www.debian.org/doc/debian-policy/>.
  13. action="$1"
  14. case "$action" in
  15. upgrade)
  16. old_version="$2"
  17. for python in $(pyversions --supported) ; do
  18. htmlfiles_dir="/usr/lib/${python}/dist-packages/coverage/htmlfiles"
  19. if [ -d "$htmlfiles_dir" ] && [ ! -L "$htmlfiles_dir" ] ; then
  20. # The ‘htmlfiles’ location should be platform-independent.
  21. # The new package will replace the directory with a symlink.
  22. rm -rf "$htmlfiles_dir"
  23. fi
  24. done
  25. ;;
  26. install|abort-upgrade)
  27. ;;
  28. *)
  29. printf "preinst called with unknown action ‘%s’\n" "$action" >&2
  30. exit 1
  31. ;;
  32. esac
  33. #DEBHELPER#