Added helper scripts to carry out 2to3 and testcases on python3

pull/128/merge^2
Steven Hiscocks 2013-02-24 18:27:40 +00:00
parent c8c9ed4dfc
commit dbc40d6210
2 changed files with 35 additions and 0 deletions

17
fail2ban-2to3 Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
# This script carries out conversion of fail2ban to python3
# A backup of any converted files are created with ".bak"
# extension
set -eu
nonPyFiles="fail2ban-client fail2ban-server fail2ban-regex fail2ban-testcases"
find . \
-name "*.py" \
-exec 2to3 -w --no-diffs $nonPyFiles {} + \
|| echo "Fail!" >&2 && exit 1
echo "Success!" >&2
exit 0

18
fail2ban-testcases-all-python3 Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Simple helper script to exercise unittests using all available
# (under /usr/bin and /usr/local/bin python2.*)
set -eu
failed=
for python in /usr/{,local/}bin/python3.[0-9]{,.*}{,-dbg}
do
[ -e "$python" ] || continue
echo "Testing using $python"
$python ./fail2ban-testcases "$@" || failed+=" $python"
done
if [ ! -z "$failed" ]; then
echo "E: Failed with $failed"
exit 1
fi