# 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)


from command import AndroidFile
from formatters.log import Log
import tempfile
import os
import imagetype
import shutil
import string
import sys
class pull(object):
    '''
    classdocs
    '''
    mPull = None
    PROC_PARTITIONS = "/proc/partitions"
    BLOCK_DIR = "/dev/block"
    
    MIN_SIZE = 4096
    MAX_SIZE = 20480
    
    def __init__(self):
        '''
        Constructor
        '''
        self.mWorkdir = tempfile.mkdtemp()
        self.mImgDict = {}
        self.mOutDir = os.getcwd()
    
    @staticmethod
    def getInstance():
        if pull.mPull is None:
            pull.mPull = pull()
        return pull.mPull
    
    def getAdPartitions(self, minsize, maxsize):
        adPt = AndroidFile(pull.PROC_PARTITIONS)
        assert adPt.exist(), "File %s is not exist in phone!" %(pull.PROC_PARTITIONS)
        
        outAdDict = {}

# 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)


# Path: bootimgpack/pull/pull.py
from command import AndroidFile
from formatters.log import Log
import tempfile
import os
import imagetype
import shutil
import string
import sys

class pull(object):
    '''
    classdocs
    '''
    mPull = None
    PROC_PARTITIONS = "/proc/partitions"
    BLOCK_DIR = "/dev/block"
    
    MIN_SIZE = 4096
    MAX_SIZE = 20480
    
    def __init__(self):
        '''
        Constructor
        '''
        self.mWorkdir = tempfile.mkdtemp()
        self.mImgDict = {}
        self.mOutDir = os.getcwd()
    
    @staticmethod
    def getInstance():
        if pull.mPull is None:
            pull.mPull = pull()
        return pull.mPull
    
    def getAdPartitions(self, minsize, maxsize):
        adPt = AndroidFile(pull.PROC_PARTITIONS)
        assert adPt.exist(), "File %s is not exist in phone!" %(pull.PROC_PARTITIONS)
        
        outAdDict = {}

        Log.i(LOG_TAG, "Try to create block of partitions ...")