CHROMIUM: config: Make kernelconfig script python3 happy

Because python3 is 50% better than python2.

Specifically note:

* You can't just index the result of a dictionary's "values()"
  function in python3.  I guess it was assumed that everyone who was
  doing that was probably doing something wrong.  In this case the
  script actually wasn't.  It just needed any arbitrary value to seed
  its iteration.  ...but we can write the code differently.
* Print changed.

See <https://goto.google.com/cros-python3-guide>.

BUG=chromium:1027679
TEST=./chromeos/scripts/kernelconfig

Change-Id: I189eb7e9e339f469daf51cc325b3857b4ac85869
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1931403
diff --git a/chromeos/scripts/splitconfig b/chromeos/scripts/splitconfig
index bc56e12..e3402760 100755
--- a/chromeos/scripts/splitconfig
+++ b/chromeos/scripts/splitconfig
@@ -1,9 +1,11 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 """See this page for more details:
 http://dev.chromium.org/chromium-os/how-tos-and-troubleshooting/kernel-configuration
 """
 
+from __future__ import print_function
+
 import os
 import re
 import sys
@@ -26,22 +28,25 @@
         allconfigs[config].add((option, value))
 
 # Split out common config options
-common = allconfigs.values()[0].copy()
-for config in allconfigs.keys():
-    common &= allconfigs[config]
-for config in allconfigs.keys():
+common = None
+for config in allconfigs:
+    if common is None:
+        common = allconfigs[config].copy()
+    else:
+        common &= allconfigs[config]
+for config in allconfigs:
     allconfigs[config] -= common
 allconfigs["common.config"] = common
 
 # Generate new splitconfigs
-for config in allconfigs.keys():
+for config in allconfigs:
     f = open(config, "w")
     command = os.path.basename(sys.argv[0])
-    print >>f, "#\n# Config options generated by %s\n#" % command
+    print("#\n# Config options generated by %s\n#" % command, file=f)
     for option, value in sorted(list(allconfigs[config])):
         if value == "is not set":
-            print >>f, "# CONFIG_%s %s" % (option, value)
+            print("# CONFIG_%s %s" % (option, value), file=f)
         else:
-            print >>f, "CONFIG_%s=%s" % (option, value)
+            print("CONFIG_%s=%s" % (option, value), file=f)
 
     f.close()