mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
Revert "GP-5298: PyGhidra can now find modules that live in directories specified by the Bundle Manager"
This reverts commit c5d4444128
.
This commit is contained in:
parent
e840596b39
commit
1bccb8ac60
1 changed files with 1 additions and 13 deletions
|
@ -109,17 +109,6 @@ class _PyGhidraImportLoader:
|
||||||
def exec_module(self, fullname):
|
def exec_module(self, fullname):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class _GhidraBundleFinder(importlib.machinery.PathFinder):
|
|
||||||
""" (internal) Used to find modules in Ghidra bundle locations """
|
|
||||||
|
|
||||||
def find_spec(self, fullname, path=None, target=None):
|
|
||||||
from ghidra.app.script import GhidraScriptUtil
|
|
||||||
GhidraScriptUtil.acquireBundleHostReference()
|
|
||||||
for directory in GhidraScriptUtil.getEnabledScriptSourceDirectories():
|
|
||||||
spec = super().find_spec(fullname, [directory.absolutePath], target)
|
|
||||||
if spec is not None:
|
|
||||||
return spec
|
|
||||||
return None
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _plugin_lock():
|
def _plugin_lock():
|
||||||
|
@ -401,9 +390,8 @@ class PyGhidraLauncher:
|
||||||
**jpype_kwargs
|
**jpype_kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install hooks into python importlib
|
# Install hook into python importlib
|
||||||
sys.meta_path.append(_PyGhidraImportLoader())
|
sys.meta_path.append(_PyGhidraImportLoader())
|
||||||
sys.meta_path.append(_GhidraBundleFinder())
|
|
||||||
|
|
||||||
imports.registerDomain("ghidra")
|
imports.registerDomain("ghidra")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue