Kaydet (Commit) 41a68a4f authored tarafından Lionel Elie Mamane's avatar Lionel Elie Mamane

pyuno: hook into import *after* the _whole_ uno module is successfully loaded

This avoids breaking the whole python process module importing
when an uno.py import failure happens after the hooking point.
In that case, _uno_import is still the python module loader,
but _g_delegatee is not anymore bound to the previously installed
importer, and thus any module import fails with:
  File "/home/master/src/libreoffice/core/install/basis3.5/program/uno.py", line 260, in _uno_import
    return _g_delegatee( name, *optargs, **kwargs )
TypeError: 'NoneType' object is not callable
üst a9b9b405
...@@ -301,9 +301,6 @@ def _uno_import( name, *optargs, **kwargs ): ...@@ -301,9 +301,6 @@ def _uno_import( name, *optargs, **kwargs ):
raise ImportError( "type "+ name + "." +x + " is unknown" ) raise ImportError( "type "+ name + "." +x + " is unknown" )
return mod return mod
# hook into the __import__ chain
__builtin__.__dict__["__import__"] = _uno_import
# private function, don't use # private function, don't use
def _impl_extractName(name): def _impl_extractName(name):
r = list(range(len(name)-1,0,-1)) r = list(range(len(name)-1,0,-1))
...@@ -366,4 +363,7 @@ def _uno_extract_printable_stacktrace( trace ): ...@@ -366,4 +363,7 @@ def _uno_extract_printable_stacktrace( trace ):
ret = "Couldn't import traceback module" ret = "Couldn't import traceback module"
return ret return ret
# hook into the __import__ chain
__builtin__.__dict__["__import__"] = _uno_import
# vim:set shiftwidth=4 softtabstop=4 expandtab: # vim:set shiftwidth=4 softtabstop=4 expandtab:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment