class MomRemoteRunner( MApplication ): '''MomRemoteRunner takes the location descriptor of a remote build script, fetches the build script, and executes it locally.''' def __init__( self ): MApplication.__init__( self, name = 'mom' ) self.__parameters = MomParameters() def getToolName( self ): return 'mom' def getParameters( self ): return self.__parameters def execute( self ): # mApp().debugN( self, 2, 'now invoking the build script {0} with options {1}'.format( # self.getParameters().getBuildscriptName(), # ' '.join( self.getParameters().getBuildScriptOptions() ) ) ) remote = RemoteBuilder( revision = self.getParameters().getRevision(), location = self.getParameters().getUrl(), path = self.getParameters().getPath(), script = self.getParameters().getBuildscriptName() ) # FIXME add a timeout? runner = remote.invokeBuild( self.getParameters().getBuildScriptOptions() ) if runner.getStdOut(): print( runner.getStdOutAsString() ) self.registerReturnCode( runner.getReturnCode() ) def build( self ): self.__parameters.parse( sys.argv ) settings = self.getSettings() self.addLogger( ConsoleLogger() ) settings.evalConfigurationFiles( self.getToolName() ) MApplication.build( self )
def testParseParameters( self ): '''Verify that the parser passes the correct subset of arguments to the remote build script.''' buildscriptArgs = [ '-vv', '-t', 'H', '-r', '4711' ] momArgs = [ sys.argv[0], '-vv', '-u', 'git://github.com/KDAB/Make-O-Matic.git', '-p', 'mom/buildscript.py', '-r', '4711', '-' ] args = momArgs + buildscriptArgs params = MomParameters() params.parse( args ) self.assertEqual( buildscriptArgs, params.getBuildScriptOptions() )
def __init__( self ): MApplication.__init__( self, name = 'mom' ) self.__parameters = MomParameters()