2012-08-14 03:51:55 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
# Nemubot is a smart and modulable IM bot.
|
|
|
|
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
|
2012-08-14 03:51:55 +00:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-03-05 20:42:46 +00:00
|
|
|
__version__ = '4.0.dev2'
|
2014-08-29 09:53:32 +00:00
|
|
|
__author__ = 'nemunaire'
|
2012-08-16 02:32:47 +00:00
|
|
|
|
2015-02-10 02:46:50 +00:00
|
|
|
from nemubot.modulecontext import ModuleContext
|
|
|
|
context = ModuleContext(None, None)
|
|
|
|
|
2015-07-19 12:04:01 +00:00
|
|
|
|
|
|
|
def requires_version(min=None, max=None):
|
|
|
|
"""Raise ImportError if the current version is not in the given range
|
|
|
|
|
|
|
|
Keyword arguments:
|
|
|
|
min -- minimal compatible version
|
|
|
|
max -- last compatible version
|
|
|
|
"""
|
|
|
|
|
|
|
|
from distutils.version import LooseVersion
|
|
|
|
if min is not None and LooseVersion(__version__) < LooseVersion(str(min)):
|
|
|
|
raise ImportError("Requires version above %s, "
|
|
|
|
"but this is nemubot v%s." % (str(min), __version__))
|
|
|
|
if max is not None and LooseVersion(__version__) > LooseVersion(str(max)):
|
|
|
|
raise ImportError("Requires version under %s, "
|
|
|
|
"but this is nemubot v%s." % (str(max), __version__))
|
|
|
|
|
|
|
|
|
2012-08-14 03:51:55 +00:00
|
|
|
def reload():
|
2015-04-06 09:31:39 +00:00
|
|
|
"""Reload code of all Python modules used by nemubot
|
|
|
|
"""
|
|
|
|
|
2015-02-21 12:51:40 +00:00
|
|
|
import imp
|
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.channel
|
|
|
|
imp.reload(nemubot.channel)
|
2012-09-01 13:49:30 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.consumer
|
|
|
|
imp.reload(nemubot.consumer)
|
2012-09-01 13:49:30 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.event
|
|
|
|
imp.reload(nemubot.event)
|
2012-08-14 04:56:28 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.exception
|
|
|
|
imp.reload(nemubot.exception)
|
2014-09-09 05:02:41 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.hooks
|
|
|
|
imp.reload(nemubot.hooks)
|
2014-10-09 05:39:38 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
nemubot.hooks.reload()
|
2014-09-09 05:02:41 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.importer
|
|
|
|
imp.reload(nemubot.importer)
|
2012-08-14 03:51:55 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.message
|
|
|
|
imp.reload(nemubot.message)
|
2012-08-14 03:51:55 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
nemubot.message.reload()
|
2014-10-09 05:39:38 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.prompt
|
|
|
|
imp.reload(nemubot.prompt)
|
2014-10-09 05:39:38 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
nemubot.prompt.reload()
|
2012-08-14 03:51:55 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.server
|
|
|
|
rl, wl, xl = nemubot.server._rlist, nemubot.server._wlist, nemubot.server._xlist
|
|
|
|
imp.reload(nemubot.server)
|
|
|
|
nemubot.server._rlist, nemubot.server._wlist, nemubot.server._xlist = rl, wl, xl
|
2014-10-09 05:39:38 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
nemubot.server.reload()
|
2014-09-09 05:02:41 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
import nemubot.tools
|
|
|
|
imp.reload(nemubot.tools)
|
2014-10-09 05:39:38 +00:00
|
|
|
|
2015-01-03 19:17:46 +00:00
|
|
|
nemubot.tools.reload()
|