ARM-software / devlib

Library for interaction with and instrumentation of remote devices.
Apache License 2.0
47 stars 78 forks source link

Cleanup module load #634

Closed douglas-raillard-arm closed 4 months ago

douglas-raillard-arm commented 1 year ago

Cleanup module code to improve robustness, modularity and enable lazy loading of modules.

The main features are:

For now, modules passed to Target(modules=...) will be eagerly loaded, but that could be changed quite easily to enable full lazy loading if we wanted.

On top of that, the list of default modules is made empty. This fixes https://github.com/ARM-software/devlib/issues/611 as nothing will be loaded by default, but existing code will keep working thanks to lazy loading.

douglas-raillard-arm commented 1 year ago

Fixed unwanted error logging when using Target.has() to avoid littering WA output with:

ERROR    Module "hotplug" failed to install on target: Module "hotplug" is not supported by the target

Note that Target.has() still has to try to load the module, as only that can tell if the target supports the module or not. If the users want to speedup that process, devlib allows forcefully disabling a module no matter what, so I suppose WA could expose such deny list in its config.

douglas-raillard-arm commented 1 year ago

PR updated to import devlib.module submodules in case a Module is not found to match the previous behavior. Otherwise, people would need explicit import statement to make the relevant classes available for auto-loading.

douglas-raillard-arm commented 5 months ago

@marcbonnici Any update on this one ? AFAIR the last update to the PR fixed the outstanding issues.

douglas-raillard-arm commented 5 months ago

(last push is just a rebase on current master, there was no conflict to solve)

douglas-raillard-arm commented 4 months ago

@marcbonnici PR updated: