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


Python Log.printDetailln方法代码示例

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


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

示例1: work2JPG

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def work2JPG(filename, isPng = False):
    filepath = FileHelper.realpath(filename)
    filedir = FileHelper.dirname(filepath)
    name = FileHelper.basename(filepath)
  
    os.chdir(tpDir)
 
    jpgCMD = """%s -quality 90 %s %s """ % (convertBin, filepath, filepath)                 
    os.system(jpgCMD)  
    #return           
            
    tmpfilename = FileHelper.join(filedir, hashlib.md5(name.encode('utf-8')).hexdigest())
        
    isSuccess = True
    with open(tmpfilename, 'wb+') as tmpFile:
        try: 
            tmpFile.write(b'MNG')
            
            rgbname = filepath 
            FileHelper.writeWithSize(tmpFile, filepath)      

        except Exception:
            Log.printDetailln ("error00 !!!", filename, "cannot convert.")
            isSuccess = False
        finally: 
            pass
    if isSuccess:        
        FileHelper.remove(filepath)
        FileHelper.rename(tmpfilename, filepath)      
        return 5  
    else:
        return 2                
开发者ID:lyzardiar,项目名称:RETools,代码行数:34,代码来源:PackImgJPG.py

示例2: print

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
 def print(self):
     if self.empty():
         return
     Log.printDetailln("%s.print:" % (self.name))
     while not self.empty():
         task = self.get()
         ret, *args = task.param
         Log.printDetailln('\t', ret, *args)
开发者ID:lyzardiar,项目名称:RETools,代码行数:10,代码来源:ProcessWork.py

示例3: runProcess

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def runProcess(tid, taskQueue, errorQueue):
    try:
        while taskQueue.qsize() > 0:
            func, *args = taskQueue.get()
            if not func(tid, *args) :
                errorQueue.put((func, *args))
    except :
        t, v, tb = sys.exc_info()
        print(t, v)
        traceback.print_tb(tb)
        Log.printDetailln('线程异常,' + str(sys.exc_info()))
    finally :
        Log.printDetailln('线程结束, tid : ' + str(tid))
开发者ID:lyzardiar,项目名称:RETools,代码行数:15,代码来源:__init__.py

示例4: runThread

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def runThread(tid, taskQueue, errorQueue):
    try:
        while True:
            func, *args = taskQueue.get_nowait()
            if not func(tid, *args) :
                errorQueue.put((func, *args))
    except queue.Empty:
        pass
    except :
        t, v, tb = sys.exc_info()
        print(t, v)
        traceback.print_tb(tb)
        Log.printDetailln('线程异常,' + str(sys.exc_info()))
    finally :
        Log.printDetailln('线程结束, tid : ' + str(tid))
开发者ID:lyzardiar,项目名称:RETools,代码行数:17,代码来源:__init__.py

示例5: _packimg_rgb_a8

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def _packimg_rgb_a8(tid, ctx, filePath):
    noneExt = os.path.splitext(filePath)[0]
    Log.printDetailln('exe packimg_data_single : ' + filePath)
    if ctx.platformType == Constant.PLATFORM_IOS :
        # IOS鎵撳寘
        cmd = str(Config.CMD_PACKIMG_RGB_PVR).format(fileName=filePath, noneExtName=noneExt)
        retval = execCmd(cmd)
    else:
        # 瀹夊崜鎵撳寘
        cmd = str(Config.CMD_PACKIMG_RGB_ETC).format(fileName=filePath, noneExtName=noneExt)
        retval = execCmd(cmd)
    if retval == 0 and re.match(r".*\.png", filePath) :
        cmd = str(Config.CMD_PACKIMG_A8).format(fileName=filePath, noneExtName=noneExt)
        retval = execCmd(cmd)
    os.remove(filePath)
    return retval == 0
开发者ID:lyzardiar,项目名称:RETools,代码行数:18,代码来源:PackProcess.py

示例6: remove

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def remove(absFilePath, realPath = ''):
    with open(absFilePath, "rb") as tmpFile:
        content = tmpFile.read()    
    
    if len(content) < 3:
        return 0

    if content[0:3] == b'\xef\xbb\xbf':
        content = content[3:]
        with open(absFilePath, "wb+") as tmpFile:
            tmpFile.write(content)
        
        if realPath != '':
            Log.printDetailln("[Bom] removed: %s" % (realPath))
    
    return 0
    
开发者ID:lyzardiar,项目名称:RETools,代码行数:18,代码来源:RemoveUtf8Bom.py

示例7: _packimg_rgb

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def _packimg_rgb(tid, ctx, filePath):
    noneExt = os.path.splitext(filePath)[0]
    Log.printDetailln('exec packimg_data_single : ' + filePath)
    cmd = str(Config.CMD_CONVERT_COLOR_LEVEL).format(fileName=filePath)
    retval = execCmd(cmd)
    if retval != 0 :
        return False
    if ctx.platformType == Constant.PLATFORM_IOS :
        # IOS鎵撳寘
        cmd = str(Config.CMD_PACKIMG_RGB_PVR).format(fileName=filePath, noneExtName=noneExt)
        retval = execCmd(cmd)
    else:
        # 瀹夊崜鎵撳寘
        cmd = str(Config.CMD_PACKIMG_RGB_ETC).format(fileName=filePath, noneExtName=noneExt)
        retval = execCmd(cmd)
    os.remove(filePath)
    return retval == 0
开发者ID:lyzardiar,项目名称:RETools,代码行数:19,代码来源:PackProcess.py

示例8: task_XXTeaEncode2

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def task_XXTeaEncode2(tid, taskTotSize, absFilePath, relativepath, taskSize):   
    ret = PackXXTea.encode(absFilePath)
    
    Log.printDetailln("加密[%d/%d]: %s" % (taskSize, taskTotSize, relativepath)) 

    return ret == 0
开发者ID:lyzardiar,项目名称:RETools,代码行数:8,代码来源:PackRes.py

示例9: task_compileLuaJit2

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def task_compileLuaJit2(tid, taskTotSize, absFilePath, relativepath, luaPacker, taskSize):
    ret = luaPacker.compile(absFilePath, relativepath)

    Log.printDetailln("编译[%d/%d]: %s" % (taskSize, taskTotSize, relativepath))

    return ret == 0
开发者ID:lyzardiar,项目名称:RETools,代码行数:8,代码来源:PackRes.py

示例10: _removebom

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def _removebom(tid, ctx, filePath):
    Log.printDetailln('UTF-8 remove bom : ' + filePath)
    cmd = str(Config.CMD_REMOVE_BOM).format(fileName=filePath)
    retval = execCmd(cmd)
    return retval == 0
开发者ID:lyzardiar,项目名称:RETools,代码行数:7,代码来源:PackProcess.py

示例11: runable

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
 def runable(tid, *args):
     Log.printDetailln('线程:' + str(tid), *args)
     return True
开发者ID:lyzardiar,项目名称:RETools,代码行数:5,代码来源:ThreadWork.py

示例12: work_file_PVR

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]

#.........这里部分代码省略.........
    if width & (width-1) != 0 or width != height:
        return 2
        
    
    rgbCMD = """ %s -f PVRTC1_4_RGB %s -q pvrtcbest -i %s -o %s """ % (pvrTexToolBin, preCMD, filepath, filepath.replace(".png", ".pvr"))
    alphaCMD = """%s %s -alpha extract %s """ % (convertBin, filepath, filepath.replace(".png", ".alpha.jpg"))
    alphaJPGCMD = """ %s -f PVRTC1_4_RGB -q pvrtcbest -i %s -o %s """ % (pvrTexToolBin, filepath.replace(".png", ".alpha.jpg"), filepath.replace(".png", ".alpha.pvr"))
    
    if isTC4:
        rgbCMD = """ %s -f PVRTC1_4 %s -q pvrtcbest -i %s -o %s """ % (pvrTexToolBin, preCMD, filepath, filepath.replace(".png", ".pvr"))
    
    try:   
        FileHelper.remove(filepath.replace(".png", ".pkm"))
        FileHelper.remove(filepath.replace(".png", "_alpha.pkm"))
    
        os.system(rgbCMD) 
        
        if not isTC4:
            os.system(alphaCMD) 
        
        if not isAlphaJPG and not isTC4:
            os.system(alphaJPGCMD) 
        
        if not FileHelper.exists(filepath.replace(".png", ".pvr")):
            return 2
            
        os.rename(filepath.replace(".png", ".pvr"), filepath.replace(".png", ".pkm"))   
        
        if not isTC4:
            if not isAlphaJPG:
                os.rename(filepath.replace(".png", ".alpha.jpg"), filepath.replace(".png", "_alpha.pkm")) 
            else:
                os.rename(filepath.replace(".png", ".alpha.pvr"), filepath.replace(".png", "_alpha.pkm")) 

            FileHelper.remove(filepath.replace(".png", ".alpha.jpg"))
            FileHelper.remove(filepath.replace(".png", ".alpha.pvr"))  
        
    except Exception:
        Log.printError()
        return 2
    finally:
        pass
    
    tmpfilename = filepath.replace(".png", ".tmp")
    FileHelper.remove(tmpfilename)
    
    isSuccess = True
    with open(tmpfilename, 'wb+') as tmpFile:
        try: 
            tmpFile.write(b'MNG')
            
            rgbname = filepath.replace(".png", ".pkm") 
            
            statinfo = os.stat(rgbname)
            fileSize = statinfo.st_size
            
            tmpFile.write(pack("i", fileSize))
            rgbfile = open(rgbname, "rb")
            tmpFile.write(rgbfile.read())
            rgbfile.close()
            
            alphaname = filepath.replace(".png", "_alpha.pkm") 
            if not isTC4:
                statinfo = os.stat(alphaname)
                fileSize = statinfo.st_size
                
                tmpFile.write(pack("i", fileSize))
                alphafile = open(alphaname, "rb")
                tmpFile.write(alphafile.read())
                alphafile.close()
            
            # if preAlpha:
                # tmpFile.write('p')
            # else:
                # tmpFile.write('P')
            
            if not isSaveTransFile:
                FileHelper.remove(rgbname)
                FileHelper.remove(alphaname)
                
        except Exception:
            t, v, tb = sys.exc_info()
            Log.printDetailln(t, v)
            isSuccess = False
            pass
        finally: 
            pass
            
            
    if isSuccess:  
        if isUseGzip:
            gzip_cmd = gzipBin + tmpfilename + " -n -f -9"
            os.system(gzip_cmd)
            FileHelper.remove(tmpfilename.replace(".tmp", ".png"))
            FileHelper.rename(tmpfilename + ".gz", tmpfilename.replace(".tmp", ".png"))
            return 3
        else: 
            FileHelper.remove(tmpfilename.replace(".tmp", ".png"))
            FileHelper.rename(tmpfilename, tmpfilename.replace(".tmp", ".png"))
            return 5
开发者ID:lyzardiar,项目名称:RETools,代码行数:104,代码来源:PackImg2Mng_PVR.py

示例13: work_file_ETC

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def work_file_ETC(filename, isAlphaJPG = False, isFast = False):
    filepath = FileHelper.realpath(filename)
    filedir = FileHelper.dirname(filepath)

    sys.stdout.flush() 

    #preAlpha = needPreAplha(filedir)
    preAlpha = False
    preCMD = " -p "
    if not preAlpha:
        preCMD = ""
            
    os.chdir(toolsPath)
    
    isPng = True
    if filename.find(".png") != -1:
        isPng = True
    elif filename.find(".jpg") != -1:
        isPng = False
    else:
        return 2
    
    if isFast:
        quality = 'etcfast'
    else:
        quality = 'etcslow'

    rgbCMD = """ %s -f ETC1 %s -q %s -i %s -o %s """ % (pvrTexToolBin, preCMD, quality, filepath, filepath.replace(".png", ".pvr"))
    alphaCMD = """%s %s -alpha extract %s """ % (convertBin, filepath, filepath.replace(".png", ".alpha.jpg"))
    alphaJPGCMD = """ %s -f ETC1 -q %s -i %s -o %s """ % (pvrTexToolBin, quality, filepath.replace(".png", ".alpha.jpg"), filepath.replace(".png", ".alpha.pvr"))
    
    try:   
        if isPng:
            FileHelper.remove(filepath.replace(".png", ".pkm"))
            FileHelper.remove(filepath.replace(".png", "_alpha.pkm"))
        
            os.system(rgbCMD) 
            os.system(alphaCMD) 
            
            if not isAlphaJPG:
                os.system(alphaJPGCMD) 

            FileHelper.rename(filepath.replace(".png", ".pvr"), filepath.replace(".png", ".pkm"))   
            
            if isAlphaJPG:
                FileHelper.rename(filepath.replace(".png", ".alpha.jpg"), filepath.replace(".png", "_alpha.pkm")) 
            else:
                FileHelper.rename(filepath.replace(".png", ".alpha.pvr"), filepath.replace(".png", "_alpha.pkm")) 

            FileHelper.remove(filepath.replace(".png", ".alpha.jpg"))
            FileHelper.remove(filepath.replace(".png", ".alpha.pvr"))            
        else:    
            FileHelper.remove(filepath.replace(".jpg", ".pkm"))         
            rgbCMD = """ %s -f ETC1 -p -q %s -i %s -o %s """ % (pvrTexToolBin, quality, filepath, filepath.replace(".jpg", ".pvr"))
            os.system(rgbCMD)
            FileHelper.rename(filepath.replace(".jpg", ".pvr"), filepath.replace(".jpg", ".pkm"))  
        
    except Exception:
        t, v, tb = sys.exc_info()
        Log.printDetailln(t, v)
        pass
    finally:
        pass
  
    if isPng:   
        tmpfilename = filepath.replace(".png", ".tmp")
        FileHelper.remove(tmpfilename)
        
        isSuccess = True
        with open(tmpfilename, 'wb+') as tmpFile:
            try: 
                tmpFile.write(b'MNG')
                
                rgbname = filepath.replace(".png", ".pkm") 
                alphaname = filepath.replace(".png", "_alpha.pkm") 
                
                FileHelper.writeWithSize(tmpFile, rgbname)
                FileHelper.writeWithSize(tmpFile, alphaname)
                
                # if preAlpha:
                    # tmpFile.write('p')
                # else:
                    # tmpFile.write('P')
                
                if not isSaveTransFile:
                    FileHelper.remove(rgbname)
                    FileHelper.remove(alphaname)
                    
            except Exception:
                Log.printError()
                isSuccess = False
                pass
            finally: 
                pass
                
              
        if isSuccess:  
            if isUseGzip:
                gzip_cmd = gzipBin + tmpfilename + " -n -f -9"
                os.system(gzip_cmd)
#.........这里部分代码省略.........
开发者ID:lyzardiar,项目名称:RETools,代码行数:103,代码来源:PackImg2Mng_ETC.py

示例14: process

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
def process(ctx=Context()):
    try:
        Log.printInfoln('==============开始打包==============')
        if not os.path.isdir(ctx.resPath) :
            Log.printInfoln('源目录不存在, resPath : ' + ctx.resPath)
            return;
        
        if os.path.exists(ctx.getOutputPath()) :
            shutil.rmtree(ctx.getOutputPath(), True)
            Log.printDetailln('删除目录 : ' + ctx.getOutputPath())
        
        if os.path.exists(ctx.getTempPath()) :
            shutil.rmtree(ctx.getTempPath(), True)
            Log.printDetailln('删除目录 : ' + ctx.getTempPath())
            
        # 不管新包还是旧包,release数据备份都不已md5命名,只有export里用md5命名
        if os.path.exists(ctx.getExportPath()) :
            shutil.rmtree(ctx.getExportPath(), True)
            Log.printDetailln('删除目录 : ' + ctx.getExportPath())
            
        Log.printInfo('【1/4】<1/1> 扫描并计算MD5...')
        ctx.curScanner = FileScanner()
        ctx.curScanner.initFromRootPath(ctx.resPath)
        Log.printInfoln('完成')
        
        os.makedirs(ctx.getDataFolder(), exist_ok=True)
        
        # 路径比较的时候加入root前缀,然后判断是不是同一个文件,不需要直接判断相对路径
        ctx.folderPackList = PackHelper.getFolderPackList(ctx.resPath)
        
        # 从output文件件到release文件夹的备份
        if ctx.isNew or ctx.lastReleasePath == '':
            Log.printInfo('复制完整文件夹, from : ' + ctx.resPath + ", to : " + ctx.getOutputResPath() + ' ...')
            shutil.copytree(ctx.resPath, ctx.getOutputResPath())
            Log.printInfoln('完成')
            if not PackProcess.process(ctx) :
                return
            Log.printInfo('复制完整文件夹, from : ' + ctx.getOutputResPath() + ", to : " + ctx.getReleaseOutputPath() + ' ...')
            shutil.copytree(ctx.getOutputPath(), ctx.getReleaseOutputPath())
            Log.printInfoln('完成')
        else :
            removeSet = set()
            if not compareAndPack(ctx, removeSet) :
                return
            Log.printInfo('复制最近release版本 to : ' + ctx.getReleaseOutputPath() + ' ...')
            shutil.copytree(ctx.lastReleasePath, ctx.getReleaseOutputPath())
            Log.printInfoln('完成')
            
            Log.printInfo('删除失效文件(' + str(len(removeSet)) + '个)...')
            # 删除removeSet中的文件和文件夹
            for removeRelPath in removeSet :
                removeAbsPath = os.path.join(ctx.getReleaseOutputPath() + os.sep + 'res', removeRelPath)
                if not os.path.exists(removeAbsPath) :
                    continue
                if os.path.isfile(removeAbsPath) :
                    os.remove(removeAbsPath)
                elif os.path.isdir(removeAbsPath) :
                    shutil.rmtree(removeAbsPath)
            
            dir_util.copy_tree(ctx.getOutputPath(), ctx.getReleaseOutputPath())
            Log.printInfoln('完成')
            
        # 生成xml-before
        Log.printInfo('生成Xml-before...')
        beforeXml = ctx.getReleaseOutputPath() + os.sep + Constant.BEFORE_XML
        XmlMgr.write(beforeXml, ctx.curScanner.fileList)
        Log.printInfoln('完成')
        
        # 生成xml-after
        Log.printInfo('生成Xml-after...')
        afterScanner = FileScanner()
        afterScanner.initFromRootPath(ctx.getReleaseOutputPath() + os.sep + 'res')
        afterXml = ctx.getReleaseOutputPath() + os.sep + Constant.AFTER_XML
        XmlMgr.write(afterXml, afterScanner.fileList)
        Log.printInfoln('完成')
        
        os.makedirs(ctx.getExportPath(), exist_ok=True)
        
        Log.printInfo('导出变更文件到export目录...')
        if ctx.isFull :
            for r, d, fileList in os.walk(ctx.getReleaseOutputPath() + os.sep + 'res') :
                for file in fileList :
                    srcAbsPath = os.path.join(r, file)
                    relativePath = os.path.relpath(srcAbsPath, ctx.getReleaseOutputPath())
                    targetPath = os.path.join(ctx.getExportPath(), relativePath + '_' + PackHelper.calcMd5(srcAbsPath))
                    os.makedirs(os.path.dirname(targetPath), exist_ok=True)
                    shutil.copyfile(srcAbsPath, targetPath)
        else :
            for r, d, fileList in os.walk(ctx.getOutputPath()) :
                for file in fileList :
                    srcAbsPath = os.path.join(r, file)
                    relativePath = os.path.relpath(srcAbsPath, ctx.getOutputPath())
                    targetPath = os.path.join(ctx.getExportPath(), relativePath + '_' + PackHelper.calcMd5(srcAbsPath))
                    os.makedirs(os.path.dirname(targetPath), exist_ok=True)
                    shutil.copyfile(srcAbsPath, targetPath)
        xmlMd5 = PackHelper.calcMd5(afterXml)
        
        # 生成文件列表
        shutil.copyfile(afterXml, ctx.getExportPath() + os.sep + xmlMd5)
        
#.........这里部分代码省略.........
开发者ID:lyzardiar,项目名称:RETools,代码行数:103,代码来源:ProcessMgr.py

示例15: start

# 需要导入模块: from util import Log [as 别名]
# 或者: from util.Log import printDetailln [as 别名]
 def start(self):
     if self.isOK:
         self.process()
     else:
         Log.printDetailln("路径错误, 请重试...")
开发者ID:lyzardiar,项目名称:RETools,代码行数:7,代码来源:PackRes.py


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