New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin Loader Updates [Rebase & FF] #339
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #339 +/- ##
==========================================
- Coverage 70.59% 69.66% -0.94%
==========================================
Files 48 42 -6
Lines 4792 4790 -2
==========================================
- Hits 3383 3337 -46
- Misses 1409 1453 +44
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with optional request to update how we currently insert variables into strings for logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approve with comment about polluting the python path and potential unintended consequences.
Fixes tianocore#337 Plugins are currently loaded in the `_load()` function in plugin_manager.py by using the `imp` standard library: https://docs.python.org/3/library/imp.html The first sentence of the library documentation states the following: ``` Deprecated since version 3.4, will be removed in version 3.12: The imp module is deprecated in favor of importlib. ``` This means, `imp` will be removed in the next Python release. Therefore, this change updates the code to use `importlib` standard library as recommended by the `imp` documentation. The code follows the recipe recommended by the `importlib` documentation to directly load a Python source file as is the case when loading Python modules based on plugin descriptor information. https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Closes tianocore#338 Adds dynamically loaded plugin module directory paths to the system path so the plugin modules can import other modules relative to their path as they would if they were not dynamically loaded. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
a5757dd
to
b7ee773
Compare
This series makes two main changes:
Update usage of deprecated loading APIs
Fixes Plugin Loader dependency will be removed in Python 3.12 #337
Plugins are currently loaded in the
_load()
function inplugin_manager.py by using the
imp
standard library:https://docs.python.org/3/library/imp.html
The first sentence of the library documentation states the following:
This means,
imp
will be removed in the next Python release.Therefore, this change updates the code to use
importlib
standardlibrary as recommended by the
imp
documentation.The code follows the recipe recommended by the
importlib
documentation to directly load a Python source file as is the case
when loading Python modules based on plugin descriptor information.
https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
Add plugin module paths to system path
Closes [Feature]: Allow plugins to reference relative modules #338
Adds dynamically loaded plugin module directory paths to the system
path so the plugin modules can import other modules relative to their
path as they would if they were not dynamically loaded.