summaryrefslogtreecommitdiff
path: root/tools/gyp/pylib/gyp/generator/msvs.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gyp/pylib/gyp/generator/msvs.py')
-rw-r--r--tools/gyp/pylib/gyp/generator/msvs.py82
1 files changed, 41 insertions, 41 deletions
diff --git a/tools/gyp/pylib/gyp/generator/msvs.py b/tools/gyp/pylib/gyp/generator/msvs.py
index dbde9e279e..3a9e6a7aa5 100644
--- a/tools/gyp/pylib/gyp/generator/msvs.py
+++ b/tools/gyp/pylib/gyp/generator/msvs.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 copy
import ntpath
import os
@@ -315,10 +317,8 @@ def _ConfigWindowsTargetPlatformVersion(config_data, version):
if names:
return names[0]
else:
- print >> sys.stdout, (
- 'Warning: No include files found for '
- 'detected Windows SDK version %s' % (version)
- )
+ print('Warning: No include files found for detected '
+ 'Windows SDK version %s' % (version), file=sys.stdout)
def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
@@ -469,7 +469,7 @@ def _AddCustomBuildToolForMSVS(p, spec, primary_input,
'CommandLine': cmd,
})
# Add to the properties of primary input for each config.
- for config_name, c_data in spec['configurations'].iteritems():
+ for config_name, c_data in spec['configurations'].items():
p.AddFileConfig(_FixPath(primary_input),
_ConfigFullName(config_name, c_data), tools=[tool])
@@ -775,8 +775,8 @@ def _EscapeVCProjCommandLineArgListItem(s):
# the VCProj but cause the same problem on the final command-line. Moving
# the item to the end of the list does works, but that's only possible if
# there's only one such item. Let's just warn the user.
- print >> sys.stderr, ('Warning: MSVS may misinterpret the odd number of ' +
- 'quotes in ' + s)
+ print('Warning: MSVS may misinterpret the odd number of '
+ 'quotes in ' + s, file=sys.stderr)
return s
@@ -991,7 +991,7 @@ def _ValidateSourcesForMSVSProject(spec, version):
basenames.setdefault(basename, []).append(source)
error = ''
- for basename, files in basenames.iteritems():
+ for basename, files in basenames.items():
if len(files) > 1:
error += ' %s: %s\n' % (basename, ' '.join(files))
@@ -1023,7 +1023,7 @@ def _GenerateMSVSProject(project, options, version, generator_flags):
relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir)
config_type = _GetMSVSConfigurationType(spec, project.build_file)
- for config_name, config in spec['configurations'].iteritems():
+ for config_name, config in spec['configurations'].items():
_AddConfigurationToMSVSProject(p, spec, config_type, config_name, config)
# MSVC08 and prior version cannot handle duplicate basenames in the same
@@ -1392,10 +1392,10 @@ def _ConvertToolsToExpectedForm(tools):
A list of Tool objects.
"""
tool_list = []
- for tool, settings in tools.iteritems():
+ for tool, settings in tools.items():
# Collapse settings with lists.
settings_fixed = {}
- for setting, value in settings.iteritems():
+ for setting, value in settings.items():
if type(value) == list:
if ((tool == 'VCLinkerTool' and
setting == 'AdditionalDependencies') or
@@ -1570,7 +1570,7 @@ def _IdlFilesHandledNonNatively(spec, sources):
def _GetPrecompileRelatedFiles(spec):
# Gather a list of precompiled header related sources.
precompiled_related = []
- for _, config in spec['configurations'].iteritems():
+ for _, config in spec['configurations'].items():
for k in precomp_keys:
f = config.get(k)
if f:
@@ -1581,7 +1581,7 @@ def _GetPrecompileRelatedFiles(spec):
def _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl,
list_excluded):
exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl)
- for file_name, excluded_configs in exclusions.iteritems():
+ for file_name, excluded_configs in exclusions.items():
if (not list_excluded and
len(excluded_configs) == len(spec['configurations'])):
# If we're not listing excluded files, then they won't appear in the
@@ -1598,7 +1598,7 @@ def _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl):
# Exclude excluded sources from being built.
for f in excluded_sources:
excluded_configs = []
- for config_name, config in spec['configurations'].iteritems():
+ for config_name, config in spec['configurations'].items():
precomped = [_FixPath(config.get(i, '')) for i in precomp_keys]
# Don't do this for ones that are precompiled header related.
if f not in precomped:
@@ -1608,7 +1608,7 @@ def _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl):
# Exclude them now.
for f in excluded_idl:
excluded_configs = []
- for config_name, config in spec['configurations'].iteritems():
+ for config_name, config in spec['configurations'].items():
excluded_configs.append((config_name, config))
exclusions[f] = excluded_configs
return exclusions
@@ -1617,7 +1617,7 @@ def _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl):
def _AddToolFilesToMSVS(p, spec):
# Add in tool files (rules).
tool_files = OrderedSet()
- for _, config in spec['configurations'].iteritems():
+ for _, config in spec['configurations'].items():
for f in config.get('msvs_tool_files', []):
tool_files.add(f)
for f in tool_files:
@@ -1630,7 +1630,7 @@ def _HandlePreCompiledHeaders(p, sources, spec):
# kind (i.e. C vs. C++) as the precompiled header source stub needs
# to have use of precompiled headers disabled.
extensions_excluded_from_precompile = []
- for config_name, config in spec['configurations'].iteritems():
+ for config_name, config in spec['configurations'].items():
source = config.get('msvs_precompiled_source')
if source:
source = _FixPath(source)
@@ -1651,7 +1651,7 @@ def _HandlePreCompiledHeaders(p, sources, spec):
else:
basename, extension = os.path.splitext(source)
if extension in extensions_excluded_from_precompile:
- for config_name, config in spec['configurations'].iteritems():
+ for config_name, config in spec['configurations'].items():
tool = MSVSProject.Tool('VCCLCompilerTool',
{'UsePrecompiledHeader': '0',
'ForcedIncludeFiles': '$(NOINHERIT)'})
@@ -1702,7 +1702,7 @@ def _WriteMSVSUserFile(project_path, version, spec):
return # Nothing to add
# Write out the user file.
user_file = _CreateMSVSUserFile(project_path, version, spec)
- for config_name, c_data in spec['configurations'].iteritems():
+ for config_name, c_data in spec['configurations'].items():
user_file.AddDebugSettings(_ConfigFullName(config_name, c_data),
action, environment, working_directory)
user_file.WriteIfChanged()
@@ -1756,7 +1756,7 @@ def _GetPathDict(root, path):
def _DictsToFolders(base_path, bucket, flat):
# Convert to folders recursively.
children = []
- for folder, contents in bucket.iteritems():
+ for folder, contents in bucket.items():
if type(contents) == dict:
folder_children = _DictsToFolders(os.path.join(base_path, folder),
contents, flat)
@@ -1828,7 +1828,7 @@ def _GetPlatformOverridesOfProject(spec):
# Prepare a dict indicating which project configurations are used for which
# solution configurations for this target.
config_platform_overrides = {}
- for config_name, c in spec['configurations'].iteritems():
+ for config_name, c in spec['configurations'].items():
config_fullname = _ConfigFullName(config_name, c)
platform = c.get('msvs_target_platform', _ConfigPlatform(c))
fixed_config_fullname = '%s|%s' % (
@@ -1967,7 +1967,7 @@ def PerformBuild(data, configurations, params):
msvs_version = params['msvs_version']
devenv = os.path.join(msvs_version.path, 'Common7', 'IDE', 'devenv.com')
- 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
@@ -1977,7 +1977,7 @@ def PerformBuild(data, configurations, params):
for config in configurations:
arguments = [devenv, sln_path, '/Build', config]
- print 'Building [%s]: %s' % (config, arguments)
+ print('Building [%s]: %s' % (config, arguments))
rtn = subprocess.check_call(arguments)
@@ -2029,7 +2029,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
configs = set()
for qualified_target in target_list:
spec = target_dicts[qualified_target]
- for config_name, config in spec['configurations'].iteritems():
+ for config_name, config in spec['configurations'].items():
configs.add(_ConfigFullName(config_name, config))
configs = list(configs)
@@ -2072,7 +2072,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
if generator_flags.get('msvs_error_on_missing_sources', False):
raise GypError(error_message)
else:
- print >> sys.stdout, "Warning: " + error_message
+ print("Warning: " + error_message, file=sys.stdout)
def _GenerateMSBuildFiltersFile(filters_path, source_files,
@@ -2676,7 +2676,7 @@ def _GetConfigurationCondition(name, settings):
def _GetMSBuildProjectConfigurations(configurations):
group = ['ItemGroup', {'Label': 'ProjectConfigurations'}]
- for (name, settings) in sorted(configurations.iteritems()):
+ for (name, settings) in sorted(configurations.items()):
configuration, platform = _GetConfigurationAndPlatform(name, settings)
designation = '%s|%s' % (configuration, platform)
group.append(
@@ -2749,7 +2749,7 @@ def _GetMSBuildGlobalProperties(spec, version, guid, gyp_file_name):
def _GetMSBuildConfigurationDetails(spec, build_file):
properties = {}
- for name, settings in spec['configurations'].iteritems():
+ for name, settings in spec['configurations'].items():
msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file)
condition = _GetConfigurationCondition(name, settings)
character_set = msbuild_attributes.get('CharacterSet')
@@ -2783,9 +2783,9 @@ def _GetMSBuildPropertySheets(configurations):
user_props = r'$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props'
additional_props = {}
props_specified = False
- for name, settings in sorted(configurations.iteritems()):
+ for name, settings in sorted(configurations.items()):
configuration = _GetConfigurationCondition(name, settings)
- if settings.has_key('msbuild_props'):
+ if 'msbuild_props' in settings:
additional_props[configuration] = _FixPaths(settings['msbuild_props'])
props_specified = True
else:
@@ -2805,7 +2805,7 @@ def _GetMSBuildPropertySheets(configurations):
]
else:
sheets = []
- for condition, props in additional_props.iteritems():
+ for condition, props in additional_props.items():
import_group = [
'ImportGroup',
{'Label': 'PropertySheets',
@@ -2838,7 +2838,7 @@ def _ConvertMSVSBuildAttributes(spec, config, build_file):
elif a == 'ConfigurationType':
msbuild_attributes[a] = _ConvertMSVSConfigurationType(msvs_attributes[a])
else:
- print 'Warning: Do not know how to convert MSVS attribute ' + a
+ print('Warning: Do not know how to convert MSVS attribute ' + a)
return msbuild_attributes
@@ -2934,7 +2934,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
new_paths = '$(ExecutablePath);' + ';'.join(new_paths)
properties = {}
- for (name, configuration) in sorted(configurations.iteritems()):
+ for (name, configuration) in sorted(configurations.items()):
condition = _GetConfigurationCondition(name, configuration)
attributes = _GetMSBuildAttributes(spec, configuration, build_file)
msbuild_settings = configuration['finalized_msbuild_settings']
@@ -2959,7 +2959,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
_AddConditionalProperty(properties, condition, 'ExecutablePath',
new_paths)
tool_settings = msbuild_settings.get('', {})
- for name, value in sorted(tool_settings.iteritems()):
+ for name, value in sorted(tool_settings.items()):
formatted_value = _GetValueFormattedForMSBuild('', name, value)
_AddConditionalProperty(properties, condition, name, formatted_value)
return _GetMSBuildPropertyGroup(spec, None, properties)
@@ -3028,7 +3028,7 @@ def _GetMSBuildPropertyGroup(spec, label, properties):
# NOTE: reverse(topsort(DAG)) = topsort(reverse_edges(DAG))
for name in reversed(properties_ordered):
values = properties[name]
- for value, conditions in sorted(values.iteritems()):
+ for value, conditions in sorted(values.items()):
if len(conditions) == num_configurations:
# If the value is the same all configurations,
# just add one unconditional entry.
@@ -3041,18 +3041,18 @@ def _GetMSBuildPropertyGroup(spec, label, properties):
def _GetMSBuildToolSettingsSections(spec, configurations):
groups = []
- for (name, configuration) in sorted(configurations.iteritems()):
+ for (name, configuration) in sorted(configurations.items()):
msbuild_settings = configuration['finalized_msbuild_settings']
group = ['ItemDefinitionGroup',
{'Condition': _GetConfigurationCondition(name, configuration)}
]
- for tool_name, tool_settings in sorted(msbuild_settings.iteritems()):
+ for tool_name, tool_settings in sorted(msbuild_settings.items()):
# Skip the tool named '' which is a holder of global settings handled
# by _GetMSBuildConfigurationGlobalProperties.
if tool_name:
if tool_settings:
tool = [tool_name]
- for name, value in sorted(tool_settings.iteritems()):
+ for name, value in sorted(tool_settings.items()):
formatted_value = _GetValueFormattedForMSBuild(tool_name, name,
value)
tool.append([name, formatted_value])
@@ -3085,8 +3085,8 @@ def _FinalizeMSBuildSettings(spec, configuration):
for ignored_setting in ignored_settings:
value = configuration.get(ignored_setting)
if value:
- print ('Warning: The automatic conversion to MSBuild does not handle '
- '%s. Ignoring setting of %s' % (ignored_setting, str(value)))
+ print('Warning: The automatic conversion to MSBuild does not handle '
+ '%s. Ignoring setting of %s' % (ignored_setting, str(value)))
defines = [_EscapeCppDefineForMSBuild(d) for d in defines]
disabled_warnings = _GetDisabledWarnings(configuration)
@@ -3252,7 +3252,7 @@ def _AddSources2(spec, sources, exclusions, grouped_sources,
{'Condition': condition},
'true'])
# Add precompile if needed
- for config_name, configuration in spec['configurations'].iteritems():
+ for config_name, configuration in spec['configurations'].items():
precompiled_source = configuration.get('msvs_precompiled_source', '')
if precompiled_source != '':
precompiled_source = _FixPath(precompiled_source)
@@ -3502,7 +3502,7 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
"""
sources_handled_by_action = OrderedSet()
actions_spec = []
- for primary_input, actions in actions_to_add.iteritems():
+ for primary_input, actions in actions_to_add.items():
inputs = OrderedSet()
outputs = OrderedSet()
descriptions = []