-
Notifications
You must be signed in to change notification settings - Fork 23
Motorola SREC and Intel HEX file extraction support #544
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
🆕 New Folders (1)
🧪 SBOM Results (2/17)
|
WorkingRobot
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.
LGTM except for a few spots. I wonder if we should refactor this and the file decompression to compartmentalize the cache handling system?
| default_value = False | ||
| else: | ||
| # Have to convert from string to Boolean | ||
| default_value = default_value.lower() == "true" | ||
| self.value = self.__config_manager.get(self.plugin_name, self.info.name, default_value) | ||
| self.value = str( | ||
| self.__config_manager.get(self.plugin_name, self.info.name, default_value) | ||
| ) | ||
| elif self.info.type_ == "int": | ||
| self.input_field = textual.widgets.Input(type="integer") | ||
| default_value = self.info.default | ||
| if default_value is None: | ||
| default_value = 0 | ||
| self.value = str( | ||
| self.__config_manager.get(self.plugin_name, self.info.name, int(default_value)) | ||
| ) |
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.
Should this TUI code be in a separate PR?
|
|
||
| MAX_FILE_SIZE = int(ConfigManager().get("srec_hex", "max_file_size", 1000000)) | ||
| STRIP_LEADING_ZEROS = bool(ConfigManager().get("srec_hex", "strip_leading_zeros", False)) | ||
| EXTRACT_DIR = pathlib.Path(ConfigManager().get("srec_hex", "output_path", "")).absolute() |
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.
EXTRACT_DIR should imitate file_decompression.py and use tempfile.gettempdir() as a default. pathlib.Path("").absolute() uses the current working directory.
|
|
||
| def get_first_and_last_address(data: List[WriteInfo]) -> Tuple[int, int]: | ||
| # Arbitrarly large number so smaller addresses will always compare true | ||
| first_address = 2 << 65 |
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.
Probably fine? Feels wrong to have a magic number here.
|
|
||
| _base_path = pathlib.Path(__file__).parent.absolute() | ||
| _data_dir = os.path.join(_base_path, "..", "data", "binary") | ||
| _expected_output_loc = os.path.join(_base_path, "..", "data", "msitest_no1", "test.msi") |
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.
Might be a good idea to move the msi into the data/binary folder so we can separate the msi test files from the srec/hex test files.
Summary
If merged this pull request will add support for extracting files from Motorola SREC and Intel HEX files into a user-specified directory. This address #257.