mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 16:22:57 -07:00
Update Mako-1.1.5
This commit is contained in:
parent
4eb0fea423
commit
668f6bfbb8
5 changed files with 28 additions and 12 deletions
|
@ -99,11 +99,20 @@ else:
|
|||
|
||||
|
||||
if py3k:
|
||||
from importlib import machinery
|
||||
|
||||
def load_module(module_id, path):
|
||||
return machinery.SourceFileLoader(module_id, path).load_module()
|
||||
from importlib import machinery, util
|
||||
|
||||
if hasattr(util, 'module_from_spec'):
|
||||
# Python 3.5+
|
||||
def load_module(module_id, path):
|
||||
spec = util.spec_from_file_location(module_id, path)
|
||||
module = util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
else:
|
||||
def load_module(module_id, path):
|
||||
module = machinery.SourceFileLoader(module_id, path).load_module()
|
||||
del sys.modules[module_id]
|
||||
return module
|
||||
|
||||
else:
|
||||
import imp
|
||||
|
@ -111,7 +120,9 @@ else:
|
|||
def load_module(module_id, path):
|
||||
fp = open(path, "rb")
|
||||
try:
|
||||
return imp.load_source(module_id, path, fp)
|
||||
module = imp.load_source(module_id, path, fp)
|
||||
del sys.modules[module_id]
|
||||
return module
|
||||
finally:
|
||||
fp.close()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue