mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 12:49:24 +01:00
Use importlib instead of imp.
importlib is deprecated.
This commit is contained in:
parent
9891b0fca4
commit
9ab908759a
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -53,8 +53,8 @@ __url__ = '' # 'http://supybot.com/Members/yourname/Aka/download'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
from importlib import reload
|
||||
# In case we're being reloaded.
|
||||
reload(config)
|
||||
reload(plugin)
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -49,7 +49,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -50,7 +50,7 @@ __contributors__ = {
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -49,7 +49,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -53,7 +53,7 @@ __url__ = '' # 'http://supybot.com/Members/yourname/Conditional/download'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -46,7 +46,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,9 +47,9 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
if version_info[0] >= 3:
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
from .local import dictclient
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
reload(dictclient)
|
||||
|
@ -51,7 +51,7 @@ __contributors__ = {
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -51,7 +51,7 @@ __url__ = '' # 'http://supybot.com/Members/yourname/Factoids/download'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -51,8 +51,8 @@ __url__ = ''
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
from importlib import reload
|
||||
# In case we're being reloaded.
|
||||
reload(config)
|
||||
reload(plugin)
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {supybot.authors.jamessan: ['whois']}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -49,7 +49,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {supybot.Author('Keith Jones', 'kmj', ''): ['convert']}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
from .local import convertcore
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
reload(convertcore)
|
||||
|
@ -52,7 +52,7 @@ __url__ = ''
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
import re
|
||||
import os
|
||||
import imp
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
@ -58,12 +57,6 @@ _ = PluginInternationalization('Misc')
|
||||
if minisix.PY2:
|
||||
from itertools import ifilter as filter
|
||||
|
||||
def get_suffix(file):
|
||||
for suffix in imp.get_suffixes():
|
||||
if file[-len(suffix[0]):] == suffix[0]:
|
||||
return suffix
|
||||
return None
|
||||
|
||||
def getPluginsInDirectory(directory):
|
||||
# get modules in a given directory
|
||||
plugins = []
|
||||
|
@ -49,7 +49,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -51,7 +51,7 @@ __url__ = '' # 'http://supybot.com/Members/yourname/News/download'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -51,7 +51,7 @@ __url__ = ''
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -67,7 +67,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = { supybot.authors.inkedmn: ['Original implementation.'] }
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -478,7 +478,7 @@ class Owner(callbacks.Plugin):
|
||||
if hasattr(module, 'reload') and 'x' in locals():
|
||||
module.reload(x)
|
||||
if hasattr(module, 'config'):
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(module.config)
|
||||
for callback in callbacks:
|
||||
callback.die()
|
||||
|
@ -49,7 +49,7 @@ __contributors__ = {
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -52,7 +52,7 @@ __url__ = '' # 'http://supybot.com/Members/yourname/PluginDownloader/download'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -147,7 +147,7 @@ class GithubRepository(GitRepository):
|
||||
reload_imported = True
|
||||
elif not reload_imported and \
|
||||
b'reload(' in line:
|
||||
fd.write(b'from imp import reload\n')
|
||||
fd.write(b'from importlib import reload\n')
|
||||
reload_imported = True
|
||||
fd.write(line)
|
||||
if newFileName.endswith('__init__.py'):
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -51,7 +51,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {supybot.authors.jamessan: ['xrl.us support',
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -50,7 +50,7 @@ __contributors__ = {supybot.authors.progval: ['tztime'],
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -48,7 +48,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = { supybot.authors.stepnem: ['persistence support'] }
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -49,7 +49,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -50,7 +50,7 @@ __url__ = '' # 'http://supybot.com/Members/yourname/Unix/download'
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -47,7 +47,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
|
||||
if world.testing:
|
||||
|
@ -45,7 +45,7 @@ __contributors__ = {}
|
||||
|
||||
from . import config
|
||||
from . import plugin
|
||||
from imp import reload
|
||||
from importlib import reload
|
||||
reload(plugin) # In case we're being reloaded.
|
||||
# Add more reloads here if you add third-party modules and want them to be
|
||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
||||
|
@ -28,11 +28,15 @@
|
||||
###
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import imp
|
||||
import os.path
|
||||
import linecache
|
||||
import re
|
||||
import importlib.util
|
||||
|
||||
if not hasattr(importlib.util, 'module_from_spec'):
|
||||
# Python < 3.5
|
||||
import imp
|
||||
|
||||
from . import callbacks, conf, log, registry
|
||||
|
||||
@ -60,9 +64,20 @@ def loadPluginModule(name, ignoreDeprecation=False):
|
||||
name = matched_names[0]
|
||||
else:
|
||||
raise ImportError(name)
|
||||
moduleInfo = imp.find_module(name, pluginDirs)
|
||||
|
||||
try:
|
||||
module = imp.load_module(name, *moduleInfo)
|
||||
if hasattr(importlib.util, 'module_from_spec'):
|
||||
# Python >= 3.5
|
||||
spec = importlib.machinery.PathFinder.find_spec(name, pluginDirs)
|
||||
if spec is None:
|
||||
assert ImportError(name)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
sys.modules[module.__name__] = module
|
||||
spec.loader.exec_module(module)
|
||||
else:
|
||||
# Python < 3.5
|
||||
moduleInfo = imp.find_module(name, pluginDirs)
|
||||
module = imp.load_module(name, *moduleInfo)
|
||||
except:
|
||||
sys.modules.pop(name, None)
|
||||
keys = list(sys.modules.keys())
|
||||
|
Loading…
Reference in New Issue
Block a user