Skip to content

Commit

Permalink
support bundling only specific boards (#166)
Browse files Browse the repository at this point in the history
Support bundling only specified boards and skipping
the examples. This speedsup the process in case
the developer is only working on specific boards
at a time. By default every example and every board
are bundled.

Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
  • Loading branch information
tobiaskohlbau committed Feb 17, 2024
1 parent be113c7 commit e9859fb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tools/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from semver import Version
from marshmallow import fields
from enum import Enum as StrEnum
from argparse import ArgumentParser
from argparse import ArgumentParser, BooleanOptionalAction
import pathspec
import stat
import tarfile
Expand Down Expand Up @@ -231,13 +231,18 @@ def get_batch_timestamp():
iso=render_time.isoformat(),
)

def list_of_str(arg):
return arg.split(',')

def main():


arg_parser = ArgumentParser()

arg_parser.add_argument("--base-url", type=str, required=False, default=DEFAULT_DEPLOYMENT_BASE, help="Sets the download URL for the packages.")
arg_parser.add_argument("--debug", action="store_true", required=False, default=False, help="Creates a deployment for local development, hosted by localhost:8080")
arg_parser.add_argument("--examples", action=BooleanOptionalAction, required=False, default=True, help="Build the examples")
arg_parser.add_argument("--boards", type=list_of_str, help='list of boards to build', default=[])

cli_args = arg_parser.parse_args()

Expand Down Expand Up @@ -296,6 +301,13 @@ def main():
pkg_dict = json.loads(meta_path.read_bytes())
pkg = PackageConfigurationSchema.load(pkg_dict)

# Skip examples or non enabled boards
if any([
pkg.package_type == PackageType.example and not cli_args.examples,
pkg.package_type == PackageType.board_support and cli_args.boards and pkg.package_name not in cli_args.boards
]):
continue

pkg.version = version
pkg.created = batch_timestamp
pkg.package_dir = pkg_dir
Expand Down Expand Up @@ -517,4 +529,4 @@ def main():


if __name__ == "__main__":
main()
main()

0 comments on commit e9859fb

Please sign in to comment.