Skip to content

Commit 661a797

Browse files
committed
fix Issue#57
1 parent 44575bf commit 661a797

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

debian/postinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# postinst script which compiles python scripts
55

66
if which py3compile >/dev/null 2>&1; then
7-
py3compile -p python3-pyhp-core
7+
py3compile -p python3-pyhp-core
88
elif which python3 >/dev/null 2>&1; then
99
python3 -m compileall -q /usr/lib/python3/dist-packages/pyhp
1010
fi

debian/prerm

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55

66
case "$1" in
77
remove|upgrade|deconfigure)
8-
# clear cache
9-
set +e
10-
pyhp-backend clear >/dev/null 2>&1
11-
ret="$?"
12-
set -e
13-
case "$ret" in
14-
0) echo "Info: PyHP backend is a cache and has been cleared";;
15-
1) echo "Warning: Exception while clearing PyHP backend";;
16-
3) echo "Info: PyHP backend is not a cache and has not been cleared";;
17-
*) echo "Warning: Error while clearing PyHP backend";;
18-
esac
8+
# clear cache if toml module is installed
9+
if which python3 >/dev/null 2>&1 && python3 -c "import toml" >/dev/null 2>&1; then
10+
set +e
11+
pyhp-backend clear >/dev/null 2>&1
12+
ret="$?"
13+
set -e
14+
case "$ret" in
15+
0) echo "Info: PyHP backend is a cache and has been cleared";;
16+
1) echo "Warning: Exception while clearing PyHP backend";;
17+
3) echo "Info: PyHP backend is not a cache and has not been cleared";;
18+
*) echo "Warning: Error while clearing PyHP backend";;
19+
esac
20+
else
21+
echo "Info: not clearing PyHP backend because python3-toml is not installed"
22+
fi
1923

2024
# remove __pycache__
2125
if which py3clean >/dev/null 2>&1; then

0 commit comments

Comments
 (0)