Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds@gmail.com>2021-05-24 14:13:45 +0200
committerAnton Hvornum <anton.feeds@gmail.com>2021-05-24 14:13:45 +0200
commit2b5ad7e52ef69255918e396d599536b1907f6b46 (patch)
tree04ff9b7504fb053e1096e450b222f524e2f964fa /archinstall
parent250eb93f103acc6110782aad4f897edfc1781bd6 (diff)
Added a comment
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/plugins.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/archinstall/lib/plugins.py b/archinstall/lib/plugins.py
index 8376f3d5..b7b6afbb 100644
--- a/archinstall/lib/plugins.py
+++ b/archinstall/lib/plugins.py
@@ -23,6 +23,8 @@ for plugin_definition in metadata.entry_points()['archinstall.plugin']:
log(err, level=logging.ERROR)
log(f"The above error was detected when loading the plugin: {plugin_definition}", fg="red", level=logging.ERROR)
+
+# The following functions and core are support structures for load_plugin()
def localize_path(profile_path :str) -> str:
if (url := urllib.parse.urlparse(profile_path)).scheme and url.scheme in ('https', 'http'):
converted_path = f"/tmp/{os.path.basename(profile_path).replace('.py', '')}_{hashlib.md5(os.urandom(12)).hexdigest()}.py"
@@ -34,6 +36,7 @@ def localize_path(profile_path :str) -> str:
else:
return profile_path
+
def import_via_path(path :str, namespace=None): # -> module (not sure how to write that in type definitions)
if not namespace:
namespace = os.path.basename(path)
@@ -53,6 +56,7 @@ def import_via_path(path :str, namespace=None): # -> module (not sure how to wri
log(err, level=logging.ERROR)
log(f"The above error was detected when loading the plugin: {path}", fg="red", level=logging.ERROR)
+
def load_plugin(path :str): # -> module (not sure how to write that in type definitions)
parsed_url = urllib.parse.urlparse(path)
@@ -68,4 +72,4 @@ def load_plugin(path :str): # -> module (not sure how to write that in type defi
plugins[namespace] = sys.modules[namespace].Plugin()
except Exception as err:
log(err, level=logging.ERROR)
- log(f"The above error was detected when loading the plugin: {path}", fg="red", level=logging.ERROR) \ No newline at end of file
+ log(f"The above error was detected when initiating the plugin: {path}", fg="red", level=logging.ERROR) \ No newline at end of file