From 6de36901f52b57030810522542e063f2a704094f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 29 Nov 2023 17:40:31 -0600 Subject: [PATCH] Allow any ".bin" file to be shipped in a circuitpython package This will allow e.g., 5x8.bin & ov5640_autofocus.bin within bundles. the behavior of bundlefly and circup when encountering .bin files needs to be checked. Tested by building modified pycamera bundle and the autofocus.bin file appears in the generated zip files: ````` pycamera-py-ec67bde/lib/adafruit_pycamera/ov5640_autofocus.bin 4077 4096 pycamera-8.x-mpy-ec67bde/lib/adafruit_pycamera/ov5640_autofocus.bin 4077 4096 pycamera-9.x-mpy-ec67bde/lib/adafruit_pycamera/ov5640_autofocus.bin 4077 4096 ````` --- circuitpython_build_tools/build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circuitpython_build_tools/build.py b/circuitpython_build_tools/build.py index 06bcfad..72dd593 100644 --- a/circuitpython_build_tools/build.py +++ b/circuitpython_build_tools/build.py @@ -37,7 +37,7 @@ import tempfile IGNORE_PY = ["setup.py", "conf.py", "__init__.py"] -GLOB_PATTERNS = ["*.py", "font5x8.bin"] +GLOB_PATTERNS = ["*.py", "*.bin"] S3_MPY_PREFIX = "https://adafruit-circuit-python.s3.amazonaws.com/bin/mpy-cross" def version_string(path=None, *, valid_semver=False): @@ -283,7 +283,7 @@ def library(library_path, output_directory, package_folder_prefix, _munge_to_temp(full_path, temp_file, library_version) temp_filename = temp_file.name # Windows: close the temp file before it can be read or copied by name - if not mpy_cross or os.stat(full_path).st_size == 0: + if not mpy_cross or os.stat(full_path).st_size == 0 or not full_path.endswith(".py"): output_file = os.path.join(output_directory, filename.relative_to(library_path)) shutil.copyfile(temp_filename, output_file)