From ea636fcd518f69c52e2a2753c5802e2bae66ab0d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 17 May 2017 04:41:54 -0400 Subject: [PATCH] Remove unused variables. --- mesonbuild/backend/ninjabackend.py | 17 +++++++++-------- mesonbuild/build.py | 10 ++++------ mesonbuild/dependencies/misc.py | 1 - mesonbuild/mconf.py | 2 +- mesonbuild/modules/gnome.py | 2 +- mesonbuild/scripts/delwithsuffix.py | 6 +++--- mesonbuild/scripts/meson_install.py | 2 +- mesonbuild/wrap/wrap.py | 1 - mesontest.py | 20 ++++++++++---------- run_project_tests.py | 1 - run_unittests.py | 1 - 11 files changed, 29 insertions(+), 34 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 928e9bf05..4b12da638 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -315,14 +315,14 @@ int dummy; # Now we handle the following languages: # ObjC++, ObjC, C++, C, D, Fortran, Vala - # Pre-existing target C/C++ sources to be built; dict of full path to - # source relative to build root and the original File object. - target_sources = OrderedDict() - # GeneratedList and CustomTarget sources to be built; dict of the full - # path to source relative to build root and the generating target/list - generated_sources = OrderedDict() - # Array of sources generated by valac that have to be compiled - vala_generated_sources = [] + # target_sources: + # Pre-existing target C/C++ sources to be built; dict of full path to + # source relative to build root and the original File object. + # generated_sources: + # GeneratedList and CustomTarget sources to be built; dict of the full + # path to source relative to build root and the generating target/list + # vala_generated_sources: + # Array of sources generated by valac that have to be compiled if 'vala' in target.compilers: # Sources consumed by valac are filtered out. These only contain # C/C++ sources, objects, generated libs, and unknown sources now. @@ -331,6 +331,7 @@ int dummy; else: target_sources = self.get_target_sources(target) generated_sources = self.get_target_generated_sources(target) + vala_generated_sources = [] self.scan_fortran_module_outputs(target) # Generate rules for GeneratedLists self.generate_generator_list_rules(target, outfile) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index ce6405b2f..242ce6fde 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -227,8 +227,6 @@ class ExtractedObjects: 'You can only extract all the object files at once.' raise MesonException(msg) - def get_want_all_objects(self): - return self.want_all_objects class EnvironmentVariables: def __init__(self): @@ -238,7 +236,7 @@ class EnvironmentVariables: repr_str = "<{0}: {1}>" return repr_str.format(self.__class__.__name__, self.envvars) - def get_value(self, name, values, kwargs): + def get_value(self, values, kwargs): separator = kwargs.get('separator', os.pathsep) value = '' @@ -247,16 +245,16 @@ class EnvironmentVariables: return separator, value.strip(separator) def set(self, env, name, values, kwargs): - return self.get_value(name, values, kwargs)[1] + return self.get_value(values, kwargs)[1] def append(self, env, name, values, kwargs): - sep, value = self.get_value(name, values, kwargs) + sep, value = self.get_value(values, kwargs) if name in env: return env[name] + sep + value return value def prepend(self, env, name, values, kwargs): - sep, value = self.get_value(name, values, kwargs) + sep, value = self.get_value(values, kwargs) if name in env: return value + sep + env[name] diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 3374c6ebc..e9978075a 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -95,7 +95,6 @@ class BoostDependency(Dependency): def get_compile_args(self): args = [] - include_dir = '' if self.boost_root is not None: if mesonlib.is_windows(): include_dir = self.boost_root diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index 55860a483..14eddf5e2 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -61,7 +61,7 @@ class Conf: len_name = longest_name = len(titles['name']) len_descr = longest_descr = len(titles['descr']) len_value = longest_value = len(titles['value']) - len_choices = longest_choices = 0 # not printed if we don't get any optional values + longest_choices = 0 # not printed if we don't get any optional values # calculate the max length of each for x in arr: diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 134060fa9..b8092b2be 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -730,7 +730,7 @@ class GnomeModule(ExtensionModule): return args - def gtkdoc_html_dir(self, state, args, kwarga): + def gtkdoc_html_dir(self, state, args, kwargs): if len(args) != 1: raise MesonException('Must have exactly one argument.') modulename = args[0] diff --git a/mesonbuild/scripts/delwithsuffix.py b/mesonbuild/scripts/delwithsuffix.py index bd3420298..0d410ae16 100644 --- a/mesonbuild/scripts/delwithsuffix.py +++ b/mesonbuild/scripts/delwithsuffix.py @@ -15,12 +15,12 @@ import os, sys def run(args): - if len(sys.argv) != 3: + if len(args) != 2: print('delwithsuffix.py ') sys.exit(1) - topdir = sys.argv[1] - suffix = sys.argv[2] + topdir = args[0] + suffix = args[1] if suffix[0] != '.': suffix = '.' + suffix diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py index fbcc2a4af..d94909011 100644 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/scripts/meson_install.py @@ -34,7 +34,7 @@ def set_mode(path, mode): except PermissionError as e: msg = '{!r}: Unable to set owner {!r} and group {!r}: {}, ignoring...' print(msg.format(path, mode.owner, mode.group, e.strerror)) - except LookupError as e: + except LookupError: msg = '{!r}: Non-existent owner {!r} or group {!r}: ignoring...' print(msg.format(path, mode.owner, mode.group)) except OSError as e: diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 713d6857c..4dc539aa5 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -178,7 +178,6 @@ class Resolver: if is_there: try: subprocess.check_call(['git', 'rev-parse'], cwd=checkoutdir) - is_there = True except subprocess.CalledProcessError: raise RuntimeError('%s is not empty but is not a valid ' 'git repository, we can not work with it' diff --git a/mesontest.py b/mesontest.py index 101ce5fcd..bdbb44a91 100755 --- a/mesontest.py +++ b/mesontest.py @@ -304,7 +304,7 @@ class TestHarness: if jsonlogfile: write_json_log(jsonlogfile, name, result) - def print_summary(self, logfile, jsonlogfile): + def print_summary(self, logfile): msg = ''' OK: %4d FAIL: %4d @@ -446,7 +446,7 @@ TIMEOUT: %4d assert(isinstance(wrap, list)) return wrap - def get_pretty_suite(self, test, tests): + def get_pretty_suite(self, test): if len(self.suites) > 1: rv = TestHarness.split_suite_string(test.suite[0])[0] s = "+".join(TestHarness.split_suite_string(s)[1] for s in test.suite) @@ -466,15 +466,15 @@ TIMEOUT: %4d (logfile, logfilename, jsonlogfile, jsonlogfilename) = self.open_log_files() wrap = self.get_wrapper() - for i in range(self.options.repeat): + for _ in range(self.options.repeat): for i, test in enumerate(tests): - visible_name = self.get_pretty_suite(test, tests) + visible_name = self.get_pretty_suite(test) if self.options.gdb: test.timeout = None if not test.is_parallel or self.options.gdb: - self.drain_futures(futures, logfile, jsonlogfile) + self.drain_futures(futures) futures = [] res = self.run_single_test(wrap, test) self.print_stats(numlen, tests, visible_name, res, i, logfile, jsonlogfile) @@ -488,8 +488,8 @@ TIMEOUT: %4d if self.options.repeat > 1 and self.fail_count: break - self.drain_futures(futures, logfile, jsonlogfile) - self.print_summary(logfile, jsonlogfile) + self.drain_futures(futures) + self.print_summary(logfile) self.print_collected_logs() if logfilename: @@ -500,7 +500,7 @@ TIMEOUT: %4d if logfile: logfile.close() - def drain_futures(self, futures, logfile, jsonlogfile): + def drain_futures(self, futures): for i in futures: (result, numlen, tests, name, i, logfile, jsonlogfile) = i if self.options.repeat > 1 and self.fail_count: @@ -525,7 +525,7 @@ TIMEOUT: %4d def list_tests(th): tests = th.get_tests() for t in tests: - print(th.get_pretty_suite(t, tests)) + print(th.get_pretty_suite(t)) def merge_suite_options(options): buildfile = os.path.join(options.wd, 'meson-private/build.dat') @@ -558,7 +558,7 @@ def rebuild_all(wd): return False p = subprocess.Popen([ninja, '-C', wd]) - (stdo, stde) = p.communicate() + p.communicate() if p.returncode != 0: print("Could not rebuild") diff --git a/run_project_tests.py b/run_project_tests.py index e9f19420a..7f7cfdc00 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -217,7 +217,6 @@ def validate_install(srcdir, installdir, compiler): # If this exists, the test does not install any other files noinst_file = 'usr/no-installed-files' expected = {} - found = {} ret_msg = '' # Generate list of expected files if os.path.exists(os.path.join(installdir, noinst_file)): diff --git a/run_unittests.py b/run_unittests.py index b8e5ff927..27df1bdc6 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -852,7 +852,6 @@ class AllPlatformTests(BasePlatformTests): env = Environment(testdir, self.builddir, self.meson_command, get_fake_options(self.prefix), []) for lang, evar in langs: - evalue = None # Detect with evar and do sanity checks on that if evar in os.environ: ecc = getattr(env, 'detect_{}_compiler'.format(lang))(False)