Commit abb1bb6c authored by Emma Haruka Iwao's avatar Emma Haruka Iwao Committed by Commit Bot

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/+/2238988Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Commit-Queue: Emma Haruka Iwao <yuryu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779511}
parent 434bba26
...@@ -69,8 +69,8 @@ def FillXcodeVersion(settings, developer_dir): ...@@ -69,8 +69,8 @@ def FillXcodeVersion(settings, developer_dir):
def FillMachineOSBuild(settings): def FillMachineOSBuild(settings):
"""Fills OS build number into |settings|.""" """Fills OS build number into |settings|."""
machine_os_build = subprocess.check_output(['sw_vers', machine_os_build = subprocess.check_output(['sw_vers', '-buildVersion'],
'-buildVersion']).strip() universal_newlines=True).strip()
settings['machine_os_build'] = machine_os_build settings['machine_os_build'] = machine_os_build
# The reported build number is made up from the kernel major version number, # The reported build number is made up from the kernel major version number,
......
...@@ -6,11 +6,13 @@ ...@@ -6,11 +6,13 @@
"""Removes spaces from a given string.""" """Removes spaces from a given string."""
from __future__ import print_function
import sys import sys
def main(): def main():
if len(sys.argv) < 1: if len(sys.argv) < 1:
print 'Usage: %s <string>' % sys.argv[0] print('Usage: %s <string>' % sys.argv[0])
sys.exit(1) sys.exit(1)
# Takes all arguments passed in, joins as one string, and removes spaces. # Takes all arguments passed in, joins as one string, and removes spaces.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment