# 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
                  "framework2.jar",
                  "mediatek-framework.jar")

PARTITIONS     = ("secondary_framework.jar.out", "secondary-framework.jar.out",
                  "framework-ext.jar.out", "framework_ext.jar.out",
                  "framework2.jar.out")


class Options(object):

    def __init__(self):
        self.prepare = True                    # Whether to trigger prepare action
        self.patchXml = Config.PATCHALL_XML    # The patch XML, default to be PATCHALL_XML
        self.baseName = "base"                 # Short base device name, default to be 'base'
        self.commit1  = None                   # The 7 bits lower commit ID
        self.commit2  = None                   # The 7 bits upper commit ID
        self.olderRoot = None                  # The older and newer is a pair of directory for comparing
        self.newerRoot = None                  # Default to be AOSP and BOSP

    @staticmethod
    def usage():
        print __doc__
        sys.exit()

    def handle(self, argv):
        if len(argv) == 1: Options.usage()

        try:
            (opts, args) = getopt.getopt(argv[1:], "hlputb:c1:c2:", \
                            [ "help", "loosely", "patchall", "upgrade", "porting", "base=", "commit1=", "commit2=" ])

# 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

                  "framework2.jar",
                  "mediatek-framework.jar")

PARTITIONS     = ("secondary_framework.jar.out", "secondary-framework.jar.out",
                  "framework-ext.jar.out", "framework_ext.jar.out",
                  "framework2.jar.out")


class Options(object):

    def __init__(self):
        self.prepare = True                    # Whether to trigger prepare action
        self.patchXml = Config.PATCHALL_XML    # The patch XML, default to be PATCHALL_XML
        self.baseName = "base"                 # Short base device name, default to be 'base'
        self.commit1  = None                   # The 7 bits lower commit ID
        self.commit2  = None                   # The 7 bits upper commit ID
        self.olderRoot = None                  # The older and newer is a pair of directory for comparing
        self.newerRoot = None                  # Default to be AOSP and BOSP

    @staticmethod
    def usage():
        print __doc__
        sys.exit()

    def handle(self, argv):
        if len(argv) == 1: Options.usage()

        try:
            (opts, args) = getopt.getopt(argv[1:], "hlputb:c1:c2:", \
                            [ "help", "loosely", "patchall", "upgrade", "porting", "base=", "commit1=", "commit2=" ])

            Log.d(TAG, "Program args = %s" %args)