From 76d6fab8aefaf486f7c8ca84d0686521931f261a Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 16 Jul 2017 12:00:04 +0300 Subject: [PATCH 1/7] Simplified control flow. --- mesonbuild/interpreter.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 8885e2b41..8d350559e 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2007,9 +2007,6 @@ class Interpreter(InterpreterBase): raise DependencyException(m.format(name)) dep = cached_dep else: - # We need to actually search for this dep - exception = None - dep = None # If the dependency has already been configured, possibly by # a higher level project, try to use it first. if 'fallback' in kwargs: @@ -2022,13 +2019,16 @@ class Interpreter(InterpreterBase): except KeyError: pass + # We need to actually search for this dep + exception = None + dep = None + # Search for it outside the project - if not dep: - try: - dep = dependencies.find_external_dependency(name, self.environment, kwargs) - except DependencyException as e: - exception = e - pass + try: + dep = dependencies.find_external_dependency(name, self.environment, kwargs) + except DependencyException as e: + exception = e + pass # Search inside the projects list if not dep or not dep.found(): From cdfb4164255980636481487c848a415c0ba3b4e9 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 16 Jul 2017 12:01:01 +0300 Subject: [PATCH 2/7] Removed duplicate key in dictionary. --- tools/ac_converter.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/ac_converter.py b/tools/ac_converter.py index cf00fd05f..eda5097dd 100755 --- a/tools/ac_converter.py +++ b/tools/ac_converter.py @@ -39,7 +39,6 @@ function_data = \ 'HAVE_POSIX_MEMALIGN': ('posix_memalign', 'stdlib.h'), 'HAVE_SIGACTION': ('sigaction', 'signal.h'), 'HAVE_ALARM': ('alarm', 'unistd.h'), - 'HAVE_CLOCK_GETTIME': ('clock_gettime', 'time.h'), 'HAVE_CTIME_R': ('ctime_r', 'time.h'), 'HAVE_DRAND48': ('drand48', 'stdlib.h'), 'HAVE_FLOCKFILE': ('flockfile', 'stdio.h'), From b2a90f18382485854c12c99c0d01b701d528cb4d Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 16 Jul 2017 12:02:48 +0300 Subject: [PATCH 3/7] Removed unnecessary pass statements. --- mesonbuild/dependencies/ui.py | 1 - mesonbuild/interpreter.py | 1 - tools/cmake2meson.py | 1 - 3 files changed, 3 deletions(-) diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index f1ee7a6d0..1c59a416f 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -390,7 +390,6 @@ class SDL2Dependency(ExternalDependency): return except Exception as e: mlog.debug('SDL 2 not found via pkgconfig. Trying next, error was:', str(e)) - pass if DependencyMethods.SDLCONFIG in self.methods: sdlconf = shutil.which('sdl2-config') if sdlconf: diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 8d350559e..393cb4830 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2028,7 +2028,6 @@ class Interpreter(InterpreterBase): dep = dependencies.find_external_dependency(name, self.environment, kwargs) except DependencyException as e: exception = e - pass # Search inside the projects list if not dep or not dep.found(): diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py index eae6344c4..0789a0c9a 100755 --- a/tools/cmake2meson.py +++ b/tools/cmake2meson.py @@ -74,7 +74,6 @@ class Lexer: lineno += 1 col = 1 line_start = mo.end() - pass elif tid == 'varexp': yield(Token('varexp', match_text[2:-1])) else: From 5cec8fc43a9341dbd4eb50f95a743bb6d6d2e416 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 16 Jul 2017 12:04:24 +0300 Subject: [PATCH 4/7] Removed consecutive identical variable assignments. --- mesonbuild/backend/xcodebackend.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index c48fb07e7..199d7df11 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -483,7 +483,6 @@ class XCodeBackend(backends.Backend): % (self.buildconflistmap[tname], tname)) self.write_line('buildPhases = (') self.indent_level += 1 - t = self.build.targets[tname] for bpname, bpval in t.buildphasemap.items(): self.write_line('%s /* %s yyy */,' % (bpval, bpname)) self.indent_level -= 1 From 16176342143ec7699ee2fb8575a6f73c1bf27da7 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 16 Jul 2017 12:05:09 +0300 Subject: [PATCH 5/7] Use sys.exit rather than plain exit. --- mesonbuild/scripts/depfixer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py index 1169b7e50..1528ddbfc 100644 --- a/mesonbuild/scripts/depfixer.py +++ b/mesonbuild/scripts/depfixer.py @@ -337,7 +337,7 @@ def run(args): print('This application resets target rpath.') print('Don\'t run this unless you know what you are doing.') print('%s: ' % sys.argv[0]) - exit(1) + sys.exit(1) with Elf(args[0]) as e: if len(args) == 1: e.print_rpath() From b5db2d3128d3b94d990f2497afdbd9491dda99fd Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 16 Jul 2017 12:06:46 +0300 Subject: [PATCH 6/7] Return explicit 0 as it is used in a sys.exit statement (just like every other run function). --- mesonbuild/scripts/vcstagger.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mesonbuild/scripts/vcstagger.py b/mesonbuild/scripts/vcstagger.py index 19de9cb90..62a45d928 100644 --- a/mesonbuild/scripts/vcstagger.py +++ b/mesonbuild/scripts/vcstagger.py @@ -36,6 +36,7 @@ def run(args): infile, outfile, fallback, source_dir, replace_string, regex_selector = args[0:6] command = args[6:] config_vcs_tag(infile, outfile, fallback, source_dir, replace_string, regex_selector, command) + return 0 if __name__ == '__main__': sys.exit(run(sys.argv[1:])) From fff3ded2978ccbeae2d2f6a95415b663fce850d8 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 16 Jul 2017 12:27:51 +0300 Subject: [PATCH 7/7] Removed unreachable code as == never throws. --- mesonbuild/interpreter.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 393cb4830..63cdf9ea0 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2808,11 +2808,8 @@ different subdirectory. found = self.check_contains(element, args) if found: return True - try: - if element == item: - return True - except Exception: - pass + if element == item: + return True return False def is_subproject(self):