当前位置: 首页>>代码示例>>Python>>正文


Python Log.i方法代码示例

本文整理汇总了Python中common.Log.i方法的典型用法代码示例。如果您正苦于以下问题:Python Log.i方法的具体用法?Python Log.i怎么用?Python Log.i使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.Log的用法示例。


在下文中一共展示了Log.i方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: repackageFrw

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def repackageFrw(frwDir, bootClassFolder):
        """ Repackage the classes.dex into jar of frwDir.
        """

        if OPTIONS.formatFrw == False : return

        # Keep the old directory, we will change back after some operations.
        oldDir = os.path.abspath(os.curdir)

        # Some dexFiles are parted, such as framework-classes2.dex
        regex = re.compile("(.*)-(classes\d?).dex")

        Log.i(TAG, "Repackage JARs of %s" %(frwDir))
        os.chdir(frwDir)
        for dexFile in os.listdir(bootClassFolder):
            if dexFile.endswith(".dex"):
                jarFile = dexFile[0:-4] + ".jar"
                dexName = "classes.dex"

                if not os.path.exists(jarFile):
                    # Match out the jar file with regex
                    matcher = regex.match(dexFile)
                    if matcher != None:
                        jarFile = matcher.group(1) + ".jar"
                        dexName = matcher.group(2) + ".dex"
 
                Log.d(TAG, "Repackage %s" %(jarFile))
                # Put the dex and framework's jar in the same folder, and jar into the jarFile
                shutil.move(os.path.join(bootClassFolder, dexFile), os.path.join(frwDir, dexName))
                Utils.runWithOutput(["jar", "uf", jarFile, dexName])

                if os.path.exists(dexName):
                    os.remove(dexName)

        os.chdir(oldDir)
开发者ID:Starstok,项目名称:systemimgpack,代码行数:37,代码来源:deoat.py

示例2: deoat

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def deoat(self):
        """ De-oat the OTA package.
        """

        if self.mBootOAT == None:
            Log.i(TAG, "deoat(): boot.oat not found in %s, nothing need deoat" % self.mRoot)
            return self

        if os.path.exists(self.mBootClassFolder):
            Log.d(TAG, "Delete the already exists %s" %self.mBootClassFolder)
            shutil.rmtree(self.mBootClassFolder)

        # Phase 1: de-oat boot.oat
        OatZip.deoatBootOAT(self.mBootOAT)

        # Phase 2: de-oat all the other oat files, of which suffix is odex.
        # [Android 5.0]: All the oat jars are located in the same folder with boot.oat
        OatZip.deoatFrw(self.mBootOATDir)

        # Phase 3: de-oat app
        OatZip.deoatApp(self.mFrwDir, self.mBootClassFolder)
        OatZip.deoatApp(self.mAppDir, self.mBootClassFolder)
        OatZip.deoatApp(self.mPrivAppDir, self.mBootClassFolder)

        return self
开发者ID:Starstok,项目名称:systemimgpack,代码行数:27,代码来源:deoat.py

示例3: deoatApp

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def deoatApp(oatApkDir, bootClassFolder):
        """ De-oat app
        """

        if OPTIONS.formatApp == False: return

        Log.i(TAG, "De-oat files of oat-format in %s, with BOOTCLASSFOLDER=%s" %(oatApkDir, bootClassFolder))
        for (dirpath, dirnames, filenames) in os.walk(oatApkDir):

            dirnames = dirnames # no use, to avoid warning

            for filename in filenames:
                if filename.endswith(".odex"):
                    # no need to de-oat if original apk does not exist
                    apkFile = filename[0:-5] + ".apk"
                    apkPath = os.path.dirname(dirpath)
                    if not os.path.exists(os.path.join(apkPath, apkFile)):
                        continue

                    oatApk = os.path.join(dirpath, filename)
                    deoatApk = oatApk[0:-5] + ".dex"
                    if os.path.exists(deoatApk):
                        Log.d(TAG, "Delete the already exists %s" % deoatApk)
                        os.remove(deoatApk)

                    Utils.runWithOutput([OatZip.OAT2DEX, oatApk, bootClassFolder])
开发者ID:Starstok,项目名称:systemimgpack,代码行数:28,代码来源:deoat.py

示例4: deoatFrw

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def deoatFrw(oatJarDir):
        """ De-oat framework
        """

        if not OPTIONS.formatFrw: return

        Log.i(TAG, "De-oat files of oat-format in %s" % oatJarDir)
        for item in os.listdir(oatJarDir):
            if item.endswith(".odex"):
                # COMMANDS: oat2dex boot <jar-of-oat-format>
                oatJar = os.path.join(oatJarDir, item)
                Utils.runWithOutput([OatZip.OAT2DEX, "boot", oatJar])
开发者ID:Starstok,项目名称:systemimgpack,代码行数:14,代码来源:deoat.py

示例5: deodexOneFile

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def deodexOneFile(odexFile, deodexFile):
        """ De-odex one file.
        """

        if not odexFile.endswith(".odex"): return

        temp = tempfile.mktemp()

        # Phase 1: Baksmali the odex file
        cmd = ["baksmali", "-x", odexFile, "-d", "framework", "-I", "-o", os.path.join(temp, "out")]
        if OPTIONS.apiLevel  != None: cmd.extend(["-a", OPTIONS.apiLevel])
        if OPTIONS.classpath != None: cmd.extend(["-c", OPTIONS.classpath])

        cmd = " ".join(cmd)
        Log.d(TAG, cmd)
        Log.d(TAG, commands.getoutput(cmd))

        # Phase 2: Smali the files into dex
        oldDir = os.path.abspath(os.curdir)
        os.chdir(temp)

        cmd = "smali out/ -o classes.dex"
        Log.d(TAG, commands.getoutput(cmd))
        #Utils.runWithOutput(["smali", "out", "-o", "classes.dex"])

        # Phase 3: Package
        if os.path.exists(deodexFile):
            #cmd = ["jar", "uf", deodexFile, "classes.dex"]
            cmd = "jar uf %s classes.dex" % deodexFile
        else:
            #cmd = ["jar", "cf", deodexFile, "classes.dex"]
            cmd = "jar cf %s classes.dex" % deodexFile

        Log.d(TAG, commands.getoutput(cmd))
        #Utils.runWithOutput(cmd)
        os.chdir(oldDir)

        if os.path.exists(odexFile): os.remove(odexFile)

        Log.i(TAG, "Delete %s" %temp)
        shutil.rmtree(temp)

        # Phase 4: zipalign
        #Utils.runWithOutput(["zipalign", "4", deodexFile, deodexFile+".aligned"])
        #Utils.runWithOutput(["mv", deodexFile+".aligned", deodexFile])

        cmd = "zipalign 4 %s %s" %(deodexFile, deodexFile+".aligned")
        Log.d(TAG, commands.getoutput(cmd))

        cmd = "mv %s %s" %(deodexFile+".aligned", deodexFile)
        Log.d(TAG, cmd)
开发者ID:Starstok,项目名称:systemimgpack,代码行数:53,代码来源:deodex.py

示例6: rebuild

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def rebuild(self):
        """ Rebuild the deoated zip
        """

        if self.mBootOAT == None:
            Log.i(TAG, "rebuild(): boot.oat not found, nothing need rebuild")
            return

        OatZip.repackageFrw(self.mFrwDir, self.mBootClassFolder)
        OatZip.repackageApp(self.mFrwDir)
        OatZip.repackageApp(self.mAppDir)
        OatZip.repackageApp(self.mPrivAppDir)

        # Remove the whole OAT directory
        if os.path.exists(self.mBootOATDir):
            shutil.rmtree(self.mBootOATDir)
开发者ID:Starstok,项目名称:systemimgpack,代码行数:18,代码来源:deoat.py

示例7: unzip

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def unzip(self):
        # Already unziped
        if self.mRoot is not None: return

        self.mRoot = tempfile.mkdtemp()

        Log.i(TAG, "unzip %s to %s" % (self.mInZip, self.mRoot))
        cmd = "unzip -q -o %s -d %s" %(self.mInZip, self.mRoot)
        Log.d(TAG, commands.getoutput(cmd))

        self.dedatIfNeeded()

        # Format path
        if os.path.exists(os.path.join(self.mRoot, "SYSTEM")):
            shutil.move(os.path.join(self.mRoot, "SYSTEM"), os.path.join(self.mRoot, "system"))

        return self
开发者ID:duanqz,项目名称:systemimgpack,代码行数:19,代码来源:zipformatter.py

示例8: create

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def create(options):
        """ Create a zip formatter for the incoming zip file
        """

        zipModel = ZipModel(options.inZip, options.outZip)
        zipType = zipModel.getZipType()

        Log.i(TAG, "process(): Creating %s ZipFormatter..." %zipType)
        if zipType == ZipModel.ART:
            deoat.OPTIONS = options
            return Deoat(zipModel)

        elif zipType == ZipModel.DVM:
            deodex.OPTIONS = options
            return Deodex(zipModel)

        else:
            raise Exception("Unknown OTA package zip. Is it an ART or DALVIKVM package?")
开发者ID:duanqz,项目名称:systemimgpack,代码行数:20,代码来源:zipformatter.py

示例9: deodexFrw

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def deodexFrw(odexJarDir):
        """ De-odex framework
        """

        if OPTIONS.formatFrw == False: return

        coreOdex = os.path.join(odexJarDir, "core.odex")
        if os.path.exists(coreOdex):
            Log.i(TAG, "De-odex core.odex")
            deodexFile = os.path.join(odexJarDir, "core.jar")
            OdexZip.deodexOneFile(coreOdex, deodexFile)

        Log.i(TAG, "De-odex files of odex-format in %s" % odexJarDir)
        for item in os.listdir(odexJarDir):
            if item.endswith(".odex"):
                odexJar = os.path.join(odexJarDir, item)
                deodexJar = odexJar[0:-4] + ".jar"
                OdexZip.deodexOneFile(odexJar, deodexJar)
                break
开发者ID:Starstok,项目名称:systemimgpack,代码行数:21,代码来源:deodex.py

示例10: repackageApp

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def repackageApp(appDir):
        """ Repackage the classes.dex into apk of appDir
        """

        if OPTIONS.formatApp == False: return

        # Keep the old directory, we will change back after some operations.
        oldDir = os.path.abspath(os.curdir)

        Log.i(TAG, "Repackage APKs of %s" %(appDir))
        for (dirpath, dirnames, filenames) in os.walk(appDir):

            dirnames = dirnames # no use, to avoid warning

            for dexFile in filenames:
                if dexFile.endswith(".dex"):
                    apkFile = dexFile[0:-4] + ".apk"
                    apkPath  = os.path.dirname(dirpath)

                    if not os.path.exists(os.path.join(apkPath, apkFile)):
                        Log.d(TAG, "No apk matched with %s, Ignore" %dexFile)
                        continue

                    dexName = "classes.dex"

                    Log.d(TAG, "Repackage %s" %(apkPath))
                    # Put the dex and apk in the same folder, and jar into the apk
                    shutil.move(os.path.join(dirpath, dexFile), os.path.join(apkPath, dexName))

                    os.chdir(apkPath)
                    Utils.runWithOutput(["jar", "uf", apkFile, dexName])
                    if os.path.exists(dexName):
                        os.remove(dexName)

                    shutil.rmtree(dirpath)


        os.chdir(oldDir)
开发者ID:Starstok,项目名称:systemimgpack,代码行数:40,代码来源:deoat.py

示例11: zip

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def zip(self):
        if self.mRoot is None: return

        origDir = os.path.abspath(os.curdir)

        Log.i(TAG, "zip from %s to %s" % (self.mRoot, self.mOutZip))

        os.chdir(self.mRoot)
        cmd = "zip -r -y -q tmp *; mv tmp.zip %s" % self.mOutZip
        Log.d(TAG, commands.getoutput(cmd))
        os.chdir(origDir)

        Log.i(TAG, "Deleting %s" % self.mRoot)
        shutil.rmtree(self.mRoot)

        Log.i(TAG, "===> %s" % self.mOutZip)
开发者ID:duanqz,项目名称:systemimgpack,代码行数:18,代码来源:zipformatter.py

示例12: deoatBootOAT

# 需要导入模块: from common import Log [as 别名]
# 或者: from common.Log import i [as 别名]
    def deoatBootOAT(bootOAT):
        """ De-oat boot.oat
        """

        Log.i(TAG, "De-oat %s" % bootOAT)
        Utils.runWithOutput([OatZip.OAT2DEX, "boot", bootOAT])
开发者ID:Starstok,项目名称:systemimgpack,代码行数:8,代码来源:deoat.py


注:本文中的common.Log.i方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。