# Path: relo/core/log.py
# LEVEL = {
#     'NORMAL': 0,
#     'INFO': 1,
#     'DEBUG': 2,
#     'CRITICAl': 0,
#     'ERROR': 0,
#     'EXCEPTION': 0,
# }
#     ESCAPE = '\033[%sm'
#     BOLD = '1;%s'
#     UNDERLINE = '4;%s'
#     BLUE_ARROW = ESCAPE % (BOLD % '34') # Blue Bold
#     DEBUG = ESCAPE % (BOLD % '35') # Magenta Bold
#     HEAD = ESCAPE % (BOLD % '1') # Bold White (Standard Color)
#     INFO = ESCAPE % '32' # Green Normal
#     WARNING = ESCAPE % '33' # Yellow Normal
#     ERROR = ESCAPE % '31' # Red Normal
#     CRITICAL = ESCAPE % (UNDERLINE % '31') # Red Underline
#     ITEM = ESCAPE % (BOLD % '37') # Black Bold/Bright
#     SUBITEM = ESCAPE % '37' # White Normal
#     ENDC = ESCAPE % '0'
# class Color(object):
# class Logger(object):
#     def _deco(cls, msg, color):
#     def blueArrow(cls, msg):
#     def head(cls, msg):
#     def debug(cls, msg):
#     def info(cls, msg):
#     def warning(cls, msg):
#     def error(cls, msg):
#     def critical(cls, msg):
#     def item(cls, msg):
#     def subitem(cls, msg):
#     def __init__(self):
#     def debug(self, msg):
#     def head(self, msg):
#     def log(self, msg):
#     def info(self, msg):
#     def warning(self, msg):
#     def error(self, msg):
#     def critical(self, msg):
#     def item(self, msg):
#     def subitem(self, msg):
#     def _stdout(self, msg):
#     def _stderr(self, msg):
# 
# Path: relo/core/config.py
# VERSION = (0, 6, 'beta')
# INSTALLER_ROOT = os.path.dirname(os.path.abspath(__file__))
# ROOT = os.environ.get("RELO_ROOT")
#     ROOT = os.path.join(os.environ["HOME"], ".relo")
# PATH_ETC = os.path.join(ROOT, 'etc')
# PATH_BIN = os.path.join(ROOT, 'bin')
# PATH_LOG = os.path.join(ROOT, 'log')
# PATH_SCRIPTS = os.path.join(ROOT, 'scripts')
# PATH_BIN_RELO = os.path.join(PATH_BIN, 'relo')
# PATH_ETC_CONFIG = os.path.join(PATH_ETC, 'config.cfg')
# PATH_HOME = os.environ.get("RELO_HOME")
#     PATH_HOME = os.path.join(os.environ["HOME"], ".relo")
# PATH_HOME_ETC = os.path.join(PATH_HOME, 'etc')
# RELO_UPDATE_URL_MASTER = conf.readConfig('core.master')
# RELO_UPDATE_URL_DEVELOP = conf.readConfig('core.develop')
# RELO_UPDATE_URL_PYPI = conf.readConfig('core.pypi')
# RELO_UPDATE_URL_CONFIG = conf.readConfig('core.config')
# RELO_MASTER_VERSION_URL = conf.readConfig('core.master-version')
# RELO_DEVELOP_VERSION_URL = conf.readConfig('core.develop-version')
# STOP_WORDS = ("the", "of", "to", "and", "a", "in", "is", "it", "you", "that")
# MIN_WORD_LENGTH = 3
# PUNCTUATION_CHARS = ".,;:!?@£$%^&*()-–<>[]{}\\|/`~'\""
# REDIS_KEY_METAPHONES = "id:%(project_id)s:metaphones"
# REDIS_KEY_METAPHONE = "id:%(project_id)s:mp:%(metaphone)s"
# REDIS_KEY_DOCUMENTS = "id:%(project_id)s:docs"
# REDIS_KEY_DOCUMENT = "id%(project_id)s:doc:%(document)s"
# REDIS_KEY_PROJECTS = "projects"
# def get_version():
# def get_long_version():
#     def __init__(self):
#     def loadConfig(self):
#     def saveConfig(self):
#     def listConfig(self, category):
#         def listCore():
#         def listLocal():
#         def listNet():
#     def readConfig(self, key):
#     def writeConfig(self, key, value):
# class ReloConfig(object):
# 
# Path: relo/core/exceptions.py
# class UpdateException(Exception):
#     """General exception during update"""
# 
# Path: relo/core/util.py
# def mkdirs(path):
# 
# Path: relo/net/download.py
# def curl(url, path):
#     command = "curl -L -# -o '%s' '%s'" % (path, url)
#     logger.debug(command)
#     subprocess.call(command, shell=True)


from relo.core.log import logger
from relo.core.config import conf, RELO_DEVELOP_VERSION_URL, RELO_MASTER_VERSION_URL, RELO_UPDATE_URL_DEVELOP, RELO_UPDATE_URL_MASTER
from relo.core.exceptions import UpdateException
from relo.core import util
from relo.net.download import curl
import tarfile
import urllib
import sys
import os
#!/usr/bin/env python
# encoding: utf-8


class AbstractUpdater(object):
    def __init__(self):
        self.localVersion = 0
        self.remoteVersion = 0
    def getLocalVersion(self):
        pass
    def getRemoteVersion(self):
        pass
    def executeUpdate(self):
        pass

class ReloUpdater(AbstractUpdater):
    """
    Updates the relo library itself.
    """
    def __init__(self, curVersion):
        self.localVersion = curVersion
        try:
            float(self.localVersion)
        except:
            logger.error('Could not determine local version.')
            sys.exit()
    def check(self):
        if self.key == 'master':
            url = RELO_MASTER_VERSION_URL
        elif self.key == 'develop':

# Path: relo/core/log.py
# LEVEL = {
#     'NORMAL': 0,
#     'INFO': 1,
#     'DEBUG': 2,
#     'CRITICAl': 0,
#     'ERROR': 0,
#     'EXCEPTION': 0,
# }
#     ESCAPE = '\033[%sm'
#     BOLD = '1;%s'
#     UNDERLINE = '4;%s'
#     BLUE_ARROW = ESCAPE % (BOLD % '34') # Blue Bold
#     DEBUG = ESCAPE % (BOLD % '35') # Magenta Bold
#     HEAD = ESCAPE % (BOLD % '1') # Bold White (Standard Color)
#     INFO = ESCAPE % '32' # Green Normal
#     WARNING = ESCAPE % '33' # Yellow Normal
#     ERROR = ESCAPE % '31' # Red Normal
#     CRITICAL = ESCAPE % (UNDERLINE % '31') # Red Underline
#     ITEM = ESCAPE % (BOLD % '37') # Black Bold/Bright
#     SUBITEM = ESCAPE % '37' # White Normal
#     ENDC = ESCAPE % '0'
# class Color(object):
# class Logger(object):
#     def _deco(cls, msg, color):
#     def blueArrow(cls, msg):
#     def head(cls, msg):
#     def debug(cls, msg):
#     def info(cls, msg):
#     def warning(cls, msg):
#     def error(cls, msg):
#     def critical(cls, msg):
#     def item(cls, msg):
#     def subitem(cls, msg):
#     def __init__(self):
#     def debug(self, msg):
#     def head(self, msg):
#     def log(self, msg):
#     def info(self, msg):
#     def warning(self, msg):
#     def error(self, msg):
#     def critical(self, msg):
#     def item(self, msg):
#     def subitem(self, msg):
#     def _stdout(self, msg):
#     def _stderr(self, msg):
# 
# Path: relo/core/config.py
# VERSION = (0, 6, 'beta')
# INSTALLER_ROOT = os.path.dirname(os.path.abspath(__file__))
# ROOT = os.environ.get("RELO_ROOT")
#     ROOT = os.path.join(os.environ["HOME"], ".relo")
# PATH_ETC = os.path.join(ROOT, 'etc')
# PATH_BIN = os.path.join(ROOT, 'bin')
# PATH_LOG = os.path.join(ROOT, 'log')
# PATH_SCRIPTS = os.path.join(ROOT, 'scripts')
# PATH_BIN_RELO = os.path.join(PATH_BIN, 'relo')
# PATH_ETC_CONFIG = os.path.join(PATH_ETC, 'config.cfg')
# PATH_HOME = os.environ.get("RELO_HOME")
#     PATH_HOME = os.path.join(os.environ["HOME"], ".relo")
# PATH_HOME_ETC = os.path.join(PATH_HOME, 'etc')
# RELO_UPDATE_URL_MASTER = conf.readConfig('core.master')
# RELO_UPDATE_URL_DEVELOP = conf.readConfig('core.develop')
# RELO_UPDATE_URL_PYPI = conf.readConfig('core.pypi')
# RELO_UPDATE_URL_CONFIG = conf.readConfig('core.config')
# RELO_MASTER_VERSION_URL = conf.readConfig('core.master-version')
# RELO_DEVELOP_VERSION_URL = conf.readConfig('core.develop-version')
# STOP_WORDS = ("the", "of", "to", "and", "a", "in", "is", "it", "you", "that")
# MIN_WORD_LENGTH = 3
# PUNCTUATION_CHARS = ".,;:!?@£$%^&*()-–<>[]{}\\|/`~'\""
# REDIS_KEY_METAPHONES = "id:%(project_id)s:metaphones"
# REDIS_KEY_METAPHONE = "id:%(project_id)s:mp:%(metaphone)s"
# REDIS_KEY_DOCUMENTS = "id:%(project_id)s:docs"
# REDIS_KEY_DOCUMENT = "id%(project_id)s:doc:%(document)s"
# REDIS_KEY_PROJECTS = "projects"
# def get_version():
# def get_long_version():
#     def __init__(self):
#     def loadConfig(self):
#     def saveConfig(self):
#     def listConfig(self, category):
#         def listCore():
#         def listLocal():
#         def listNet():
#     def readConfig(self, key):
#     def writeConfig(self, key, value):
# class ReloConfig(object):
# 
# Path: relo/core/exceptions.py
# class UpdateException(Exception):
#     """General exception during update"""
# 
# Path: relo/core/util.py
# def mkdirs(path):
# 
# Path: relo/net/download.py
# def curl(url, path):
#     command = "curl -L -# -o '%s' '%s'" % (path, url)
#     logger.debug(command)
#     subprocess.call(command, shell=True)


# Path: relo/core/update.py
from relo.core.log import logger
from relo.core.config import conf, RELO_DEVELOP_VERSION_URL, RELO_MASTER_VERSION_URL, RELO_UPDATE_URL_DEVELOP, RELO_UPDATE_URL_MASTER
from relo.core.exceptions import UpdateException
from relo.core import util
from relo.net.download import curl
import tarfile
import urllib
import sys
import os

#!/usr/bin/env python
# encoding: utf-8


class AbstractUpdater(object):
    def __init__(self):
        self.localVersion = 0
        self.remoteVersion = 0
    def getLocalVersion(self):
        pass
    def getRemoteVersion(self):
        pass
    def executeUpdate(self):
        pass

class ReloUpdater(AbstractUpdater):
    """
    Updates the relo library itself.
    """
    def __init__(self, curVersion):
        self.localVersion = curVersion
        try:
            float(self.localVersion)
        except:
            logger.error('Could not determine local version.')
            sys.exit()
    def check(self):
        if self.key == 'master':
            url = RELO_MASTER_VERSION_URL
        elif self.key == 'develop':

            url = RELO_DEVELOP_VERSION_URL