Make --py3 the default for 'wpt' (#27081)

As per
https://github.com/web-platform-tests/rfcs/blob/master/rfcs/py_3.md,
step #2 of the transition to Python 3-only is to make 'wpt ...' commands
run in Python 3 by default.

Passing --py2 will now be necessary to run under Python 2. (Until ~Feb
2021, when we will remove py2 support entirely).

This does affect some CI runs. Cases where they already specified py3
will remain py3. Cases which are designed to run under py2 had `--py2`
added. Cases that didn't currently specify and aren't version specific
are upgraded from py2 to py3 (one example is Azure Pipelines Mac
infrastructure tests.)

Some Azure Pipelines helper scripts are used for both py2 and py3 tasks.
As a simple way to keep them working, `--py2` is used for them as it is
always available.
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 3422d97..155143e 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -97,7 +97,7 @@
   steps:
   - task: UsePythonVersion@0
     inputs:
-      versionSpec: '2.7.x'
+      versionSpec: '3.8.x'
   - template: tools/ci/azure/checkout.yml
   - template: tools/ci/azure/pip_install.yml
     parameters:
diff --git a/tools/ci/azure/update_hosts.yml b/tools/ci/azure/update_hosts.yml
index 63c7e45..2036c41 100644
--- a/tools/ci/azure/update_hosts.yml
+++ b/tools/ci/azure/update_hosts.yml
@@ -5,6 +5,6 @@
 - powershell: |
     $hostFile = "$env:systemroot\System32\drivers\etc\hosts"
     Copy-Item -Path $hostFile -Destination "$hostFile.back" -Force
-    python wpt make-hosts-file | Out-File $env:systemroot\System32\drivers\etc\hosts -Encoding ascii -Append
+    python wpt --py2 make-hosts-file | Out-File $env:systemroot\System32\drivers\etc\hosts -Encoding ascii -Append
   displayName: 'Update hosts (Windows)'
   condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
diff --git a/tools/ci/azure/update_manifest.yml b/tools/ci/azure/update_manifest.yml
index 453ac2a..b636b23 100644
--- a/tools/ci/azure/update_manifest.yml
+++ b/tools/ci/azure/update_manifest.yml
@@ -1,4 +1,4 @@
 steps:
 # `python wpt` instead of `./wpt` is to make this work on Windows:
-- script: python wpt manifest
+- script: python wpt --py2 manifest
   displayName: 'Update manifest'
diff --git a/tools/ci/ci_wptrunner_infrastructure.sh b/tools/ci/ci_wptrunner_infrastructure.sh
index 0709295..97ac17c 100755
--- a/tools/ci/ci_wptrunner_infrastructure.sh
+++ b/tools/ci/ci_wptrunner_infrastructure.sh
@@ -6,22 +6,18 @@
 cd $WPT_ROOT
 
 test_infrastructure() {
-    PY3_FLAG="$2"
-    TERM=dumb ./wpt $PY3_FLAG run --log-mach - --yes --manifest ~/meta/MANIFEST.json --metadata infrastructure/metadata/ --install-fonts --install-webdriver $1 $PRODUCT infrastructure/
+    PY2_FLAG="$2"
+    TERM=dumb ./wpt $PY2_FLAG run --log-mach - --yes --manifest ~/meta/MANIFEST.json --metadata infrastructure/metadata/ --install-fonts --install-webdriver $1 $PRODUCT infrastructure/
 }
 
 main() {
-    if [[ $# -eq 1 && "$1" = "--py3" ]]; then
-        PRODUCTS=( "chrome" )
-    else
-        PRODUCTS=( "firefox" "chrome" )
-    fi
+    PRODUCTS=( "firefox" "chrome" )
     ./wpt manifest --rebuild -p ~/meta/MANIFEST.json
     for PRODUCT in "${PRODUCTS[@]}"; do
         if [[ "$PRODUCT" == "chrome" ]]; then
             test_infrastructure "--binary=$(which google-chrome-unstable) --channel dev" "$1"
         else
-            test_infrastructure "--binary=~/build/firefox/firefox"
+            test_infrastructure "--binary=~/build/firefox/firefox" "$1"
         fi
     done
 }
diff --git a/tools/ci/tc/decision.py b/tools/ci/tc/decision.py
index f52f5b0..b089077 100644
--- a/tools/ci/tc/decision.py
+++ b/tools/ci/tc/decision.py
@@ -138,7 +138,7 @@
                 if not output:
                     logger.error("Failed to get commit for %s" % ref)
                 else:
-                    sha = output.split()[0]
+                    sha = output.decode("utf-8").split()[0]
             rv.append(sha)
         rv = tuple(rv)
     else:
diff --git a/tools/ci/tc/tasks/test.yml b/tools/ci/tc/tasks/test.yml
index 578b769..b3a3960 100644
--- a/tools/ci/tc/tasks/test.yml
+++ b/tools/ci/tc/tasks/test.yml
@@ -581,7 +581,7 @@
         - wpt-base
         - trigger-pr
         - browser-firefox
-      command: ./tools/ci/ci_wptrunner_infrastructure.sh
+      command: ./tools/ci/ci_wptrunner_infrastructure.sh --py2
       install:
         - libnss3-tools
         - libappindicator1
@@ -606,7 +606,8 @@
       use:
         - wpt-base
         - trigger-pr
-      command: ./tools/ci/ci_wptrunner_infrastructure.sh --py3
+        - browser-firefox
+      command: ./tools/ci/ci_wptrunner_infrastructure.sh
       install:
         - python3-pip
         - libnss3-tools
@@ -615,6 +616,7 @@
       options:
         oom-killer: true
         browser:
+          - firefox
           - chrome
         channel: experimental
         xvfb: true
diff --git a/wpt b/wpt
index 9fea20d..36d0bed 100755
--- a/wpt
+++ b/wpt
@@ -20,7 +20,7 @@
                 sys.exit(1)
             else:
                 raise
-    elif (args.py3 or py3only) and sys.version_info.major < 3:
+    elif (not args.py2) and sys.version_info.major < 3:
         from subprocess import call
         try:
             sys.exit(call(['python3'] + sys.argv))