Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit beaaf47

Browse files
vejmartinSkia Commit-Bot
authored andcommitted
fix print functions for python3 gn scripts
Change-Id: I478b10c23aae0c363b0d7342f25663ca8fc0d0fa Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274637 Reviewed-by: Mike Klein <[email protected]> Commit-Queue: Mike Klein <[email protected]>
1 parent 7e46b14 commit beaaf47

File tree

7 files changed

+34
-21
lines changed

7 files changed

+34
-21
lines changed

gn/checkdir.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
# Use of this source code is governed by a BSD-style license that can be
66
# found in the LICENSE file.
77

8+
from __future__ import print_function
9+
810
import os
911
import sys
1012

1113
dirpath, = sys.argv[1:]
1214

13-
print os.path.isdir(dirpath)
15+
print(os.path.isdir(dirpath))
1416

1517

gn/find_xcode_sysroot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
# Use of this source code is governed by a BSD-style license that can be
66
# found in the LICENSE file.
77

8+
from __future__ import print_function
9+
810
import subprocess
911
import sys
1012

1113
(sdk,) = sys.argv[1:]
1214

13-
print subprocess.check_output(['xcrun', '--sdk', sdk, '--show-sdk-path'])
15+
print(subprocess.check_output(['xcrun', '--sdk', sdk, '--show-sdk-path']))

gn/gn_meta_sln.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5+
from __future__ import print_function
6+
57
import os
68
import glob
79
import re
@@ -72,7 +74,7 @@ def extractIdg(projFileName):
7274
# We need something to work with. Typically, this will fail if no GN folders
7375
# have IDE files
7476
if len(allProjects) == 0:
75-
print "ERROR: At least one GN directory must have been built with --ide=vs"
77+
print("ERROR: At least one GN directory must have been built with --ide=vs")
7678
sys.exit()
7779

7880
# Create a new solution. We arbitrarily use the first config as the GUID source

gn/gn_to_bp.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
# Generate Android.bp for Skia from GN configuration.
99

10+
from __future__ import print_function
11+
1012
import os
1113
import pprint
1214
import string
@@ -442,13 +444,13 @@ def disallow_platforms(config, desired):
442444
s += ' || '
443445
if i % 2 == 1:
444446
s += '\\\n '
445-
print >>f, s
446-
print >>f, ' #error "Only SK_BUILD_FOR_%s should be defined!"' % desired
447-
print >>f, '#endif'
447+
print(s, file=f)
448+
print(' #error "Only SK_BUILD_FOR_%s should be defined!"' % desired, file=f)
449+
print('#endif', file=f)
448450

449451
def append_to_file(config, s):
450452
with open(config, 'a') as f:
451-
print >>f, s
453+
print(s, file=f)
452454

453455
android_config = 'android/include/config/SkUserConfig.h'
454456
gn_to_bp_utils.WriteUserConfig(android_config, android_defines)
@@ -483,7 +485,7 @@ def bpfmt(indent, lst, sort=True):
483485

484486
# OK! We have everything to fill in Android.bp...
485487
with open('Android.bp', 'w') as Android_bp:
486-
print >>Android_bp, bp.substitute({
488+
print(bp.substitute({
487489
'export_includes': bpfmt(8, export_includes),
488490
'local_includes': bpfmt(8, local_includes),
489491
'srcs': bpfmt(8, srcs),
@@ -512,4 +514,4 @@ def bpfmt(indent, lst, sort=True):
512514
'linux_srcs': bpfmt(10, linux_srcs),
513515
'mac_srcs': bpfmt(10, mac_srcs),
514516
'win_srcs': bpfmt(10, win_srcs),
515-
})
517+
}), file=Android_bp)

gn/gn_to_bp_utils.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
# Generate Android.bp for Skia from GN configuration.
99

10+
from __future__ import print_function
11+
1012
import argparse
1113
import json
1214
import os
@@ -111,12 +113,12 @@ def WriteUserConfig(userConfigPath, defines):
111113

112114
#... and all the #defines we want to put in SkUserConfig.h.
113115
with open(userConfigPath, 'w') as f:
114-
print >>f, '// DO NOT MODIFY! This file is autogenerated by gn_to_bp.py.'
115-
print >>f, '// If need to change a define, modify SkUserConfigManual.h'
116-
print >>f, '#pragma once'
117-
print >>f, '#include "SkUserConfigManual.h"'
116+
print('// DO NOT MODIFY! This file is autogenerated by gn_to_bp.py.', file=f)
117+
print('// If need to change a define, modify SkUserConfigManual.h', file=f)
118+
print('#pragma once', file=f)
119+
print('#include "SkUserConfigManual.h"', file=f)
118120
for define in sorted(defines):
119-
print >>f, ''
120-
print >>f, '#ifndef', define.split('=')[0]
121-
print >>f, '#define', define.replace('=', ' ', 1)
122-
print >>f, '#endif'
121+
print('', file=f)
122+
print('#ifndef', define.split('=')[0], file=f)
123+
print('#define', define.replace('=', ' ', 1), file=f)
124+
print('#endif', file=f)

gn/highest_version_dir.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
# Use of this source code is governed by a BSD-style license that can be
66
# found in the LICENSE file.
77

8+
from __future__ import print_function
9+
810
import os
911
import re
1012
import sys
1113

1214
dirpath = sys.argv[1]
1315
regex = re.compile(sys.argv[2])
1416

15-
print sorted(filter(regex.match, os.listdir(dirpath)))[-1]
17+
print(sorted(filter(regex.match, os.listdir(dirpath)))[-1])

gn/is_clang.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
# Use of this source code is governed by a BSD-style license that can be
66
# found in the LICENSE file.
77

8+
from __future__ import print_function
9+
810
import subprocess
911
import sys
1012
cc,cxx = sys.argv[1:3]
1113

1214
if ('clang' in subprocess.check_output('%s --version' % cc, shell=True) and
1315
'clang' in subprocess.check_output('%s --version' % cxx, shell=True)):
14-
print 'true'
16+
print('true')
1517
else:
16-
print 'false'
17-
18+
print('false')

0 commit comments

Comments
 (0)