-
Notifications
You must be signed in to change notification settings - Fork 11
Added: manifest, directory, binary support #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Added support for file manifest, so firmware files can be changed OTA. Improved support for binary files. Added support for subdirectories (must include a trailing slash in manifest to create directory) Improved error handling for OSErrors
olivergregorius
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mattjackets,
could you please add some tests?
| response.close() | ||
| if response_status_code != 200: | ||
| print(f'Remote manifest file {host}/{project}/{remote_version}{prefix_or_path_separator}manifest not found') | ||
| raise Exception(f"Missing manifest for {remote_version}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| raise Exception(f"Missing manifest for {remote_version}") | |
| raise Exception(f'Missing manifest for {remote_version}') |
| filenames = fetch_manifest(host, project, remote_version, prefix_or_path_separator, auth=auth, timeout=timeout) | ||
| for filename in filenames: | ||
| if filename.endswith('/'): | ||
| dir_path="tmp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| dir_path="tmp" | |
| dir_path='tmp' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could define dir_path at the beginning of the method and reference this var in the uos.mkdir call.
| dir_path="tmp" | ||
| for dir in filename.split('/'): | ||
| if len(dir) > 0: | ||
| built_path=f"{dir_path}/{dir}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| built_path=f"{dir_path}/{dir}" | |
| built_path=f'{dir_path}/{dir}' |
| for filename in filenames: | ||
| with open(f'tmp/{filename}', 'r') as source_file, open(filename, 'w') as target_file: | ||
| if filename.endswith('/'): | ||
| dir_path="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| dir_path="" | |
| dir_path='' |
| dir_path="" | ||
| for dir in filename.split('/'): | ||
| if len(dir) > 0: | ||
| built_path=f"{dir_path}/{dir}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| built_path=f"{dir_path}/{dir}" | |
| built_path=f'{dir_path}/{dir}' |
| except OSError as e: | ||
| if e.errno != 17: | ||
| raise | ||
| dirs.append(f"tmp/{built_path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| dirs.append(f"tmp/{built_path}") | |
| dirs.append(f'tmp/{built_path}') |
| raise | ||
| dirs.append(f"tmp/{built_path}") | ||
| continue | ||
| #print(f"tmp/{filename} -> {filename}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover?
Added support for file manifest, so firmware files can be changed OTA. Improved support for binary files.
Added support for subdirectories (must include a trailing slash in manifest to create directory) Improved error handling for OSErrors