Codebase list mozc / ef4c874
Migrate from python2 to python3 Update d/rules and add d/patches/Support-python3.patch Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@debian.org> Nobuhiro Iwamatsu 4 years ago
5 changed file(s) with 115 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
1212 libprotobuf with static link. If this issue is fixed upstream, mozc_tool
1313 will be provided again via dynamic link.
1414 (Closes: #700307, #774370)
15 * Migrate from python2 to python3.
16 Add d/patches/Support-python3.patch
1517
1618 -- Nobuhiro Iwamatsu <iwamatsu@debian.org> Wed, 24 Jul 2019 20:00:08 +0900
1719
44 Build-Depends: debhelper (>= 9),
55 libibus-1.0-dev (>= 1.4.1) | libibus-dev (>= 1.4.1),
66 pkg-config, libxcb-xfixes0-dev, libgtk2.0-dev,
7 python-dev, gyp (>= 0.1~svn1729-2), protobuf-compiler (>= 3.0.0),
7 python3-dev, gyp (>= 0.1~svn1729-2), protobuf-compiler (>= 3.0.0),
88 libprotobuf-dev (>= 3.0.0), qtbase5-dev, libqwt-qt5-dev,
99 libgwengui-qt5-dev, libuim-dev,
1010 libzinnia-dev, fcitx-libs-dev, gettext,
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
55 usage_dict.txt.patch
66 add_support_new_japanese_era.patch
77 Add-support-verbose-build.patch
8 Support-python3.patch
3333 build_static_link:
3434 cd src; \
3535 sed -i -e "s@-lprotobuf@/usr/lib/$(DEB_BUILD_MULTIARCH)/libprotobuf.a@g" protobuf/protobuf.gyp; \
36 GYP_DEFINES="use_libprotobuf=1 use_libzinnia=1" python build_mozc.py gyp \
36 GYP_DEFINES="use_libprotobuf=1 use_libzinnia=1" python3 build_mozc.py gyp \
3737 --gypdir=/usr/bin --target_platform=Linux --verbose ; \
38 python build_mozc.py build $(TARGET_STATIC) -c Release ;\
38 python3 build_mozc.py build $(TARGET_STATIC) -c Release ;\
3939 mv out_linux out_linux_static
4040
4141 build_dynamic_link:
4242 cd src ; \
43 GYP_DEFINES="use_libprotobuf=1 use_libzinnia=1" python build_mozc.py gyp \
43 GYP_DEFINES="use_libprotobuf=1 use_libzinnia=1" python3 build_mozc.py gyp \
4444 --gypdir=/usr/bin --target_platform=Linux --verbose ; \
45 python build_mozc.py build $(TARGETS) $(TARGET_FCITX) $(TARGET_UIM) -c Release ; \
45 python3 build_mozc.py build $(TARGETS) $(TARGET_FCITX) $(TARGET_UIM) -c Release ; \
4646 mv out_linux out_linux_dynamic
4747
4848 override_dh_auto_test:
5050
5151 override_dh_auto_clean:
5252 cd src ; \
53 python build_mozc.py clean
54 -rm -rf src/build_tools/__init__.pyc
55 -rm -rf src/build_tools/mozc_version.pyc
56 -rm -rf src/build_tools/test_tools/__init__.pyc
57 -rm -rf src/build_tools/test_tools/task_scheduler.pyc
58 -rm -rf src/build_tools/util.pyc
59 -rm -rf src/build_tools/code_generator_util.pyc
60 -rm -rf src/build_tools/android_util.pyc
61 -rm -rf src/build_tools/serialized_string_array_builder.pyc
62 -rm -rf src/prediction/__init__.pyc
63 -rm -rf src/prediction/gen_zero_query_util.pyc
64 -rm -rf src/rewriter/embedded_dictionary_compiler.pyc
65 -rm -rf src/rewriter/__init__.pyc
66 -rm -rf src/dictionary/pos_util.pyc
67 -rm -rf src/dictionary/__init__.pyc
68 -rm -rf src/build_tools/test_tools/test_launcher.pyc
53 python3 build_mozc.py clean
54 -find src -name "*.pyc" | xargs rm -rf
6955 -rm -rf src/chrome/skk/skk_util_all_test.target.mk
7056 -rm -rf src/chrome/skk/skk_util_test.target.mk
7157