summaryrefslogtreecommitdiff
path: root/tools/gyp/pylib/gyp/generator/xcode.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gyp/pylib/gyp/generator/xcode.py')
-rw-r--r--tools/gyp/pylib/gyp/generator/xcode.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/tools/gyp/pylib/gyp/generator/xcode.py b/tools/gyp/pylib/gyp/generator/xcode.py
index db99d6ab81..8d65e53cca 100644
--- a/tools/gyp/pylib/gyp/generator/xcode.py
+++ b/tools/gyp/pylib/gyp/generator/xcode.py
@@ -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 filecmp
import gyp.common
import gyp.xcodeproj_file
@@ -129,7 +131,7 @@ class XcodeProject(object):
try:
os.makedirs(self.path)
self.created_dir = True
- except OSError, e:
+ except OSError as e:
if e.errno != errno.EEXIST:
raise
@@ -183,7 +185,7 @@ class XcodeProject(object):
# the tree tree view for UI display.
# Any values set globally are applied to all configurations, then any
# per-configuration values are applied.
- for xck, xcv in self.build_file_dict.get('xcode_settings', {}).iteritems():
+ for xck, xcv in self.build_file_dict.get('xcode_settings', {}).items():
xccl.SetBuildSetting(xck, xcv)
if 'xcode_config_file' in self.build_file_dict:
config_ref = self.project.AddOrGetFileInRootGroup(
@@ -197,7 +199,7 @@ class XcodeProject(object):
if build_file_configuration_named:
xcc = xccl.ConfigurationNamed(config_name)
for xck, xcv in build_file_configuration_named.get('xcode_settings',
- {}).iteritems():
+ {}).items():
xcc.SetBuildSetting(xck, xcv)
if 'xcode_config_file' in build_file_configuration_named:
config_ref = self.project.AddOrGetFileInRootGroup(
@@ -273,7 +275,7 @@ class XcodeProject(object):
script = script + "\n".join(
['export %s="%s"' %
(key, gyp.xcodeproj_file.ConvertVariablesToShellSyntax(val))
- for (key, val) in command.get('environment').iteritems()]) + "\n"
+ for (key, val) in command.get('environment').items()]) + "\n"
# Some test end up using sockets, files on disk, etc. and can get
# confused if more then one test runs at a time. The generator
@@ -454,7 +456,7 @@ sys.exit(subprocess.call(sys.argv[1:]))" """
same = False
try:
same = filecmp.cmp(pbxproj_path, new_pbxproj_path, False)
- except OSError, e:
+ except OSError as e:
if e.errno != errno.ENOENT:
raise
@@ -473,10 +475,10 @@ sys.exit(subprocess.call(sys.argv[1:]))" """
#
# No way to get the umask without setting a new one? Set a safe one
# and then set it back to the old value.
- umask = os.umask(077)
+ umask = os.umask(0o77)
os.umask(umask)
- os.chmod(new_pbxproj_path, 0666 & ~umask)
+ os.chmod(new_pbxproj_path, 0o666 & ~umask)
os.rename(new_pbxproj_path, pbxproj_path)
except Exception:
@@ -566,7 +568,7 @@ def EscapeXcodeDefine(s):
def PerformBuild(data, configurations, params):
options = params['options']
- for build_file, build_file_dict in data.iteritems():
+ for build_file, build_file_dict in data.items():
(build_file_root, build_file_ext) = os.path.splitext(build_file)
if build_file_ext != '.gyp':
continue
@@ -577,7 +579,7 @@ def PerformBuild(data, configurations, params):
for config in configurations:
arguments = ['xcodebuild', '-project', xcodeproj_path]
arguments += ['-configuration', config]
- print "Building [%s]: %s" % (config, arguments)
+ print("Building [%s]: %s" % (config, arguments))
subprocess.check_call(arguments)
@@ -625,7 +627,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
skip_excluded_files = \
not generator_flags.get('xcode_list_excluded_files', True)
xcode_projects = {}
- for build_file, build_file_dict in data.iteritems():
+ for build_file, build_file_dict in data.items():
(build_file_root, build_file_ext) = os.path.splitext(build_file)
if build_file_ext != '.gyp':
continue
@@ -744,7 +746,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
xctarget_type = gyp.xcodeproj_file.PBXNativeTarget
try:
target_properties['productType'] = _types[type_bundle_key]
- except KeyError, e:
+ except KeyError as e:
gyp.common.ExceptionAppend(e, "-- unknown product type while "
"writing target %s" % target_name)
raise
@@ -1024,7 +1026,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
# target.
makefile.write('all: \\\n')
for concrete_output_index in \
- xrange(0, len(concrete_outputs_by_rule_source)):
+ range(0, len(concrete_outputs_by_rule_source)):
# Only list the first (index [0]) concrete output of each input
# in the "all" target. Otherwise, a parallel make (-j > 1) would
# attempt to process each input multiple times simultaneously.
@@ -1047,7 +1049,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
# rule source. Collect the names of the directories that are
# required.
concrete_output_dirs = []
- for concrete_output_index in xrange(0, len(concrete_outputs)):
+ for concrete_output_index in range(0, len(concrete_outputs)):
concrete_output = concrete_outputs[concrete_output_index]
if concrete_output_index == 0:
bol = ''
@@ -1066,7 +1068,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
# the set of additional rule inputs, if any.
prerequisites = [rule_source]
prerequisites.extend(rule.get('inputs', []))
- for prerequisite_index in xrange(0, len(prerequisites)):
+ for prerequisite_index in range(0, len(prerequisites)):
prerequisite = prerequisites[prerequisite_index]
if prerequisite_index == len(prerequisites) - 1:
eol = ''
@@ -1288,7 +1290,7 @@ exit 1
set_define = EscapeXcodeDefine(define)
xcbc.AppendBuildSetting('GCC_PREPROCESSOR_DEFINITIONS', set_define)
if 'xcode_settings' in configuration:
- for xck, xcv in configuration['xcode_settings'].iteritems():
+ for xck, xcv in configuration['xcode_settings'].items():
xcbc.SetBuildSetting(xck, xcv)
if 'xcode_config_file' in configuration:
config_ref = pbxp.AddOrGetFileInRootGroup(
@@ -1296,7 +1298,7 @@ exit 1
xcbc.SetBaseConfiguration(config_ref)
build_files = []
- for build_file, build_file_dict in data.iteritems():
+ for build_file, build_file_dict in data.items():
if build_file.endswith('.gyp'):
build_files.append(build_file)