platform_PrinterPpds: Set PY_VERSION = 3

A previous CL migrated the regularly run tests of platform_PrinterPpds
to Python 3. For tracking purposes, though, even the manually run
auxiliary control files must be marked with `PY_VERSION = 3`.

This CL

*   runs the fully automated (internal) migration script on
    platform_PrinterPpds,
*   removes python2 shebangs from all source files, and
*   marks all control files with `PY_VERSION = 3`.

Not all error paths were exhaustively tested, but I did run all tests
for a bit to see if any exceptions would immediately bubble up. Since
these tests are not run in any regularly scheduled suite, it's okay to
defer this long-tail maintenance work.

BUG=b:207146531
FIXED=b:207146531
TEST=test_that ...

Change-Id: I520e3c4e258ab2d1bf73b92fa7eb7b1a56b49737
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3331041
Reviewed-by: Piotr Pawliczek <pawliczek@chromium.org>
Tested-by: Kalvin Lee <kdlee@chromium.org>
Commit-Queue: Kalvin Lee <kdlee@chromium.org>
diff --git a/client/site_tests/platform_PrinterPpds/configurator.py b/client/site_tests/platform_PrinterPpds/configurator.py
index 9387a22..6cf7c3e 100644
--- a/client/site_tests/platform_PrinterPpds/configurator.py
+++ b/client/site_tests/platform_PrinterPpds/configurator.py
@@ -65,8 +65,9 @@
         # a line with 'LogLevel' option
         lines = self._run_as_root(["cat", _CUPS_CONF_FILE]).splitlines()
 
+        line_no = None
         for index, line in enumerate(lines):
-            if line.startswith('LogLevel'):
+            if line.startswith(b'LogLevel'):
                 line_no = index
                 break
         if line_no is None:
diff --git a/client/site_tests/platform_PrinterPpds/control.core_dump b/client/site_tests/platform_PrinterPpds/control.core_dump
index bf6f261..db92670 100644
--- a/client/site_tests/platform_PrinterPpds/control.core_dump
+++ b/client/site_tests/platform_PrinterPpds/control.core_dump
@@ -13,6 +13,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 JOB_RETRIES = 0
+PY_VERSION = 3
 
 DOC = """
 This test runs the following procedure for PPD files from ppds_core directory:
diff --git a/client/site_tests/platform_PrinterPpds/control.core_dump_debug b/client/site_tests/platform_PrinterPpds/control.core_dump_debug
index d3e6e68..8ba421f 100644
--- a/client/site_tests/platform_PrinterPpds/control.core_dump_debug
+++ b/client/site_tests/platform_PrinterPpds/control.core_dump_debug
@@ -13,6 +13,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 JOB_RETRIES = 0
+PY_VERSION = 3
 
 DOC = """
 This test runs the following procedure for PPD files from ppds_core directory:
diff --git a/client/site_tests/platform_PrinterPpds/control.core_test_debug b/client/site_tests/platform_PrinterPpds/control.core_test_debug
index fda2b4f..a8224fe 100644
--- a/client/site_tests/platform_PrinterPpds/control.core_test_debug
+++ b/client/site_tests/platform_PrinterPpds/control.core_test_debug
@@ -15,6 +15,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 JOB_RETRIES = 0
+PY_VERSION = 3
 
 DOC = """
 This test runs the following procedure for PPD files from ppds_core directory:
diff --git a/client/site_tests/platform_PrinterPpds/control.ext_dump b/client/site_tests/platform_PrinterPpds/control.ext_dump
index 32533f0..fb9cb43 100644
--- a/client/site_tests/platform_PrinterPpds/control.ext_dump
+++ b/client/site_tests/platform_PrinterPpds/control.ext_dump
@@ -13,6 +13,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 JOB_RETRIES = 0
+PY_VERSION = 3
 
 DOC = """
 This test runs the following procedure for PPD files from ppds_ext directory:
diff --git a/client/site_tests/platform_PrinterPpds/control.ext_dump_debug b/client/site_tests/platform_PrinterPpds/control.ext_dump_debug
index eb63103..91c9423 100644
--- a/client/site_tests/platform_PrinterPpds/control.ext_dump_debug
+++ b/client/site_tests/platform_PrinterPpds/control.ext_dump_debug
@@ -13,6 +13,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 JOB_RETRIES = 0
+PY_VERSION = 3
 
 DOC = """
 This test runs the following procedure for PPD files from ppds_ext directory:
diff --git a/client/site_tests/platform_PrinterPpds/control.ext_test_debug b/client/site_tests/platform_PrinterPpds/control.ext_test_debug
index 64f9765..dd3322e 100644
--- a/client/site_tests/platform_PrinterPpds/control.ext_test_debug
+++ b/client/site_tests/platform_PrinterPpds/control.ext_test_debug
@@ -15,6 +15,7 @@
 TEST_CATEGORY = "Functional"
 TEST_CLASS = "platform"
 JOB_RETRIES = 0
+PY_VERSION = 3
 
 DOC = """
 This test runs the following procedure for PPD files from ppds_ext directory:
diff --git a/client/site_tests/platform_PrinterPpds/helpers.py b/client/site_tests/platform_PrinterPpds/helpers.py
index 2aa95f1..332d02e 100644
--- a/client/site_tests/platform_PrinterPpds/helpers.py
+++ b/client/site_tests/platform_PrinterPpds/helpers.py
@@ -315,7 +315,7 @@
         digests_content += '\n'
 
     with open(path_digests, 'wb') as file_digests:
-        file_digests.write(digests_content)
+        file_digests.write(digests_content.encode("utf-8"))
 
 
 def load_lines_from_file(path):
diff --git a/client/site_tests/platform_PrinterPpds/multithreaded_processor.py b/client/site_tests/platform_PrinterPpds/multithreaded_processor.py
index 45e1bc1..518f374 100644
--- a/client/site_tests/platform_PrinterPpds/multithreaded_processor.py
+++ b/client/site_tests/platform_PrinterPpds/multithreaded_processor.py
@@ -2,7 +2,11 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
 import threading
+from six.moves import range
 
 
 class MultithreadedProcessor():
diff --git a/client/site_tests/platform_PrinterPpds/platform_PrinterPpds.py b/client/site_tests/platform_PrinterPpds/platform_PrinterPpds.py
index eca6b2f..b142f46 100644
--- a/client/site_tests/platform_PrinterPpds/platform_PrinterPpds.py
+++ b/client/site_tests/platform_PrinterPpds/platform_PrinterPpds.py
@@ -2,6 +2,10 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
 import dbus
 import gzip
 import logging
@@ -21,6 +25,7 @@
 import fake_printer
 import log_reader
 import multithreaded_processor
+from six.moves import range
 
 # Timeout for printing documents in seconds
 _FAKE_PRINTER_TIMEOUT = 200
diff --git a/client/site_tests/platform_PrinterPpds/test_fake_printer.py b/client/site_tests/platform_PrinterPpds/test_fake_printer.py
index 0647a8e..ca4e625 100755
--- a/client/site_tests/platform_PrinterPpds/test_fake_printer.py
+++ b/client/site_tests/platform_PrinterPpds/test_fake_printer.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python2
 # Copyright 2018 The Chromium OS Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/client/site_tests/platform_PrinterPpds/test_multithreaded_processor.py b/client/site_tests/platform_PrinterPpds/test_multithreaded_processor.py
index eaea970..3731086 100755
--- a/client/site_tests/platform_PrinterPpds/test_multithreaded_processor.py
+++ b/client/site_tests/platform_PrinterPpds/test_multithreaded_processor.py
@@ -1,9 +1,12 @@
-#!/usr/bin/python2
 # Copyright 2018 The Chromium OS Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
 from multithreaded_processor import MultithreadedProcessor
+from six.moves import range
 
 
 class EvenNumbersGenerator():