Skip to content

Commit

Permalink
Use click.Choice
Browse files Browse the repository at this point in the history
  • Loading branch information
tekktrik committed Jul 28, 2023
1 parent fa23552 commit 123186b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions circuitpython_build_tools/scripts/build_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,8 @@ def _find_libraries(current_path, depth):
@click.option('--library_depth', default=0, help="Depth of library folders. This is useful when multiple libraries are bundled together but are initially in separate subfolders.")
@click.option('--package_folder_prefix', default="adafruit_", help="Prefix string used to determine package folders to bundle.")
@click.option('--remote_name', default="origin", help="Git remote name to use during building")
@click.option('--ignore', default="", help="Bundles to ignore building")
@click.option('--ignore', "-i", multiple=True, type=click.Choice(["py", "mpy", "example", "json"]), help="Bundles to ignore building")
def build_bundles(filename_prefix, output_directory, library_location, library_depth, package_folder_prefix, remote_name, ignore):
skip_bundles = ignore.lower().split(", ")

os.makedirs(output_directory, exist_ok=True)

package_folder_prefix = package_folder_prefix.split(", ")
Expand All @@ -258,15 +256,15 @@ def build_bundles(filename_prefix, output_directory, library_location, library_d
f.write(build_tools_version)

# Build raw source .py bundle
if "py" not in skip_bundles:
if "py" not in ignore:
zip_filename = os.path.join(output_directory,
filename_prefix + '-py-{VERSION}.zip'.format(
VERSION=bundle_version))
build_bundle(libs, bundle_version, zip_filename, package_folder_prefix,
build_tools_version=build_tools_version, remote_name=remote_name)

# Build .mpy bundle(s)
if "mpy" not in skip_bundles:
if "mpy" not in ignore:
os.makedirs("build_deps", exist_ok=True)
for version in target_versions.VERSIONS:
# Use prebuilt mpy-cross on Travis, otherwise build our own.
Expand All @@ -284,15 +282,15 @@ def build_bundles(filename_prefix, output_directory, library_location, library_d
mpy_cross=mpy_cross, build_tools_version=build_tools_version, remote_name=remote_name)

# Build example bundle
if "example" not in skip_bundles:
if "example" not in ignore:
zip_filename = os.path.join(output_directory,
filename_prefix + '-examples-{VERSION}.zip'.format(
VERSION=bundle_version))
build_bundle(libs, bundle_version, zip_filename, package_folder_prefix,
build_tools_version=build_tools_version, example_bundle=True, remote_name=remote_name)

# Build Bundle JSON
if "json" not in skip_bundles:
if "json" not in ignore:
json_filename = os.path.join(output_directory,
filename_prefix + '-{VERSION}.json'.format(
VERSION=bundle_version))
Expand Down

0 comments on commit 123186b

Please sign in to comment.