# Path: formatters/log.py
# class Log:
# 
#     DEBUG = False
# 
#     @staticmethod
#     def d(tag, message):
#         if Log.DEBUG: print "D/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def i(tag, message):
#         print "I/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def w(tag, message):
#         print "W/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def e(tag, message):
#         print "E/%s: %s" %(tag, message)
# 
# class Paint:
# 
#     @staticmethod
#     def bold(s):
#         return "%s[01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def red(s):
#         return "%s[33;31m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def green(s):
#         return "%s[31;32m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def blue(s):
#         return "%s[34;01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def yellow(s):
#         return "%s[31;33m%s%s[0m" % (chr(27), s.rstrip(), chr(27))


import shutil
import subprocess
import os, sys
import tempfile
import commands
import getopt
from config import Config
from changelist import ChangeList
from formatters.log import Log, Paint
        content = handle.read().strip("\n")
        handle.close()

        return content

    @staticmethod
    def writeCommit(filepath, commit):
        handle = open(filepath, "w")
        handle.write(commit)
        handle.close()


class Utils:
    """ Utilities
    """

    @staticmethod
    def decode(baiduZip, out):
        """ Decode FRAMEWORK_JARS in baidu.zip into out directory.
        """

        Log.i(TAG, "Generating %s from %s" %(out, baiduZip))

        # Phase 1: deodex
        deodexZip = Utils.deodex(baiduZip)
        if deodexZip == None:
            return

        # Phase 2: decode framework jars
        temp = tempfile.mkdtemp()

# Path: formatters/log.py
# class Log:
# 
#     DEBUG = False
# 
#     @staticmethod
#     def d(tag, message):
#         if Log.DEBUG: print "D/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def i(tag, message):
#         print "I/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def w(tag, message):
#         print "W/%s: %s" %(tag, message)
# 
#     @staticmethod
#     def e(tag, message):
#         print "E/%s: %s" %(tag, message)
# 
# class Paint:
# 
#     @staticmethod
#     def bold(s):
#         return "%s[01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def red(s):
#         return "%s[33;31m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def green(s):
#         return "%s[31;32m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def blue(s):
#         return "%s[34;01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def yellow(s):
#         return "%s[31;33m%s%s[0m" % (chr(27), s.rstrip(), chr(27))


# Path: autopatch/precondition.py
import shutil
import subprocess
import os, sys
import tempfile
import commands
import getopt
from config import Config
from changelist import ChangeList
from formatters.log import Log, Paint

        content = handle.read().strip("\n")
        handle.close()

        return content

    @staticmethod
    def writeCommit(filepath, commit):
        handle = open(filepath, "w")
        handle.write(commit)
        handle.close()


class Utils:
    """ Utilities
    """

    @staticmethod
    def decode(baiduZip, out):
        """ Decode FRAMEWORK_JARS in baidu.zip into out directory.
        """

        Log.i(TAG, "Generating %s from %s" %(out, baiduZip))

        # Phase 1: deodex
        deodexZip = Utils.deodex(baiduZip)
        if deodexZip == None:
            return

        # Phase 2: decode framework jars
        temp = tempfile.mkdtemp()

        Log.i(TAG, "unzip %s to %s" % (deodexZip, temp))