File: python3-vmmsclient.postinst

package info (click to toggle)
python-vmmsclient 0.0.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 136 kB
  • sloc: python: 559; makefile: 18; sh: 10
file content (17 lines) | stat: -rw-r--r-- 544 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

set -e

if [ "$1" = "configure" ] || [ "$1" = "upgrade" ]; then
	# Clear Python bytecode cache
	find /usr/lib/python3/dist-packages/vmmsclient -name "*.pyc" -delete 2>/dev/null || true
	find /usr/lib/python3/dist-packages/vmmsclient -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true

	# Force Python to regenerate entry point cache
	python3 -c "import importlib; import sys; 
		[sys.modules.pop(key) for key in list(sys.modules.keys()) if key.startswith('vmmsclient')];" 2>/dev/null || true
fi

#DEBHELPER#

exit 0