Skip to content
Permalink
Browse files

scripts: flake8 cleanup for west build

Clean up coding nits to match west's style.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
  • Loading branch information...
mbolivar authored and nashif committed May 4, 2019
1 parent acda257 commit 69099e3d99460d8d1ef1b56bcbb1372a66dead95
Showing with 10 additions and 11 deletions.
  1. +10 −11 scripts/west_commands/build.py
@@ -4,13 +4,12 @@

import argparse
import os
import shutil
import subprocess

from west import log
from west.configuration import config
from zcmake import DEFAULT_CMAKE_GENERATOR, run_cmake, run_build, CMakeCache
from build_helpers import is_zephyr_build, find_build_dir, BUILD_DIR_DESCRIPTION
from build_helpers import is_zephyr_build, find_build_dir, \
BUILD_DIR_DESCRIPTION

from zephyr_ext_common import Forceable

@@ -57,8 +56,8 @@

class AlwaysIfMissing(argparse.Action):

def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, values or 'always')
def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, values or 'always')

class Build(Forceable):

@@ -152,8 +151,9 @@ def do_run(self, args, remainder):
# Load the pristine={auto, always, never} configuration value
pristine = config.get('build', 'pristine', fallback='never')
if pristine not in ['auto', 'always', 'never']:
log.wrn('treating unknown build.pristine value "{}" as "never"'.
format(pristine))
log.wrn(
'treating unknown build.pristine value "{}" as "never"'.
format(pristine))
pristine = 'never'
self.auto_pristine = (pristine == 'auto')

@@ -348,11 +348,10 @@ def _sanity_check(self):
# there was one in the CMake cache. Since this is going to be
# invalidated, reset to CWD and re-run the basic tests.
if ((boards_mismatched and not apps_mismatched) and
(not source_abs and cached_abs)):
(not source_abs and cached_abs)):
self._setup_source_dir()
self._sanity_check_source_dir()


def _run_cmake(self, cmake_opts):
if not self.run_cmake:
log.dbg('not running cmake; build system is present')
@@ -382,8 +381,8 @@ def _run_pristine(self):
'and should have been by the main script')

if not is_zephyr_build(self.build_dir):
log.die('Refusing to run pristine on a folder that is not a Zephyr '
'build system')
log.die('Refusing to run pristine on a folder that is not a '
'Zephyr build system')

cmake_args = ['-P', '{}/cmake/pristine.cmake'.format(zb)]
run_cmake(cmake_args, cwd=self.build_dir)

0 comments on commit 69099e3

Please sign in to comment.
You can’t perform that action at this time.