Merge pull request #671 from alhirzel/package-only-available-firmwares

When generating res_fw.qrc, only use compiled firmwares
This commit is contained in:
Benjamin Vedder 2023-11-08 09:41:02 +01:00 committed by GitHub
commit 25abdff981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -194,10 +194,16 @@ for directory in package_dict:
for target in package_dict[directory]:
# Shorthand variable
destination_file_name = target[1]
destination_full_path = os.path.join(destination_path, destination_file_name)
origin_file_name = target[0] + '.bin'
origin_full_path = os.path.join(build_dir, target[0], origin_file_name)
# Skip firmware that has not been built
if not os.path.isfile(origin_full_path):
continue
# Copy the file
shutil.copy(os.path.join(build_dir, target[0], origin_file_name), os.path.join(destination_path, destination_file_name))
shutil.copy(origin_full_path, destination_full_path)
# Replace the stub string with the target specifics
target_res_string = res_firmwares_string.replace("TARGET_DESTINATION_DIRECTORY", directory).replace("TARGET_DESTINATION_FILENAME", destination_file_name)