Fixed unnecessary .items()

pull/5311/head
Daniel Mensinger 6 years ago
parent 5ec79185a0
commit 236221061a
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 12
      mesonbuild/backend/ninjabackend.py
  2. 6
      mesonbuild/backend/vs2010backend.py
  3. 4
      mesonbuild/backend/xcodebackend.py
  4. 2
      mesonbuild/interpreter.py
  5. 2
      mesonbuild/wrap/wraptool.py
  6. 2
      run_unittests.py

@ -520,7 +520,7 @@ int dummy;
# This will be set as dependencies of all the target's sources. At the
# same time, also deal with generated sources that need to be compiled.
generated_source_files = []
for rel_src, _ in generated_sources.items():
for rel_src in generated_sources.keys():
dirpart, fnamepart = os.path.split(rel_src)
raw_src = File(True, dirpart, fnamepart)
if self.environment.is_source(rel_src) and not self.environment.is_header(rel_src):
@ -585,7 +585,7 @@ int dummy;
obj_list.append(self.generate_single_compile(target, src, 'vala', [], header_deps))
# Generate compile targets for all the pre-existing sources for this target
for _, src in target_sources.items():
for src in target_sources.values():
if not self.environment.is_header(src):
if self.environment.is_llvm_ir(src):
obj_list.append(self.generate_llvm_ir_compile(target, src))
@ -912,7 +912,7 @@ int dummy;
# Add possible java generated files to src list
generated_sources = self.get_target_generated_sources(target)
gen_src_list = []
for rel_src, _ in generated_sources.items():
for rel_src in generated_sources.keys():
dirpart, fnamepart = os.path.split(rel_src)
raw_src = File(True, dirpart, fnamepart)
if rel_src.endswith('.java'):
@ -1041,7 +1041,7 @@ int dummy;
def generate_single_java_compile(self, src, target, compiler, args):
deps = [os.path.join(self.get_target_dir(l), l.get_filename()) for l in target.link_targets]
generated_sources = self.get_target_generated_sources(target)
for rel_src, _ in generated_sources.items():
for rel_src in generated_sources.keys():
if rel_src.endswith('.java'):
deps.append(rel_src)
rel_src = src.rel_to_builddir(self.build_to_src)
@ -1227,7 +1227,7 @@ int dummy;
if len(target.install_dir) > 3 and target.install_dir[3] is True:
target.install_dir[3] = os.path.join(self.environment.get_datadir(), 'gir-1.0')
# Detect gresources and add --gresources arguments for each
for (_, gensrc) in other_src[1].items():
for gensrc in other_src[1].values():
if isinstance(gensrc, modules.GResourceTarget):
gres_xml, = self.get_custom_target_sources(gensrc)
args += ['--gresources=' + gres_xml]
@ -2751,7 +2751,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
return super().get_introspection_data(target_id, target)
result = []
for _, i in self.introspection_data[target_id].items():
for i in self.introspection_data[target_id].values():
result += [i]
return result

@ -306,7 +306,7 @@ class Vs2010Backend(backends.Backend):
target = self.build.targets[prj[0]]
lang = 'default'
if hasattr(target, 'compilers') and target.compilers:
for (lang_out, _) in target.compilers.items():
for lang_out in target.compilers.keys():
lang = lang_out
break
prj_line = prj_templ % (
@ -380,7 +380,7 @@ class Vs2010Backend(backends.Backend):
for p in projlist:
if p[1].parent != PurePath('.'):
ofile.write("\t\t{%s} = {%s}\n" % (p[2], self.subdirs[p[1].parent][0]))
for (_, subdir) in self.subdirs.items():
for subdir in self.subdirs.values():
if subdir[1]:
ofile.write("\t\t{%s} = {%s}\n" % (subdir[0], subdir[1]))
ofile.write('\tEndGlobalSection\n')
@ -457,7 +457,7 @@ class Vs2010Backend(backends.Backend):
def add_target_deps(self, root, target):
target_dict = {target.get_id(): target}
for _, dep in self.get_target_deps(target_dict).items():
for dep in self.get_target_deps(target_dict).values():
if dep.get_id() in self.handled_target_deps[target.get_id()]:
# This dependency was already handled manually.
continue

@ -345,7 +345,7 @@ class XCodeBackend(backends.Backend):
self.ofile.write('/* End PBXFileReference section */\n')
def generate_pbx_frameworks_buildphase(self):
for _, t in self.build.targets.items():
for t in self.build.targets.values():
self.ofile.write('\n/* Begin PBXFrameworksBuildPhase section */\n')
self.write_line('%s /* %s */ = {\n' % (t.buildphasemap['Frameworks'], 'Frameworks'))
self.indent_level += 1
@ -587,7 +587,7 @@ class XCodeBackend(backends.Backend):
def generate_pbx_sources_build_phase(self):
self.ofile.write('\n/* Begin PBXSourcesBuildPhase section */\n')
for name, _ in self.source_phase.items():
for name in self.source_phase.keys():
t = self.build.targets[name]
self.write_line('%s /* Sources */ = {' % (t.buildphasemap[name]))
self.indent_level += 1

@ -2193,7 +2193,7 @@ class Interpreter(InterpreterBase):
def check_cross_stdlibs(self):
if self.build.environment.is_cross_build():
props = self.build.environment.properties.host
for l, _ in self.build.cross_compilers.items():
for l in self.build.cross_compilers.keys():
try:
di = mesonlib.stringlistify(props.get_stdlib(l))
if len(di) != 2:

@ -177,7 +177,7 @@ def promote(options):
# check if the argument is a full path to a subproject directory or wrap file
system_native_path_argument = argument.replace('/', os.sep)
for _, matches in sprojs.items():
for matches in sprojs.values():
if system_native_path_argument in matches:
do_promotion(system_native_path_argument, spdir_name)
return

@ -5527,7 +5527,7 @@ class RewriterTests(BasePlatformTests):
out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
expected = {'name': 'myExe', 'sources': ['main.cpp']}
self.assertEqual(len(out['target']), 2)
for _, val in out['target'].items():
for val in out['target'].values():
self.assertDictEqual(expected, val)
def test_kwargs_info(self):

Loading…
Cancel
Save