diff --git a/scripts/build/README.md b/scripts/build/README.md index d4e464a6d2e06d..62b6cd7ba3e988 100644 --- a/scripts/build/README.md +++ b/scripts/build/README.md @@ -43,7 +43,7 @@ Usage examples: ./scripts/build/chipbuild.py --app all_clusters_app --board devkitc build ``` -3. Generate all the makefiles (but do not compile) all native apps +3. Generate all the build rules (but do not compile) all native apps ``` ./scripts/build/chipbuild.py --platform native generate diff --git a/scripts/build/build/__init__.py b/scripts/build/build/__init__.py index 1365b7a07fba56..73594a076ac32c 100644 --- a/scripts/build/build/__init__.py +++ b/scripts/build/build/__init__.py @@ -31,7 +31,7 @@ class Context: to generate make/ninja instructions and to compile. """ - def __init__(self, runner, repository_path, output_prefix): + def __init__(self, runner, repository_path:str, output_prefix:str): self.builders = [] self.builder_factory = BuilderFactory(runner, repository_path, output_prefix) @@ -40,7 +40,7 @@ def __init__(self, runner, repository_path, output_prefix): def SetupBuilders(self, platforms: Sequence[Platform], boards: Sequence[Board], applications: Sequence[Application]): - """Configures internal builders for the given platform/board/app combionation. + """Configures internal builders for the given platform/board/app combination. Handles smart default selection, so that users only need to specify part of platform/board/application information and the method tries @@ -53,6 +53,8 @@ def SetupBuilders(self, platforms: Sequence[Platform], ]) else: # when nothing is specified, start with a default host build + # TODO: this is only for linux. Should be moved to 'HOST' as a platform + # to also support building on MacOS platforms = [Platform.LINUX] # at this point, at least one of 'platforms' or 'boards' is non-empty diff --git a/scripts/build/chipbuild.py b/scripts/build/build_examples.py similarity index 98% rename from scripts/build/chipbuild.py rename to scripts/build/build_examples.py index f3c1d0583e6578..0b203e68ae6d94 100755 --- a/scripts/build/chipbuild.py +++ b/scripts/build/build_examples.py @@ -96,7 +96,7 @@ def main(context, log_level, platform, board, app, repo, out_prefix, clean, raise click.UsageError(""" PW_PROJECT_ROOT not in current environment. -Please make sure you `source scripts/bootstra.sh` or `source scripts/activate.sh` +Please make sure you `source scripts/bootstrap.sh` or `source scripts/activate.sh` before running this script. """.strip()) diff --git a/scripts/build/builders/builder.py b/scripts/build/builders/builder.py index c2a89af837c81b..f2942a611f7f9b 100644 --- a/scripts/build/builders/builder.py +++ b/scripts/build/builders/builder.py @@ -51,7 +51,7 @@ def CopyArtifacts(self, target_dir: str): target_dir_full_name = os.path.dirname(target_full_name) if not os.path.exists(target_dir_full_name): - logging.info(' Creating subdirectory %s first', target_dir_full_name) + logging.info('Creating subdirectory %s first', target_dir_full_name) os.makedirs(target_dir_full_name) shutil.copyfile(source_name, target_full_name) diff --git a/scripts/build/builders/esp32.py b/scripts/build/builders/esp32.py index 01df6339f059ff..d56e9abb0830d2 100644 --- a/scripts/build/builders/esp32.py +++ b/scripts/build/builders/esp32.py @@ -1,5 +1,7 @@ import logging import os +import shlex + from enum import Enum, auto from .builder import Builder @@ -75,8 +77,7 @@ def generate(self): if defaults: cmd += " -D SDKCONFIG_DEFAULTS='%s'" % defaults - cmd += ' -C examples/%s/esp32 -B %s reconfigure' % (self.app.ExampleName, - self.output_dir) + cmd += ' -C examples/%s/esp32 -B %s reconfigure' % (self.app.ExampleName, shlex.quote(self.output_dir)) # This will do a 'cmake reconfigure' which will create ninja files without rebuilding self._IdfEnvExecute( diff --git a/scripts/build/runner/shell.py b/scripts/build/runner/shell.py index d5e5e98c15ccc9..d1122060801018 100644 --- a/scripts/build/runner/shell.py +++ b/scripts/build/runner/shell.py @@ -14,13 +14,13 @@ def __init__(self, level): threading.Thread.__init__(self) self.daemon = False self.level = level - self.fdRead, self.fdWrite = os.pipe() - self.pipeReader = os.fdopen(self.fdRead) + self.fd_read, self.fd_write = os.pipe() + self.pipeReader = os.fdopen(self.fd_read) self.start() def fileno(self): """Return the write file descriptor of the pipe""" - return self.fdWrite + return self.fd_write def run(self): """Run the thread, logging everything.""" @@ -31,7 +31,7 @@ def run(self): def close(self): """Close the write end of the pipe.""" - os.close(self.fdWrite) + os.close(self.fd_write) class ShellRunner: