From 37df5cf045dde7224ec5a7e26151dc5d4985e05c Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sun, 29 Dec 2013 03:22:15 +0000 Subject: [PATCH] Guard against trying to use extend() with None git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75454 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build/tools/builder.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/build/tools/builder.py b/build/tools/builder.py index 4087cf53b3..22a30469ae 100755 --- a/build/tools/builder.py +++ b/build/tools/builder.py @@ -101,10 +101,12 @@ class Builder: """ if self.isAvailable(): args = [self.getProgramPath()] - args.extend(self.getProjectFileArg(projectFile)) + pfArg = self.getProjectFileArg(projectFile) + if pfArg: + args.extend(pfArg) args.append("clean") - args.extend(options) - + if options: + args.extend(options) result = runInDir(args, dir) return result @@ -117,11 +119,15 @@ class Builder: def build(self, dir=None, projectFile=None, targets=None, options=[]): if self.isAvailable(): args = [self.getProgramPath()] - args.extend(self.getProjectFileArg(projectFile)) - args.extend(options) - + pfArg = self.getProjectFileArg(projectFile) + if pfArg: + args.extend(pfArg) + # Important Note: if extending args, check it first! + # NoneTypes are not iterable and will crash the clean, build, or install! + # Very very irritating when this happens right at the end. + if options: + args.extend(options) result = runInDir(args, dir) - return result return 1 @@ -129,14 +135,18 @@ class Builder: def install(self, dir=None, projectFile=None, options=[]): if self.isAvailable(): args = [self.getProgramPath()] - args.extend(self.getProjectFileArg(projectFile)) + pfArg = self.getProjectFileArg(projectFile) + if pfArg: + args.extend(pfArg) args.append("install") - args.extend(options) + if options: + args.extend(options) result = runInDir(args, dir) return result return 1 + # Concrete subclasses of abstract Builder interface class GNUMakeBuilder(Builder):