Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Unified Diff: pylib/gyp/generator/cmake.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pylib/gyp/generator/cmake.py
diff --git a/pylib/gyp/generator/cmake.py b/pylib/gyp/generator/cmake.py
index a2b96291aa526aa5c93d1ecef687c70806872f53..f42defb6ccb56caec0f894900737afa632a10f1e 100644
--- a/pylib/gyp/generator/cmake.py
+++ b/pylib/gyp/generator/cmake.py
@@ -28,6 +28,8 @@ not be able to find the header file directories described in the generated
CMakeLists.txt file.
"""
+from __future__ import print_function
+
import multiprocessing
import os
import signal
@@ -36,6 +38,12 @@ import subprocess
import gyp.common
import gyp.xcode_emulation
+try:
+ string.maketrans
+except NameError:
+ # maketrans was moved to str in python 3
+ string.maketrans = str.maketrans
+
generator_default_variables = {
'EXECUTABLE_PREFIX': '',
'EXECUTABLE_SUFFIX': '',
@@ -868,8 +876,8 @@ def WriteTarget(namer, qualified_target, target_dicts, build_dir, config_to_use,
default_product_ext = generator_default_variables['SHARED_LIB_SUFFIX']
elif target_type != 'executable':
- print ('ERROR: What output file should be generated?',
- 'type', target_type, 'target', target_name)
+ print(('ERROR: What output file should be generated?',
+ 'type', target_type, 'target', target_name))
product_prefix = spec.get('product_prefix', default_product_prefix)
product_name = spec.get('product_name', default_product_name)
@@ -1207,11 +1215,11 @@ def PerformBuild(data, configurations, params):
output_dir,
config_name))
arguments = ['cmake', '-G', 'Ninja']
- print 'Generating [%s]: %s' % (config_name, arguments)
+ print('Generating [%s]: %s' % (config_name, arguments))
subprocess.check_call(arguments, cwd=build_dir)
arguments = ['ninja', '-C', build_dir]
- print 'Building [%s]: %s' % (config_name, arguments)
+ print('Building [%s]: %s' % (config_name, arguments))
subprocess.check_call(arguments)
@@ -1230,7 +1238,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
GenerateOutputForConfig(target_list, target_dicts, data,
params, user_config)
else:
- config_names = target_dicts[target_list[0]]['configurations'].keys()
+ config_names = target_dicts[target_list[0]]['configurations']
if params['parallel']:
try:
pool = multiprocessing.Pool(len(config_names))
@@ -1239,7 +1247,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
arglists.append((target_list, target_dicts, data,
params, config_name))
pool.map(CallGenerateOutputForConfig, arglists)
- except KeyboardInterrupt, e:
+ except KeyboardInterrupt as e:
pool.terminate()
raise e
else:

Powered by Google App Engine
This is Rietveld 408576698