(self, plugin_data: str)
| 763 | sys.exit(1) |
| 764 | |
| 765 | def _write_plugin_to_temp_file(self, plugin_data: str) -> Path: |
| 766 | if not plugin_data.strip(): |
| 767 | error('The downloaded plugin is empty') |
| 768 | sys.exit(1) |
| 769 | |
| 770 | tmp_file = tempfile.NamedTemporaryFile( |
| 771 | mode='w', |
| 772 | suffix='.py', |
| 773 | prefix='archinstall_plugin_', |
| 774 | delete=False, |
| 775 | ) |
| 776 | |
| 777 | try: |
| 778 | with tmp_file as f: |
| 779 | f.write(plugin_data) |
| 780 | except OSError as err: |
| 781 | error(f'Could not write the downloaded plugin to a temporary file: {err}') |
| 782 | sys.exit(1) |
| 783 | |
| 784 | return Path(tmp_file.name) |
| 785 | |
| 786 | def _read_file(self, path: Path) -> str: |
| 787 | if not path.exists(): |
no test coverage detected