scripts: west_commands: decouple runners pkg from west

I've had some requests to be able to use code in the runners package
without having west installed.

It turns out to be pretty easy to make this happen, as west is
currently only used for west.log and some trivial helper methods:

- To replace west log, use the standard logging module
- Add an appropriate handler for each runner's logger in
  run_common.py which delegates to west.log, to keep
  output working as expected.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Marti Bolivar 2019-06-02 21:33:41 -06:00 committed by Carles Cufí
commit ddce583ca2
10 changed files with 148 additions and 97 deletions

View file

@ -6,8 +6,6 @@
from os import path
from west import log
from runners.core import ZephyrBinaryRunner, RunnerCaps
@ -95,8 +93,9 @@ class Esp32BinaryRunner(ZephyrBinaryRunner):
else:
cmd_flash.extend(['0x1000', bin_name])
log.inf("Converting ELF to BIN")
self.logger.info("Converting ELF to BIN")
self.check_call(cmd_convert)
log.inf("Flashing ESP32 on {} ({}bps)".format(self.device, self.baud))
self.logger.info("Flashing ESP32 on {} ({}bps)".
format(self.device, self.baud))
self.check_call(cmd_flash)