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


Python FileUtils.walkPath方法代码示例

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


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

示例1: compileAllOnPath

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import walkPath [as 别名]
    def compileAllOnPath(path, rootPath=None, recursive=False, debug=False, trace=False, force=False, compress=False):

        CoffeescriptBuilder._results = ""
        CoffeescriptBuilder._missing = {}
        if recursive:
            print("RECURSIVE COMPILE AT: " + path)

            def walker(paths, dirName, names):
                out = CoffeescriptBuilder._compileAllInDirectory(
                    os.path.join(paths[0], dirName), paths[1], debug=debug, trace=trace, force=force, compress=compress
                )
                CoffeescriptBuilder._results += out["res"]
                for n, v in DictUtils.iter(out["missing"]):
                    if n in CoffeescriptBuilder._missing:
                        continue
                    CoffeescriptBuilder._missing[n] = v

            FileUtils.walkPath(path, walker, [path, rootPath])
            print("\n\nCOMPILATION RESULTS:" + CoffeescriptBuilder._results)

            if CoffeescriptBuilder._missing:
                print("\n\nMISSING IMPORTS:" + "\n\n")
                for n, v in DictUtils.iter(CoffeescriptBuilder._missing):
                    print(v["class"] + " [LINE: #" + str(v["line"]) + " | " + v["package"] + "]")
        else:
            print("COMPILING DIRECTORY: " + path)
            CoffeescriptBuilder._compileAllInDirectory(
                path, rootPath, debug=debug, trace=trace, force=force, compress=compress
            )
开发者ID:sernst,项目名称:PyAid,代码行数:31,代码来源:CoffeescriptBuilder.py

示例2: compressPath

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import walkPath [as 别名]
    def compressPath(self, rootPath):
        # First compile any coffee scripts to js files
        if self._compileCoffee:
            try:
                from pyaid.web.coffeescript.CoffeescriptBuilder import CoffeescriptBuilder
                CoffeescriptBuilder.compileAllOnPath(rootPath, rootPath, True)
                self._log.write('Coffee scripts compiled.')
            except Exception as err:
                self._log.writeError('Failed to compile coffeescript files.', err)
                return False

        FileUtils.walkPath(rootPath, self._compressInFolder, None)
        self._log.write('Compression operation complete.')
        return True
开发者ID:sernst,项目名称:PyAid,代码行数:16,代码来源:IncludeCompressor.py

示例3: getAppDatabaseItems

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import walkPath [as 别名]
    def getAppDatabaseItems(cls, appName, localResourcesPath =None):
        if not localResourcesPath:
            localResourcesPath = PyGlassEnvironment.getRootLocalResourcePath(isDir=True)

        databaseRoot = FileUtils.makeFolderPath(localResourcesPath, 'apps', appName, 'data')
        if not os.path.exists(databaseRoot):
            return []

        results = []
        FileUtils.walkPath(databaseRoot, cls._findAppDatabases, {
            'root':databaseRoot,
            'results':results,
            'appName':appName })

        return results
开发者ID:sernst,项目名称:PyGlass,代码行数:17,代码来源:AlembicUtils.py

示例4: convertDirectory

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import walkPath [as 别名]
    def convertDirectory(self, path, srcType, targetType, recursive =False):
        if srcType is None or targetType is None:
            self._log.write('ERROR: Source and/or target types are invalid. Operation aborted.')
            return False

        if not os.path.exists(path):
            self._log.write('ERROR: The specified path [%s] does not exist. Operation aborted.' \
                            % str(path))
            return False

        if recursive:
            FileUtils.walkPath(path, self._convertInDirectory, [srcType, targetType])
        else:
            self._convertInDirectory([srcType, targetType], path, os.listdir(path))

        return True
开发者ID:sernst,项目名称:PyAid,代码行数:18,代码来源:DataFormatConverter.py

示例5: _runImpl

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import walkPath [as 别名]
    def _runImpl(self):
        if not os.path.exists(self.targetWebRootPath):
            os.makedirs(self.targetWebRootPath)

        for staticPath in self.get('STATIC_PATHS', []):
            self._staticPaths.append(FileUtils.createPath(
                self.sourceWebRootPath,
                *staticPath.strip(u'/').split(u'/')))

        #-------------------------------------------------------------------------------------------
        # COPY FILES
        #       Copies files from the source folders to the target root folder, maintaining folder
        #       structure in the process
        FileUtils.walkPath(self.sourceWebRootPath, self._copyWalker)

        #--- COMMON FILES ---#
        copies = [
            (u'StaticFlow Javascript', 'web/js', 'js/sflow'),
            (u'StaticFlow CSS', 'web/css', 'css/sflow') ]

        for item in copies:
            source = FileUtils.createPath(
                StaticFlowEnvironment.rootResourcePath, *item[1].split('/'), isDir=True)
            target = FileUtils.createPath(
                self.targetWebRootPath, *item[2].split('/'), isDir=True)

            if os.path.exists(target):
                SystemUtils.remove(target)

            targetFolder = FileUtils.createPath(target, '..', isDir=True)
            if not os.path.exists(targetFolder):
                os.makedirs(targetFolder)

            fileList = FileUtils.mergeCopy(source, target)
            for path, data in fileList.files.iteritems():
                SiteProcessUtils.copyToCdnFolder(
                    path, self, FileUtils.getUTCModifiedDatetime(source))

            self.writeLogSuccess(u'COPIED', u'%s | %s -> %s' % (
                item[0], source.rstrip(os.sep), target.rstrip(os.sep) ))

        #-------------------------------------------------------------------------------------------
        # COMPILE
        #       Compiles source files to the target root folder
        currentPath = os.curdir
        os.path.walk(self.sourceWebRootPath, self._compileWalker, None)
        os.chdir(currentPath)

        #-------------------------------------------------------------------------------------------
        # CREATE PAGE DEFS
        #       Creates the page data files that define the pages to be generated
        os.path.walk(self.sourceWebRootPath, self._htmlDefinitionWalker, None)
        self._pages.process()

        self._sitemap.write()
        self._robots.write()

        for rssGenerator in self._rssGenerators:
            rssGenerator.write()

        self._writeGoogleFiles()

        #-------------------------------------------------------------------------------------------
        # CLEANUP
        #       Removes temporary and excluded file types from the target root folder
        os.path.walk(self.targetWebRootPath, self._cleanupWalker, dict())

        return True
开发者ID:sernst,项目名称:StaticFlow,代码行数:70,代码来源:Site.py

示例6: _cleanupFiles

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import walkPath [as 别名]
 def _cleanupFiles(self, targetPath):
     FileUtils.walkPath(targetPath, self._cleanupInFolder, dict())
开发者ID:sernst,项目名称:PyGlass,代码行数:4,代码来源:ResourceCollector.py

示例7: _compilePythonFiles

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import walkPath [as 别名]
 def _compilePythonFiles(self, rootPath):
     FileUtils.walkPath(rootPath, self._compileInFolder, dict())
开发者ID:sernst,项目名称:PyGlass,代码行数:4,代码来源:ResourceCollector.py

示例8: run

# 需要导入模块: from pyaid.file.FileUtils import FileUtils [as 别名]
# 或者: from pyaid.file.FileUtils.FileUtils import walkPath [as 别名]
    def run(self):
        """Doc..."""

        FileUtils.walkPath(
            self._rootPath, self._compileInFolder, data=dict(), recursive=self._recursive)
开发者ID:sernst,项目名称:PyGlass,代码行数:7,代码来源:WidgetUiCompiler.py


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