fix print functions for python3 gn scripts

Change-Id: I478b10c23aae0c363b0d7342f25663ca8fc0d0fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274637
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Martin Vejdarski 2020-03-03 13:53:20 +07:00 committed by Skia Commit-Bot
parent 7e46b14d84
commit beaaf4700f
7 changed files with 34 additions and 21 deletions

View File

@ -5,11 +5,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import os
import sys
dirpath, = sys.argv[1:]
print os.path.isdir(dirpath)
print(os.path.isdir(dirpath))

View File

@ -5,9 +5,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import subprocess
import sys
(sdk,) = sys.argv[1:]
print subprocess.check_output(['xcrun', '--sdk', sdk, '--show-sdk-path'])
print(subprocess.check_output(['xcrun', '--sdk', sdk, '--show-sdk-path']))

View File

@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import os
import glob
import re
@ -72,7 +74,7 @@ for config in configs:
# We need something to work with. Typically, this will fail if no GN folders
# have IDE files
if len(allProjects) == 0:
print "ERROR: At least one GN directory must have been built with --ide=vs"
print("ERROR: At least one GN directory must have been built with --ide=vs")
sys.exit()
# Create a new solution. We arbitrarily use the first config as the GUID source

View File

@ -7,6 +7,8 @@
# Generate Android.bp for Skia from GN configuration.
from __future__ import print_function
import os
import pprint
import string
@ -442,13 +444,13 @@ def disallow_platforms(config, desired):
s += ' || '
if i % 2 == 1:
s += '\\\n '
print >>f, s
print >>f, ' #error "Only SK_BUILD_FOR_%s should be defined!"' % desired
print >>f, '#endif'
print(s, file=f)
print(' #error "Only SK_BUILD_FOR_%s should be defined!"' % desired, file=f)
print('#endif', file=f)
def append_to_file(config, s):
with open(config, 'a') as f:
print >>f, s
print(s, file=f)
android_config = 'android/include/config/SkUserConfig.h'
gn_to_bp_utils.WriteUserConfig(android_config, android_defines)
@ -483,7 +485,7 @@ def bpfmt(indent, lst, sort=True):
# OK! We have everything to fill in Android.bp...
with open('Android.bp', 'w') as Android_bp:
print >>Android_bp, bp.substitute({
print(bp.substitute({
'export_includes': bpfmt(8, export_includes),
'local_includes': bpfmt(8, local_includes),
'srcs': bpfmt(8, srcs),
@ -512,4 +514,4 @@ with open('Android.bp', 'w') as Android_bp:
'linux_srcs': bpfmt(10, linux_srcs),
'mac_srcs': bpfmt(10, mac_srcs),
'win_srcs': bpfmt(10, win_srcs),
})
}), file=Android_bp)

View File

@ -7,6 +7,8 @@
# Generate Android.bp for Skia from GN configuration.
from __future__ import print_function
import argparse
import json
import os
@ -111,12 +113,12 @@ def WriteUserConfig(userConfigPath, defines):
#... and all the #defines we want to put in SkUserConfig.h.
with open(userConfigPath, 'w') as f:
print >>f, '// DO NOT MODIFY! This file is autogenerated by gn_to_bp.py.'
print >>f, '// If need to change a define, modify SkUserConfigManual.h'
print >>f, '#pragma once'
print >>f, '#include "SkUserConfigManual.h"'
print('// DO NOT MODIFY! This file is autogenerated by gn_to_bp.py.', file=f)
print('// If need to change a define, modify SkUserConfigManual.h', file=f)
print('#pragma once', file=f)
print('#include "SkUserConfigManual.h"', file=f)
for define in sorted(defines):
print >>f, ''
print >>f, '#ifndef', define.split('=')[0]
print >>f, '#define', define.replace('=', ' ', 1)
print >>f, '#endif'
print('', file=f)
print('#ifndef', define.split('=')[0], file=f)
print('#define', define.replace('=', ' ', 1), file=f)
print('#endif', file=f)

View File

@ -5,6 +5,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import os
import re
import sys
@ -12,4 +14,4 @@ import sys
dirpath = sys.argv[1]
regex = re.compile(sys.argv[2])
print sorted(filter(regex.match, os.listdir(dirpath)))[-1]
print(sorted(filter(regex.match, os.listdir(dirpath)))[-1])

View File

@ -5,13 +5,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import subprocess
import sys
cc,cxx = sys.argv[1:3]
if ('clang' in subprocess.check_output('%s --version' % cc, shell=True) and
'clang' in subprocess.check_output('%s --version' % cxx, shell=True)):
print 'true'
print('true')
else:
print 'false'
print('false')