# Path: mirror/common.py
# def write_stderr(message, *args):
#     """
#     """
#     sys.stderr.write(message % args)
#     sys.stderr.write("\n")


import os, sys
import signal
import mirror.log
import mirror.error
import mirror.console
    import mirror.common
    import mirror.configmanager
            import grp
            import pwd
    import logging
    import mirror.handler
        import hotshot
            import hotshot.stats
from   optparse import OptionParser
from mirror.common import write_stderr
        from mirror.daemon import MirrorDaemon
    if options.list_tasks:
        sys.exit(mirror.console.list_task_queue())

    if options.signal:
        sys.exit(mirror.console.signal_process(options.signal))

    if options.quiet:
        options.loglevel = "none"
    if not options.loglevel:
        options.loglevel = "info"

    logfile_mode = 'w'
    if options.rotate_logs:
        logfile_mode = 'a'

    if options.config:
        if not mirror.configmanager.set_config_dir(options.config):
            write_stderr("There was an error setting the config dir! Exiting.."),
            sys.exit(1)

    # Check if config dir exists
    config_dir = mirror.configmanager.get_config_dir()
    if not os.path.isdir(config_dir):
        write_stderr(_("Config dir does not exist: %s, please create and write your mirror.ini"),
                     config_dir)
        sys.exit(1)

    # Check if main config file exists
    config_file = mirror.configmanager.get_config_dir('mirror.ini')
    if not os.path.isfile(config_file):

# Path: mirror/common.py
# def write_stderr(message, *args):
#     """
#     """
#     sys.stderr.write(message % args)
#     sys.stderr.write("\n")


# Path: mirror/main.py
import os, sys
import signal
import mirror.log
import mirror.error
import mirror.console
    import mirror.common
    import mirror.configmanager
            import grp
            import pwd
    import logging
    import mirror.handler
        import hotshot
            import hotshot.stats
from   optparse import OptionParser
from mirror.common import write_stderr
        from mirror.daemon import MirrorDaemon

    if options.list_tasks:
        sys.exit(mirror.console.list_task_queue())

    if options.signal:
        sys.exit(mirror.console.signal_process(options.signal))

    if options.quiet:
        options.loglevel = "none"
    if not options.loglevel:
        options.loglevel = "info"

    logfile_mode = 'w'
    if options.rotate_logs:
        logfile_mode = 'a'

    if options.config:
        if not mirror.configmanager.set_config_dir(options.config):
            write_stderr("There was an error setting the config dir! Exiting.."),
            sys.exit(1)

    # Check if config dir exists
    config_dir = mirror.configmanager.get_config_dir()
    if not os.path.isdir(config_dir):
        write_stderr(_("Config dir does not exist: %s, please create and write your mirror.ini"),
                     config_dir)
        sys.exit(1)

    # Check if main config file exists
    config_file = mirror.configmanager.get_config_dir('mirror.ini')
    if not os.path.isfile(config_file):

        write_stderr(_("Config file does not exist: %s, please write one"),