From dbc40d6210f1b67e18834cf9c84d822013c52897 Mon Sep 17 00:00:00 2001 From: Steven Hiscocks Date: Sun, 24 Feb 2013 18:27:40 +0000 Subject: [PATCH] Added helper scripts to carry out 2to3 and testcases on python3 --- fail2ban-2to3 | 17 +++++++++++++++++ fail2ban-testcases-all-python3 | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 fail2ban-2to3 create mode 100755 fail2ban-testcases-all-python3 diff --git a/fail2ban-2to3 b/fail2ban-2to3 new file mode 100755 index 00000000..f0e292d6 --- /dev/null +++ b/fail2ban-2to3 @@ -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 diff --git a/fail2ban-testcases-all-python3 b/fail2ban-testcases-all-python3 new file mode 100755 index 00000000..094f2938 --- /dev/null +++ b/fail2ban-testcases-all-python3 @@ -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