# Path: ravel/log.py
# LEVELS = { "debug" : logging.DEBUG,
#            "info" : logging.INFO,
#            "warning" : logging.WARNING,
#            "error" : logging.ERROR,
#            "critical" : logging.CRITICAL
#        }
# DEFAULT_LEVEL = logging.ERROR
# MSG_FORMAT = "%(levelname)s:%(funcName)s: %(message)s"
# class Singleton(type):
# class RavelLogger(Logger, object):
#     def __init__(cls, name, bases, dict_):
#     def __call__(cls, *args, **kw):
#     def __init__(self):
#     def setLogLevel(self, levelname=None):


import ConfigParser
import os
import re
import sys
from ravel.log import logger
    newstr = 'sys.path.append("{0}")'.format(path)
    pattern = re.compile(r"sys.path.append\(\S+\)")
    content = re.sub(pattern, newstr, content)

    open(filename, "w").write(content)

def append_path(path):
    """Append a path to PYTHONPATH
       path: the path to append to PYTHONPATH"""
    path = os.path.expanduser(path)
    if "PYTHONPATH" not in os.environ:
        os.environ["PYTHONPATH"] = ""

    sys.path = os.environ["PYTHONPATH"].split(":") + sys.path

    if path is None or path == "":
        path = "."

    if path not in sys.path:
        sys.path.append(path)

def resource_string(name):
    """Search for a file within the distribution and return it as a string
       name: the name of the file as a relative path from the top-level
       directory
       returns: the contents of the file as a string, if it exists"""
    path = resource_file(name)
    if os.path.isfile(name):
        return open(path, "r").read()
    else:

# Path: ravel/log.py
# LEVELS = { "debug" : logging.DEBUG,
#            "info" : logging.INFO,
#            "warning" : logging.WARNING,
#            "error" : logging.ERROR,
#            "critical" : logging.CRITICAL
#        }
# DEFAULT_LEVEL = logging.ERROR
# MSG_FORMAT = "%(levelname)s:%(funcName)s: %(message)s"
# class Singleton(type):
# class RavelLogger(Logger, object):
#     def __init__(cls, name, bases, dict_):
#     def __call__(cls, *args, **kw):
#     def __init__(self):
#     def setLogLevel(self, levelname=None):


# Path: ravel/util.py
import ConfigParser
import os
import re
import sys
from ravel.log import logger

    newstr = 'sys.path.append("{0}")'.format(path)
    pattern = re.compile(r"sys.path.append\(\S+\)")
    content = re.sub(pattern, newstr, content)

    open(filename, "w").write(content)

def append_path(path):
    """Append a path to PYTHONPATH
       path: the path to append to PYTHONPATH"""
    path = os.path.expanduser(path)
    if "PYTHONPATH" not in os.environ:
        os.environ["PYTHONPATH"] = ""

    sys.path = os.environ["PYTHONPATH"].split(":") + sys.path

    if path is None or path == "":
        path = "."

    if path not in sys.path:
        sys.path.append(path)

def resource_string(name):
    """Search for a file within the distribution and return it as a string
       name: the name of the file as a relative path from the top-level
       directory
       returns: the contents of the file as a string, if it exists"""
    path = resource_file(name)
    if os.path.isfile(name):
        return open(path, "r").read()
    else:

        logger.error("cannot read file %s", path)