|
0 |
From d99432b137983b2898aaa5286cca1aeb4b804700 Mon Sep 17 00:00:00 2001
|
|
1 |
From: Nobuhiro Iwamatsu <iwamatsu@debian.org>
|
|
2 |
Date: Wed, 24 Jul 2019 19:07:10 +0900
|
|
3 |
Subject: [PATCH] Support python3
|
|
4 |
|
|
5 |
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org>
|
|
6 |
---
|
|
7 |
src/build_mozc.py | 18 +++++++++---------
|
|
8 |
src/build_tools/android_util.py | 2 +-
|
|
9 |
src/build_tools/test_tools/test_launcher.py | 4 ++--
|
|
10 |
src/build_tools/util.py | 4 ++--
|
|
11 |
4 files changed, 14 insertions(+), 14 deletions(-)
|
|
12 |
|
|
13 |
diff --git a/src/build_mozc.py b/src/build_mozc.py
|
|
14 |
index 46fa0827..910137d7 100644
|
|
15 |
--- a/src/build_mozc.py
|
|
16 |
+++ b/src/build_mozc.py
|
|
17 |
@@ -943,7 +943,7 @@ def RunTests(target_platform, configuration, parallel_num):
|
|
18 |
logging.info('running %s...', binary)
|
|
19 |
try:
|
|
20 |
test_function(binary, gtest_report_dir, options)
|
|
21 |
- except RunOrDieError, e:
|
|
22 |
+ except RunOrDieError as e:
|
|
23 |
logging.error(e)
|
|
24 |
failed_tests.append(binary)
|
|
25 |
else:
|
|
26 |
@@ -1190,14 +1190,14 @@ def CleanMain(options, unused_args):
|
|
27 |
|
|
28 |
def ShowHelpAndExit():
|
|
29 |
"""Shows the help message."""
|
|
30 |
- print 'Usage: build_mozc.py COMMAND [ARGS]'
|
|
31 |
- print 'Commands: '
|
|
32 |
- print ' gyp Generate project files.'
|
|
33 |
- print ' build Build the specified target.'
|
|
34 |
- print ' runtests Build all tests and run them.'
|
|
35 |
- print ' clean Clean all the build files and directories.'
|
|
36 |
- print ''
|
|
37 |
- print 'See also the comment in the script for typical usage.'
|
|
38 |
+ print ('Usage: build_mozc.py COMMAND [ARGS]')
|
|
39 |
+ print ('Commands: ')
|
|
40 |
+ print (' gyp Generate project files.')
|
|
41 |
+ print (' build Build the specified target.')
|
|
42 |
+ print (' runtests Build all tests and run them.')
|
|
43 |
+ print (' clean Clean all the build files and directories.')
|
|
44 |
+ print ('')
|
|
45 |
+ print ('See also the comment in the script for typical usage.')
|
|
46 |
sys.exit(1)
|
|
47 |
|
|
48 |
|
|
49 |
diff --git a/src/build_tools/android_util.py b/src/build_tools/android_util.py
|
|
50 |
index 5ea3da31..20989a5b 100644
|
|
51 |
--- a/src/build_tools/android_util.py
|
|
52 |
+++ b/src/build_tools/android_util.py
|
|
53 |
@@ -615,7 +615,7 @@ def GetAvdProperties(android_sdk_home, avd_name, my_open=open):
|
|
54 |
def main():
|
|
55 |
for arg in sys.argv[1:]:
|
|
56 |
for item in sorted(GetApkProperties(arg).items()):
|
|
57 |
- print '%s: %s' % item
|
|
58 |
+ print ('%s: %s' % item)
|
|
59 |
|
|
60 |
|
|
61 |
if __name__ == '__main__':
|
|
62 |
diff --git a/src/build_tools/test_tools/test_launcher.py b/src/build_tools/test_tools/test_launcher.py
|
|
63 |
index 47c0a2ec..ac6a50da 100644
|
|
64 |
--- a/src/build_tools/test_tools/test_launcher.py
|
|
65 |
+++ b/src/build_tools/test_tools/test_launcher.py
|
|
66 |
@@ -101,11 +101,11 @@ class PathDeleter(object):
|
|
67 |
time.sleep(1)
|
|
68 |
try:
|
|
69 |
shutil.rmtree(self._path)
|
|
70 |
- except OSError, e:
|
|
71 |
+ except OSError as e:
|
|
72 |
logging.error('Failed to remove %s. error: %s', self._path, e)
|
|
73 |
|
|
74 |
|
|
75 |
-def _ExecuteTest((command, gtest_report_dir)):
|
|
76 |
+def _ExecuteTest(command, gtest_report_dir):
|
|
77 |
"""Executes tests with specified Test command.
|
|
78 |
|
|
79 |
Args:
|
|
80 |
diff --git a/src/build_tools/util.py b/src/build_tools/util.py
|
|
81 |
index 85961187..3527f9e2 100644
|
|
82 |
--- a/src/build_tools/util.py
|
|
83 |
+++ b/src/build_tools/util.py
|
|
84 |
@@ -73,7 +73,7 @@ def GetNumberOfProcessors():
|
|
85 |
return 1
|
|
86 |
|
|
87 |
|
|
88 |
-class RunOrDieError(StandardError):
|
|
89 |
+class RunOrDieError(Exception):
|
|
90 |
"""The exception class for RunOrDie."""
|
|
91 |
|
|
92 |
def __init__(self, message):
|
|
93 |
@@ -105,7 +105,7 @@ def RemoveFile(file_name):
|
|
94 |
return # Do nothing if not exist.
|
|
95 |
if IsWindows():
|
|
96 |
# Read-only files cannot be deleted on Windows.
|
|
97 |
- os.chmod(file_name, 0700)
|
|
98 |
+ os.chmod(file_name, 0o700)
|
|
99 |
logging.debug('Removing file: %s', file_name)
|
|
100 |
os.unlink(file_name)
|
|
101 |
|
|
102 |
--
|
|
103 |
2.20.1
|
|
104 |
|