Move bot-status to python and adapt it to buildbot v2

The perl syntax was giving me headaches, so I rewrote it in python3.
It has exactly the same functionalities, even the debug logging (which
is not enabled through command line).

The resulting HMTL should be slight different placement, but with the
same expected informations.  The 'Comments' fields might result in
truncated information because some bots returns a long string with all
the resulting information instead of a more simple status.

I also added a small optimization to use HTTP Keep-alive (through the
python requests library) to avoid open multiple connections to fetch
each json file.

Change-Id: I2bc1e400ac8eabdac876bae7cc2f2344d9fdaa1d
diff --git a/monitor/install.sh b/monitor/install.sh
index 7f503a5..beceec4 100755
--- a/monitor/install.sh
+++ b/monitor/install.sh
@@ -15,7 +15,7 @@
 # Full path
 BASE=$(readlink -fn -- "$0")
 BASE=$(dirname "$BASE")
-if [ ! -x "$BASE/bot-status" ]; then
+if [ ! -x "$BASE/bot-status.py" ]; then
   echo "Make sure the install script is in the monitor directory"
   exit 1
 fi
@@ -42,29 +42,19 @@
   JSON=""
 fi
 
-# Checking for required Perl modules
-if ! perl -v > /dev/null; then
-  echo "Please, install Perl"
-  exit 1
+# Checking for required Python3 modules
+if ! python3 --version > /dev/null; then
+  echo 'Python3 missing'
 fi
-if ! perl -e "File::Temp" > /dev/null; then
-  echo "Please, install Perl's File module"
-  exit 1
-fi
-if ! perl -e "use JSON" > /dev/null; then
-  echo "Please, install Perl's JSON module"
-  exit 1
-fi
-if ! perl -e "use LWP" > /dev/null; then
-  echo "Please, install Perl's LWP module"
-  exit 1
+if ! python3 -c 'import requests' > /dev/null; then
+  echo 'python3-requests module missing'
 fi
 
 ############################# Install
 
 # Creates bin for bot-status
 mkdir -p "$ROOT/bin"
-ln -sf "$BASE/bot-status" "$ROOT/bin/bot-status"
+ln -sf "$BASE/bot-status.py" "$ROOT/bin/bot-status.py"
 if [ "$JSON" != "" ]; then
   ln -sf "$BASE/$JSON" "$ROOT/bin/$JSON"
 fi
@@ -99,5 +89,5 @@
 
 # Crontab
 echo " * To run the application every five minutes, add this line to your crontab:"
-echo "   */5 * * * * $ROOT/bin/bot-status $ROOT/bin/$JSON $ROOT/html/index.html"
+echo "   */5 * * * * $ROOT/bin/bot-status.py $ROOT/bin/$JSON $ROOT/html/index.html"
 echo