|
| 1 | +import importlib.util |
| 2 | +import os |
| 3 | +import sys |
| 4 | + |
| 5 | +# XXX: importing excavations this way is a kludge to avoid multiple rounds |
| 6 | +# of file splitting churn that would pollute diffs.. important as the |
| 7 | +# the most critical thing (for now) is avoiding changes to behaviour |
| 8 | +def _import_name(import_name): |
| 9 | + import_path = f"{import_name}.py" |
| 10 | + spec = importlib.util.spec_from_file_location(import_name, import_path) |
| 11 | + mod = importlib.util.module_from_spec(spec) |
| 12 | + spec.loader.exec_module(mod) |
| 13 | + return mod |
| 14 | + |
| 15 | +from .ddhf.cpm_excavator import Cpm as cpm |
| 16 | +cbm900 = _import_name("ddhf_cbm900").Cbm900 |
| 17 | +cr80 = _import_name("ddhf_cr80").Cr80Floppy |
| 18 | +cr80_wang = _import_name("ddhf_cr80_wang").Cr80Wang |
| 19 | +dask = _import_name("ddhf_dask").Dask |
| 20 | +gier = _import_name("ddhf_gier").Gier |
| 21 | +intel_isis = _import_name("ddhf_intel_isis").IntelISIS |
| 22 | +r1k = _import_name("ddhf_r1k_tapes").R1k |
| 23 | +r1k_backup = _import_name("ddhf_r1k_backup").R1kBackup |
| 24 | +r1k_dfs = _import_name("ddhf_r1k_dfs").R1kDFS |
| 25 | +rc3600 = _import_name("ddhf_rc3600").Rc3600 |
| 26 | +uug = _import_name("ddhf_dkuug").DkuugEuug |
| 27 | +zilog_mcz = _import_name("ddhf_zilog_mcz").ZilogMCZ |
| 28 | + |
| 29 | +# from .gier import configure_excavation as gier |
| 30 | +# from .intel_isis import configure_excavation as intel_isis |
| 31 | +# from .r1kdfs import configure_excavation as r1kdfs |
| 32 | +# from .uug import configure_excavation as uug |
| 33 | + |
| 34 | +__all__ = [ |
| 35 | + "cbm900", |
| 36 | + "cpm", |
| 37 | + "cr80", |
| 38 | + "cr80_wang", |
| 39 | + "dask", |
| 40 | + "gier", |
| 41 | + "intel_isis", |
| 42 | + "r1k", |
| 43 | + "r1k_backup", |
| 44 | + "r1k_dfs", |
| 45 | + "rc3600", |
| 46 | + "uug", |
| 47 | + "zilog_mcz", |
| 48 | +] |
| 49 | + |
| 50 | +EXCAVATORS = {name:getattr(sys.modules[__name__], name) for name in __all__} |
| 51 | + |
| 52 | +def excavator_by_name(excavator_name): |
| 53 | + if excavator_name not in EXCAVATORS: |
| 54 | + raise LookupError(f'no extractor named "{excavator_name}"') |
| 55 | + return EXCAVATORS[excavator_name] |
0 commit comments