Пример #1
0
    def launch(self, comp):
        # Build up the full set of command line arguments
        execparams = comp._getExecparams()
        execparams.update(self._execparams)
        execparams.update(self._getRequiredExecparams(comp))

        # Set up the debugger if requested
        debugger = self._debugger
        try:
            if isinstance(debugger, basestring):
                if debugger == 'pdb':
                    debugger = PDB()
                elif debugger == 'jdb':
                    debugger = JDB()
                elif debugger == 'gdb':
                    debugger = GDB()
                elif debugger == 'valgrind':
                    debugger = Valgrind()
            elif isinstance(debugger, Debugger):
                # check for PDB, JDB, Valgrind, or GDB
                pass
            elif debugger is None:
                pass
            else:
                raise RuntimeError, 'not supported'
        except Exception, e:
            log.warning('Cannot run debugger %s (%s)', debugger, e)
            debugger = None
Пример #2
0
    def execute(self, spd, impl, execparams, debugger, window, timeout=None):
        # Find a suitable implementation.
        if impl:
            implementation = self._getImplementation(spd, impl)
        else:
            implementation = self._selectImplementation(spd)
        log.trace("Using implementation '%s'", implementation.get_id())

        # Make sure the entry point can be run.
        entry_point = self._getEntryPoint(implementation)
        if not os.access(entry_point, os.X_OK | os.R_OK):
            raise RuntimeError, "Entry point '%s' is not executable" % entry_point
        log.trace("Using entry point '%s'", entry_point)

        # Process softpkg dependencies and modify the child environment.
        environment = dict(os.environ.items())
        for dependency in implementation.get_dependency():
            for varname, pathname in self._resolveDependency(
                    implementation, dependency):
                self._extendEnvironment(environment, varname, pathname)

        for varname in ('LD_LIBRARY_PATH', 'PYTHONPATH', 'CLASSPATH'):
            log.trace('%s=%s', varname, environment.get(varname, ''))

        # Get required execparams based on the component type
        execparams.update(self._getRequiredExecparams())
        '''
        execparams.update(self._getDomainPath())
        if execparams.has_key('LOGGING_CONFIG_URI'):
            if execparams['LOGGING_CONFIG_URI'].find("sca:") == 0:
                execparams['LOGGING_CONFIG_URI'] += "?fs=" + orb.object_to_string(self.__namingContext._this()),DeviceManagerStub
                pass
        '''

        # Convert execparams into arguments.
        arguments = []
        for name, value in execparams.iteritems():
            arguments += [name, str(value)]

        if isinstance(debugger, basestring):
            try:
                if debugger == 'pdb':
                    debugger = PDB()
                elif debugger == 'gdb':
                    debugger = GDB()
                elif debugger == 'valgrind':
                    debugger = Valgrind()
                else:
                    raise RuntimeError, 'not supported'
            except Exception, e:
                log.warning('Cannot run debugger %s (%s)', debugger, e)
                debugger = None