def run(self): try: (opts, args) = getopt.getopt(self.argv[1:], 'c:r:i:b:t:lhv', [ 'config=', 'repository=', 'id=', 'build=', 'toolchain=', 'linearise', 'help', 'verbose' ]) except getopt.GetoptError as err: # print help information and exit: print str( err) # will print something like "option -a not recognised" self.usage() return 2 retval = 0 try: if len(args) > 0: print 'Unused arguments: ' for arg in args: print '\t{0}'.format(arg) self.usage() return 2 for (o, a) in opts: #a = a if o in ('-c', '--config'): self.configFilePath = a elif o in ('-r', '--repository'): self.packagesAbsolutePathList.append(a) elif o in ('-i', '--id'): self.desiredConfigurationId = a elif o in ('-b', '--build'): self.outputFolder = a elif o in ('-t', '--toolchain'): self.toolchainId = a elif o in ('-l', '--linearise'): self.doLinearise = True elif o in ('-v', '--verbose'): self.verbosity += 1 elif o in ('-h', '--help'): self.usage() return 0 else: assert False, 'option not handled' CommonApplication.setVerbosity(self.verbosity) self.process() except ErrorWithDescription as err: print 'ERROR: {0}'.format(err) retval = 1 finally: if self.verbosity > 0: print print '[done]' return retval
def run(self): try: (opts, args) = getopt.getopt(self.argv[1:], 'c:p:i:hv', ['config=', 'packages=', 'id=', 'help', 'verbose']) except getopt.GetoptError as err: # print help information and exit: print str(err) # will print something like "option -a not recognised" self.usage() return 2 retval = 0 try: if len(args) > 0: print 'unused arguments: ', args self.usage() return 2 for (o, a) in opts: #a = a if o in ('-c', '--config'): self.configFilePath = a elif o in ('-p', '--packages'): self.packagesAbsolutePathList.append(a) elif o in ('-i', '--id'): self.desiredConfigurationId = a elif o in ('-v', '--verbose'): self.verbosity += 1 elif o in ('-h', '--help'): self.usage() return 0 else: assert False, 'option not handled' CommonApplication.setVerbosity(self.verbosity) self.process() except ErrorWithDescription as err: print 'ERROR: {0}'.format(err) retval = 1 finally: print print '[done]' return retval
def run(self): try: (opts, args) = getopt.getopt(self.argv[1:], 'r:c:b:lW:hva', [ 'repository=', 'build_config=', 'build_dir=', 'linearise', 'help', 'verbose', 'always']) except getopt.GetoptError as err: # print help information and exit: print str(err) # will print something like "option -a not recognised" self.usage() return 2 retval = 0 try: if len(args) == 1: self.makeTarget = args[0] elif len(args) > 0: print 'Unused arguments: ' for arg in args: print '\t{0}'.format(arg) self.usage() return 2 for (o, a) in opts: # a = a if o in ('-r', '--repository'): self.packagesAbsolutePathList.append(a) elif o in ('-c', '--build_config'): self.desiredConfigurationName = a elif o in ('-b', '--build_dir'): self.outputFolder = a elif o in ('-l', '--linearise'): self.doLinearise = True elif o in ('-a', '--always'): self.ignoreTimestamps = True elif o in ('-v', '--verbose'): self.verbosity += 1 elif o in ('-h', '--help'): self.usage() return 0 elif o in ('-W'): aa = a.split(',') if aa[0] == 'm': self.makeArguments = aa[1:] elif aa[0] == 'r': self.runArguments = aa[1:] else: assert False, 'option -W{0} not handled'.format(a) elif o in ('all', 'clean'): #print o pass else: assert False, 'option not handled' CommonApplication.setVerbosity(self.verbosity) retval = self.process() except ErrorWithoutDescription as err: retval = 1 except ErrorWithDescription as err: print 'ERROR: {0}'.format(err) retval = 1 except Exception: if True: traceback.print_exc(file=sys.stdout) traceback.print_exc() retval = 3 finally: if self.verbosity > 0: print print '[done]' return retval