move core files to weboob.core
This commit is contained in:
parent
944662c4bf
commit
1955d1be59
25 changed files with 66 additions and 44 deletions
|
|
@ -23,7 +23,7 @@ import os
|
|||
from logging import warning
|
||||
from time import sleep
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.chat import ICapChat
|
||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||
from weboob.capabilities.dating import ICapDating, StatusField
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
import os
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
||||
|
||||
from .browser import BNPorc
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.travel import ICapTravel, Station, Departure
|
||||
|
||||
from .browser import CanalTP
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.bank import ICapBank, AccountNotFound
|
||||
|
||||
from .browser import Cragr
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
from __future__ import with_statement
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.tools.browser import BrowserUnavailable
|
||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesReply):
|
|||
NAME = 'dlfp'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
EMAIL = 'romain@peerfuse.org'
|
||||
VERSION = '1.0'
|
||||
VERSION = '0.1'
|
||||
LICENSE = 'GPLv3'
|
||||
DESCRIPTION = "Da Linux French Page"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from __future__ import with_statement
|
|||
|
||||
from logging import warning
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.messages import ICapMessages, Message
|
||||
|
||||
from .browser import FourChan
|
||||
|
|
@ -28,7 +28,7 @@ class FourChanBackend(BaseBackend, ICapMessages):
|
|||
NAME = 'fourchan'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
EMAIL = 'romain@peerfuse.org'
|
||||
VERSION = '1.0'
|
||||
VERSION = '0.1'
|
||||
LICENSE = 'GPLv3'
|
||||
DESCRIPTION = "4chan website"
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.torrent import ICapTorrent
|
||||
|
||||
from .browser import GazelleBrowser
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.video import ICapVideo
|
||||
|
||||
from .browser import InaBrowser
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.travel import ICapTravel, Station, Departure
|
||||
|
||||
from .browser import Transilien
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.video import ICapVideo
|
||||
|
||||
from .browser import YoujizzBrowser
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.video import ICapVideo
|
||||
|
||||
from .browser import YoupornBrowser
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import logging
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.video import ICapVideo
|
||||
|
||||
from .browser import YoutubeBrowser
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from xml.dom import minidom
|
|||
# TODO store datetime objects instead of strings
|
||||
# from datetime import datetime
|
||||
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.weather import ICapWeather, CityNotFound, Current, Forecast
|
||||
|
||||
class YWeatherBackend(BaseBackend, ICapWeather):
|
||||
|
|
|
|||
19
weboob/core/__init__.py
Normal file
19
weboob/core/__init__.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright(C) 2010 Christophe Benz
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from .bcall import CallErrors
|
||||
|
|
@ -15,13 +15,15 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
from copy import copy
|
||||
import logging
|
||||
from logging import debug
|
||||
from threading import Thread, Event, RLock, Timer
|
||||
from .tools.misc import get_backtrace
|
||||
from weboob.tools.misc import get_backtrace
|
||||
|
||||
|
||||
__all__ = ['BackendsCall', 'CallErrors']
|
||||
|
||||
|
|
@ -22,16 +22,16 @@ from logging import warning
|
|||
import os
|
||||
import sys
|
||||
|
||||
from weboob.bcall import BackendsCall, CallErrors
|
||||
from weboob.modules import ModulesLoader, BackendsConfig
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.scheduler import Scheduler
|
||||
from weboob.core.bcall import BackendsCall
|
||||
from weboob.core.modules import ModulesLoader, BackendsConfig
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.core.scheduler import Scheduler
|
||||
|
||||
if sys.version_info[:2] <= (2, 5):
|
||||
import weboob.tools.property
|
||||
|
||||
|
||||
__all__ = ['Weboob', 'CallErrors']
|
||||
__all__ = ['Weboob']
|
||||
|
||||
|
||||
class Weboob(object):
|
||||
|
|
@ -25,15 +25,14 @@ import os
|
|||
import re
|
||||
import stat
|
||||
|
||||
import weboob.backends
|
||||
from weboob.backend import BaseBackend
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.cap import ICap
|
||||
|
||||
|
||||
__all__ = ['Module']
|
||||
|
||||
|
||||
class Module:
|
||||
class Module(object):
|
||||
def __init__(self, name, module):
|
||||
self.name = name
|
||||
self.module = module
|
||||
|
|
@ -154,12 +153,13 @@ class ModulesLoader(object):
|
|||
return self.modules[name]
|
||||
|
||||
def load(self):
|
||||
path = weboob.backends.__path__[0]
|
||||
regexp = re.compile('^%s/([\w\d_]+)$' % path)
|
||||
for root, dirs, files in os.walk(path):
|
||||
m = regexp.match(root)
|
||||
if m and '__init__.py' in files:
|
||||
self.load_module('weboob.backends.%s' % m.group(1))
|
||||
import weboob.backends
|
||||
for path in weboob.backends.__path__:
|
||||
regexp = re.compile('^%s/([\w\d_]+)$' % path)
|
||||
for root, dirs, files in os.walk(path):
|
||||
m = regexp.match(root)
|
||||
if m and '__init__.py' in files:
|
||||
self.load_module('weboob.backends.%s' % m.group(1))
|
||||
|
||||
def load_module(self, name):
|
||||
try:
|
||||
|
|
@ -172,8 +172,8 @@ class ModulesLoader(object):
|
|||
else:
|
||||
error(msg)
|
||||
return
|
||||
if name in self.modules:
|
||||
warning('Module "%s" is already loaded (%s)' % self.modules[name].module)
|
||||
if module.get_name() in self.modules:
|
||||
warning('Module "%s" is already loaded (%s)' % (self.modules[module.get_name()].module, name))
|
||||
return
|
||||
self.modules[module.get_name()] = module
|
||||
debug('Loaded module "%s" (%s)' % (name, module.module.__name__))
|
||||
debug('Loaded module "%s" from %s' % (name, module.module.__path__))
|
||||
|
|
@ -28,8 +28,8 @@ import sys
|
|||
import logging
|
||||
import asyncore
|
||||
|
||||
from weboob import Weboob
|
||||
from weboob.scheduler import Scheduler
|
||||
from weboob.core.engine import Weboob
|
||||
from weboob.core.scheduler import Scheduler
|
||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||
from weboob.tools.application import ConsoleApplication
|
||||
from weboob.tools.misc import html2text, get_backtrace, utc2local
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
from weboob import CallErrors
|
||||
from weboob.core import CallErrors
|
||||
from weboob.capabilities.weather import ICapWeather, CityNotFound
|
||||
from weboob.tools.application import ConsoleApplication
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import logging
|
|||
import optparse
|
||||
from optparse import OptionGroup, OptionParser
|
||||
|
||||
from weboob import Weboob
|
||||
from weboob.core.engine import Weboob
|
||||
from weboob.tools.config.iconfig import ConfigError
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ from optparse import OptionGroup, OptionParser
|
|||
import re
|
||||
import sys
|
||||
|
||||
import weboob
|
||||
from weboob.modules import BackendsConfig
|
||||
from weboob.core.bcall import CallErrors
|
||||
from weboob.core.modules import BackendsConfig
|
||||
|
||||
from .base import BaseApplication
|
||||
from .formatters import formatters
|
||||
|
|
@ -150,7 +150,7 @@ class ConsoleApplication(BaseApplication):
|
|||
|
||||
try:
|
||||
command_result = func(*args)
|
||||
except weboob.CallErrors, errors:
|
||||
except CallErrors, errors:
|
||||
logging.error(errors)
|
||||
return 1
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
import sys
|
||||
|
||||
from weboob import Weboob
|
||||
from weboob.scheduler import Scheduler
|
||||
from weboob.core.engine import Weboob
|
||||
from weboob.core.scheduler import Scheduler
|
||||
|
||||
from .console import ConsoleApplication
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ from PyQt4.QtGui import QMainWindow, QApplication, QStyledItemDelegate, \
|
|||
QStyleOptionViewItemV4, QTextDocument, QStyle, \
|
||||
QAbstractTextDocumentLayout, QPalette
|
||||
|
||||
from weboob import Weboob
|
||||
from weboob.scheduler import IScheduler
|
||||
from weboob.core.engine import Weboob
|
||||
from weboob.core.scheduler import IScheduler
|
||||
|
||||
from ..base import BaseApplication
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue