3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 04:59:24 +01:00

networks: reload shared modules used by protocol modules too

This commit is contained in:
James Lu 2018-08-23 02:56:01 -04:00
parent 8a096e537c
commit 5838d88404
2 changed files with 14 additions and 2 deletions

View File

@ -3,7 +3,8 @@ import importlib
import types
import threading
from pylinkirc import utils, world, conf, classes
import pylinkirc
from pylinkirc import utils, world
from pylinkirc.log import log
from pylinkirc.coremods import control, permissions
@ -177,7 +178,17 @@ def reloadproto(irc, source, args):
irc.error('Not enough arguments (needs 1: protocol module name)')
return
# Reload the dependency libraries first
importlib.reload(pylinkirc.classes)
log.debug('networks.reloadproto: reloading %s', pylinkirc.classes)
for common_name in pylinkirc.protocols.common_modules:
module = utils._get_protocol_module(common_name)
log.debug('networks.reloadproto: reloading %s', module)
importlib.reload(module)
proto = utils._get_protocol_module(name)
log.debug('networks.reloadproto: reloading %s', proto)
importlib.reload(proto)
irc.reply("Done. You will have to manually disconnect and reconnect any network using the %r module for changes to apply." % name)

View File

@ -1 +1,2 @@
# Stub so that pylinkirc.protocols is a module
# Abstract modules containing shared protocol code; modules higher in the hierarchy go first
common_modules = ['ircs2s_common', 'ts6_common']