Skip to content

Commit

Permalink
better naming for zip file and folder within zip file
Browse files Browse the repository at this point in the history
  • Loading branch information
elral committed Sep 11, 2024
1 parent c09ae89 commit 572599f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
17 changes: 10 additions & 7 deletions Template/MyCustomDevice_platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ build_src_filter =
lib_deps = ; You can add additional libraries if required
custom_core_firmware_version = 2.5.1 ; define the version from the core firmware files your build should base on
custom_source_folder = Template ; path to your Custom Device Sources, replace "Template" by your folder name
custom_community_project = Your_Project ; name of the ZIP file, revision will be added during build process
custom_community_folder = Your_Folder_Name ; Folder name inside zip file
custom_community_project = YourProject ; Folder name inside zip file, also ZIP file name if "custom_zip_filename" is not changed
custom_zip_filename = ${env_template.custom_community_project} ; Name of the ZIP file, overwrite it to define an other ZIP file name

; Build settings for the Arduino Mega with Custom Firmware Template
[env:mobiflight_template_mega]
Expand All @@ -42,7 +42,7 @@ extra_scripts =
custom_core_firmware_version = ${env_template.custom_core_firmware_version} ; don't change this one!
custom_community_project = ${env_template.custom_community_project} ; don't change this one!
custom_source_folder = ${env_template.custom_source_folder} ; don't change this one!
custom_community_folder = ${env_template.custom_community_folder} ; don't change this one!
custom_zip_filename = ${env_template.custom_zip_filename} ; don't change this one!

; Build settings for the Arduino ProMicro with Custom Firmware Template
[env:mobiflight_template_micro]
Expand All @@ -66,7 +66,8 @@ extra_scripts =
${env.extra_scripts} ; don't change this one!
custom_core_firmware_version = ${env_template.custom_core_firmware_version} ; don't change this one!
custom_community_project = ${env_template.custom_community_project} ; don't change this one!
custom_device_folder = ${env_template.custom_device_folder} ; don't change this one!
custom_source_folder = ${env_template.custom_source_folder} ; don't change this one!
custom_zip_filename = ${env_template.custom_zip_filename} ; don't change this one!


; Build settings for the Arduino Uno with Custom Firmware Template
Expand All @@ -91,7 +92,8 @@ extra_scripts =
${env.extra_scripts} ; don't change this one!
custom_core_firmware_version = ${env_template.custom_core_firmware_version} ; don't change this one!
custom_community_project = ${env_template.custom_community_project} ; don't change this one!
custom_device_folder = ${env_template.custom_device_folder} ; don't change this one!
custom_source_folder = ${env_template.custom_source_folder} ; don't change this one!
custom_zip_filename = ${env_template.custom_zip_filename} ; don't change this one!


; Build settings for the Arduino Nano with Custom Firmware Template
Expand All @@ -116,7 +118,8 @@ extra_scripts =
${env.extra_scripts} ; don't change this one!
custom_core_firmware_version = ${env_template.custom_core_firmware_version} ; don't change this one!
custom_community_project = ${env_template.custom_community_project} ; don't change this one!
custom_device_folder = ${env_template.custom_device_folder} ; don't change this one!
custom_source_folder = ${env_template.custom_source_folder} ; don't change this one!
custom_zip_filename = ${env_template.custom_zip_filename} ; don't change this one!


; Build settings for the Raspberry Pico with Custom Firmware Template
Expand Down Expand Up @@ -146,4 +149,4 @@ extra_scripts =
custom_core_firmware_version = ${env_template.custom_core_firmware_version} ; don't change this one!
custom_community_project = ${env_template.custom_community_project} ; don't change this one!
custom_source_folder = ${env_template.custom_source_folder} ; don't change this one!
custom_community_folder = ${env_template.custom_community_folder} ; don't change this one!
custom_zip_filename = ${env_template.custom_zip_filename} ; don't change this one!
7 changes: 3 additions & 4 deletions copy_fw_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
custom_source_folder = env.GetProjectOption('custom_source_folder', "")

# Get the foldername inside the zip file from the build environment.
community_folder = env.GetProjectOption('custom_community_folder', "")
zip_filename = env.GetProjectOption('custom_zip_filename', "")

platform = env.BoardConfig().get("platform", {})

Expand All @@ -34,10 +34,9 @@ def copy_fw_files (source, target, env):
print("Copying community folder")
shutil.copy(fw_file_name, "./_build/" + custom_source_folder + "/Community/firmware")
original_folder_path = "./_build/" + custom_source_folder + "/Community"
zip_file_path = './_dist/' + community_project + '_' + firmware_version + '.zip'
new_folder_in_zip = community_folder
zip_file_path = './_dist/' + zip_filename + '_' + firmware_version + '.zip'
print("Creating zip file")
createZIP(original_folder_path, zip_file_path, new_folder_in_zip)
createZIP(original_folder_path, zip_file_path, community_project)

def createZIP(original_folder_path, zip_file_path, new_folder_name):
if os.path.exists("./_dist") == False:
Expand Down

0 comments on commit 572599f

Please sign in to comment.