76 _ = unicode |
76 _ = unicode |
77 |
77 |
78 import sys |
78 import sys |
79 import os |
79 import os |
80 import logging |
80 import logging |
|
81 import tempfile |
81 from smtplib import SMTP |
82 from smtplib import SMTP |
82 from threading import Lock |
83 from threading import Lock |
83 from os.path import exists, join, expanduser, abspath, normpath, basename, isdir |
84 from os.path import exists, join, expanduser, abspath, normpath, basename, isdir |
84 import tempfile |
85 from warnings import warn |
85 |
86 |
86 from logilab.common.decorators import cached |
87 from logilab.common.decorators import cached |
87 from logilab.common.deprecation import deprecated |
88 from logilab.common.deprecation import deprecated |
88 from logilab.common.logging_ext import set_log_methods, init_log |
89 from logilab.common.logging_ext import set_log_methods, init_log |
89 from logilab.common.configuration import (Configuration, Method, |
90 from logilab.common.configuration import (Configuration, Method, |
478 except ImportError, err: |
479 except ImportError, err: |
479 cls.critical('could not import the command provider %s (cause : %s)' % |
480 cls.critical('could not import the command provider %s (cause : %s)' % |
480 (ctlfile, err)) |
481 (ctlfile, err)) |
481 cls.info('loaded cubicweb-ctl plugin %s', ctlfile) |
482 cls.info('loaded cubicweb-ctl plugin %s', ctlfile) |
482 for cube in cls.available_cubes(): |
483 for cube in cls.available_cubes(): |
483 pluginfile = join(cls.cube_dir(cube), 'ecplugin.py') |
484 oldpluginfile = join(cls.cube_dir(cube), 'ecplugin.py') |
|
485 pluginfile = join(cls.cube_dir(cube), 'ccplugin.py') |
484 initfile = join(cls.cube_dir(cube), '__init__.py') |
486 initfile = join(cls.cube_dir(cube), '__init__.py') |
485 if exists(pluginfile): |
487 if exists(pluginfile): |
|
488 try: |
|
489 __import__('cubes.%s.ccplugin' % cube) |
|
490 cls.info('loaded cubicweb-ctl plugin from %s', cube) |
|
491 except: |
|
492 cls.exception('while loading plugin %s', pluginfile) |
|
493 elif exists(oldpluginfile): |
|
494 warn('[3.6] %s: ecplugin module should be renamed to ccplugin' % cube, |
|
495 DeprecationWarning) |
486 try: |
496 try: |
487 __import__('cubes.%s.ecplugin' % cube) |
497 __import__('cubes.%s.ecplugin' % cube) |
488 cls.info('loaded cubicweb-ctl plugin from %s', cube) |
498 cls.info('loaded cubicweb-ctl plugin from %s', cube) |
489 except: |
499 except: |
490 cls.exception('while loading plugin %s', pluginfile) |
500 cls.exception('while loading plugin %s', oldpluginfile) |
491 elif exists(initfile): |
501 elif exists(initfile): |
492 try: |
502 try: |
493 __import__('cubes.%s' % cube) |
503 __import__('cubes.%s' % cube) |
494 except: |
504 except: |
495 cls.exception('while loading cube %s', cube) |
505 cls.exception('while loading cube %s', cube) |