def RunDriver(module_name, args, suppress_inherited_arch_args=False): """ RunDriver() is used to invoke "driver" tools, e.g. those prefixed with "pnacl-" It automatically appends some additional flags to the invocation which were inherited from the current invocation. Those flags were preserved by ParseArgs """ if isinstance(args, str): args = shell.split(env.eval(args)) script = env.eval('${DRIVER_BIN}/%s' % module_name) script = shell.unescape(script) inherited_driver_args = env.get('INHERITED_DRIVER_ARGS') if suppress_inherited_arch_args: inherited_driver_args = FilterOutArchArgs(inherited_driver_args) script = pathtools.tosys(script) cmd = [script] + args + inherited_driver_args Log.Info('Driver invocation: %s', repr(cmd)) module = __import__(module_name) # Save the environment, reset the environment, run # the driver module, and then restore the environment. env.push() env.reset() DriverMain(module, cmd) env.pop()
def RunDriver(invocation, args, suppress_inherited_arch_args=False): """ RunDriver() is used to invoke "driver" tools, e.g. those prefixed with "pnacl-" It automatically appends some additional flags to the invocation which were inherited from the current invocation. Those flags were preserved by ParseArgs """ if isinstance(args, str): args = shell.split(env.eval(args)) module_name = 'pnacl-%s' % invocation script = env.eval('${DRIVER_BIN}/%s' % module_name) script = shell.unescape(script) inherited_driver_args = env.get('INHERITED_DRIVER_ARGS') if suppress_inherited_arch_args: inherited_driver_args = FilterOutArchArgs(inherited_driver_args) script = pathtools.tosys(script) cmd = [script] + args + inherited_driver_args Log.Info('Driver invocation: %s', repr(cmd)) module = __import__(module_name) # Save the environment, reset the environment, run # the driver module, and then restore the environment. env.push() env.reset() DriverMain(module, cmd) env.pop()