def initialize():
    """Imports all python files from the hook directory."""
    global HOOKS
    if initialized:
        return
    HOOKS = PluginManager()
    HOOKS.add_directory(os.path.abspath(os.path.join(os.path.dirname(
        __file__))))
    HOOKS.rescan_directories()
import socket
import sys
import time

from django.conf import settings
from django.core.management.base import BaseCommand
from django.db.models import get_models
from django.utils.translation import ugettext as _

from issues import hooks
from issues.models import Tracker
from issues.plugin import PluginManager


PLUGINS = PluginManager()
PLUGINS.add_directory(os.path.abspath(os.path.join(os.path.dirname(__file__),
                                                   '../../backends')))
PLUGINS.rescan_directories()


class Command(BaseCommand):

    help = _(u'Synchronizes one or many issue tracker.')

    option_list = BaseCommand.option_list + (
        make_option('--dry-run',
            action='store_true',
            dest='dry_run',
            default=False,
            help='Test the synchronisation but don\'t make changes'),
        )