Support Python 3 in gn args on Mac

The gn args command failed to run with Python 3 on Mac because it uses
incompatible syntax. Python 2 is no longer maintained and it is
recommended we migrate to Python 3.

- Use text mode when invoking child processes
- Use print() with parenthesis.

Bug: 1068191
Change-Id: I2b039d3638447f1b5e50b89c145a06aeeef8359c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2238988
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Emma Haruka Iwao <yuryu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779511}
diff --git a/build/config/mac/sdk_info.py b/build/config/mac/sdk_info.py
index 805097a..1ad11d3 100644
--- a/build/config/mac/sdk_info.py
+++ b/build/config/mac/sdk_info.py
@@ -69,8 +69,8 @@
 
 def FillMachineOSBuild(settings):
   """Fills OS build number into |settings|."""
-  machine_os_build = subprocess.check_output(['sw_vers',
-                                              '-buildVersion']).strip()
+  machine_os_build = subprocess.check_output(['sw_vers', '-buildVersion'],
+                                             universal_newlines=True).strip()
   settings['machine_os_build'] = machine_os_build
 
   # The reported build number is made up from the kernel major version number,
diff --git a/remoting/tools/remove_spaces.py b/remoting/tools/remove_spaces.py
index 7eefb387..953ac17 100755
--- a/remoting/tools/remove_spaces.py
+++ b/remoting/tools/remove_spaces.py
@@ -6,11 +6,13 @@
 
 """Removes spaces from a given string."""
 
+from __future__ import print_function
+
 import sys
 
 def main():
   if len(sys.argv) < 1:
-    print 'Usage: %s <string>' % sys.argv[0]
+    print('Usage: %s <string>' % sys.argv[0])
     sys.exit(1)
 
   # Takes all arguments passed in, joins as one string, and removes spaces.