Remove __pycache__ before uninstall

`__pycache__` might be created when a python script is ran. Which
prevents `rpm -e` and `dpkg --remove` from completely removing the
application. This patch removes `__pycache__` early in the uninstall
process.

A similar issue is resolved in:
rocm_smi_lib Change-Id: I695bd085d4a43b678b563b4c35f6d2e8ddfa7d7c

Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Change-Id: I9fe0cd61570c2bd83cf9a45c95837ee6ad11e84b


[ROCm/rdc commit: 69a5a1d6bc]
This commit is contained in:
Galantsev, Dmitrii authored and Dmitrii Galantsev committed 2022-08-15 17:23:19 -04:00
1 parent 92e6ab4bb8
commit 0ae88bc221
3 files changed
+24 -2

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
set -e
stop_rdc() {
#stop RDC if running
systemctl stop rdc
return 0
}
reload_systemd() {
systemctl daemon-reload
return 0
}
rm_pyc() {
# remove pyc file generated by python
rm -rf /@RDC_CLIENT_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/@RDC@/python_binding/__pycache__
}
case "$1" in
remove | upgrade )
stop_rdc
unlink /lib/systemd/system/rdc.service
reload_systemd
rm_pyc
;;
purge)
;;
*)
exit 0
;;
esac
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
if [ $1 -le 1 ]; then
# perform the below actions for rpm remove($1=0) or upgrade($1=1) operations
# remove pyc file generated by python
rm -rf /@RDC_CLIENT_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/@RDC@/python_binding/__pycache__
fi