@@ -234,7 +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- def build_bundles (filename_prefix , output_directory , library_location , library_depth , package_folder_prefix , remote_name ):
237+ @click .option ('--ignore' , "-i" , multiple = True , type = click .Choice (["py" , "mpy" , "example" , "json" ]), help = "Bundles to ignore building" )
238+ def build_bundles (filename_prefix , output_directory , library_location , library_depth , package_folder_prefix , remote_name , ignore ):
238239 os .makedirs (output_directory , exist_ok = True )
239240
240241 package_folder_prefix = package_folder_prefix .split (", " )
@@ -255,38 +256,42 @@ def build_bundles(filename_prefix, output_directory, library_location, library_d
255256 f .write (build_tools_version )
256257
257258 # Build raw source .py bundle
258- zip_filename = os .path .join (output_directory ,
259- filename_prefix + '-py-{VERSION}.zip' .format (
260- VERSION = bundle_version ))
261- build_bundle (libs , bundle_version , zip_filename , package_folder_prefix ,
262- build_tools_version = build_tools_version , remote_name = remote_name )
263-
264- # Build .mpy bundle(s)
265- os .makedirs ("build_deps" , exist_ok = True )
266- for version in target_versions .VERSIONS :
267- # Use prebuilt mpy-cross on Travis, otherwise build our own.
268- if "TRAVIS" in os .environ :
269- mpy_cross = pkg_resources .resource_filename (
270- target_versions .__name__ , "data/mpy-cross-" + version ["name" ])
271- else :
272- mpy_cross = "build_deps/mpy-cross-" + version ["name" ] + (".exe" * (os .name == "nt" ))
273- build .mpy_cross (mpy_cross , version ["tag" ])
259+ if "py" not in ignore :
274260 zip_filename = os .path .join (output_directory ,
275- filename_prefix + '-{TAG}-mpy-{VERSION}.zip' .format (
276- TAG = version ["name" ],
261+ filename_prefix + '-py-{VERSION}.zip' .format (
277262 VERSION = bundle_version ))
278263 build_bundle (libs , bundle_version , zip_filename , package_folder_prefix ,
279- mpy_cross = mpy_cross , build_tools_version = build_tools_version , remote_name = remote_name )
264+ build_tools_version = build_tools_version , remote_name = remote_name )
265+
266+ # Build .mpy bundle(s)
267+ if "mpy" not in ignore :
268+ os .makedirs ("build_deps" , exist_ok = True )
269+ for version in target_versions .VERSIONS :
270+ # Use prebuilt mpy-cross on Travis, otherwise build our own.
271+ if "TRAVIS" in os .environ :
272+ mpy_cross = pkg_resources .resource_filename (
273+ target_versions .__name__ , "data/mpy-cross-" + version ["name" ])
274+ else :
275+ mpy_cross = "build_deps/mpy-cross-" + version ["name" ] + (".exe" * (os .name == "nt" ))
276+ build .mpy_cross (mpy_cross , version ["tag" ])
277+ zip_filename = os .path .join (output_directory ,
278+ filename_prefix + '-{TAG}-mpy-{VERSION}.zip' .format (
279+ TAG = version ["name" ],
280+ VERSION = bundle_version ))
281+ build_bundle (libs , bundle_version , zip_filename , package_folder_prefix ,
282+ mpy_cross = mpy_cross , build_tools_version = build_tools_version , remote_name = remote_name )
280283
281284 # Build example bundle
282- zip_filename = os .path .join (output_directory ,
283- filename_prefix + '-examples-{VERSION}.zip' .format (
284- VERSION = bundle_version ))
285- build_bundle (libs , bundle_version , zip_filename , package_folder_prefix ,
286- build_tools_version = build_tools_version , example_bundle = True , remote_name = remote_name )
285+ if "example" not in ignore :
286+ zip_filename = os .path .join (output_directory ,
287+ filename_prefix + '-examples-{VERSION}.zip' .format (
288+ VERSION = bundle_version ))
289+ build_bundle (libs , bundle_version , zip_filename , package_folder_prefix ,
290+ build_tools_version = build_tools_version , example_bundle = True , remote_name = remote_name )
287291
288292 # Build Bundle JSON
289- json_filename = os .path .join (output_directory ,
290- filename_prefix + '-{VERSION}.json' .format (
291- VERSION = bundle_version ))
292- build_bundle_json (libs , bundle_version , json_filename , package_folder_prefix , remote_name = remote_name )
293+ if "json" not in ignore :
294+ json_filename = os .path .join (output_directory ,
295+ filename_prefix + '-{VERSION}.json' .format (
296+ VERSION = bundle_version ))
297+ build_bundle_json (libs , bundle_version , json_filename , package_folder_prefix , remote_name = remote_name )
0 commit comments