Skip to content

Commit 123186b

Browse files
committed
Use click.Choice
1 parent fa23552 commit 123186b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

circuitpython_build_tools/scripts/build_bundles.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,8 @@ def _find_libraries(current_path, depth):
234234
@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.")
235235
@click.option('--package_folder_prefix', default="adafruit_", help="Prefix string used to determine package folders to bundle.")
236236
@click.option('--remote_name', default="origin", help="Git remote name to use during building")
237-
@click.option('--ignore', default="", help="Bundles to ignore building")
237+
@click.option('--ignore', "-i", multiple=True, type=click.Choice(["py", "mpy", "example", "json"]), help="Bundles to ignore building")
238238
def build_bundles(filename_prefix, output_directory, library_location, library_depth, package_folder_prefix, remote_name, ignore):
239-
skip_bundles = ignore.lower().split(", ")
240-
241239
os.makedirs(output_directory, exist_ok=True)
242240

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

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

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

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

294292
# Build Bundle JSON
295-
if "json" not in skip_bundles:
293+
if "json" not in ignore:
296294
json_filename = os.path.join(output_directory,
297295
filename_prefix + '-{VERSION}.json'.format(
298296
VERSION=bundle_version))

0 commit comments

Comments
 (0)