Added/moved comments.

This commit is contained in:
Anton Hvornum 2021-05-24 14:40:21 +02:00
parent 1773efbe45
commit 0d0dfc8ebe
1 changed files with 4 additions and 2 deletions

View File

@ -80,15 +80,17 @@ def load_plugin(path :str): # -> module (not sure how to write that in type defi
elif parsed_url.scheme in ('https', 'http'):
namespace = import_via_path(localize_path(path))
# Version dependency via __archinstall__version__ variable (if present) in the plugin
# Any errors in version inconsistency will be handled through normal error handling if not defined.
if namespace in sys.modules:
# Version dependency via __archinstall__version__ variable (if present) in the plugin
# Any errors in version inconsistency will be handled through normal error handling if not defined.
if hasattr(sys.modules[namespace], '__archinstall__version__'):
archinstall_major_and_minor_version = float(storage['__version__'][:find_nth(storage['__version__'], '.', 2)])
if sys.modules[namespace].__archinstall__version__ < archinstall_major_and_minor_version:
log(f"Plugin {sys.modules[namespace]} does not support the current Archinstall version.", fg="red", level=logging.ERROR)
# Locate the plugin entry-point called Plugin()
# This in accordance with the entry_points() from setup.cfg above
if hasattr(sys.modules[namespace], 'Plugin'):
try:
plugins[namespace] = sys.modules[namespace].Plugin()