mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-28 04:24:53 +02:00
Core: Renable the import protection for volatility3.framework.plugins
In commit 21d916b (about 10 months ago) the logic for the warning about
volatility3.framework importing was disabled. This re-enables it.
Also updates to support pyinstaller 5.10 function stack depth.
Closes #944
This commit is contained in:
@@ -38,10 +38,13 @@ class WarningFindSpec(abc.MetaPathFinder):
|
||||
"""Mock find_spec method that just checks the name, this must go
|
||||
first."""
|
||||
if fullname.startswith("volatility3.framework.plugins."):
|
||||
warning = "Please do not use the volatility3.framework.plugins namespace directly, only use volatility3.plugins"
|
||||
warning = f"Import {fullname}: Please do not use the volatility3.framework.plugins namespace directly, only use volatility3.plugins"
|
||||
# Pyinstaller uses walk_packages/_collect_submodules to import, but needs to read the modules to figure out dependencies
|
||||
# As such, we only print the warning when directly imported rather than from within walk_packages/_collect_submodules
|
||||
if inspect.stack()[-2].function in ["walk_packages", "_collect_submodules"]:
|
||||
if inspect.stack()[-2].function not in [
|
||||
"walk_packages",
|
||||
"_collect_submodules",
|
||||
] and inspect.stack()[-3].function not in ["_collect_submodules"]:
|
||||
raise Warning(warning)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user