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


Python SolutionDirectory.determineVCS方法代码示例

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


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

示例1: run

# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import determineVCS [as 别名]
    def run(self):
        if len(self.parser.getArgs())>2:
            error("Too many arguments:",self.parser.getArgs()[2:],"can not be used")

        sName=self.parser.getArgs()[0]
        dName=self.parser.getArgs()[1]

        if path.exists(dName):
            if self.parser.getOptions().force:
                warning("Replacing",dName,"(--force option)")
            elif path.exists(path.join(dName,"system","controlDict")):
                error("Destination",dName,"already existing and a Foam-Case")
            elif path.isdir(dName):
                dName=path.join(dName,path.basename(sName))
                if path.exists(dName) and not self.parser.getOptions().force:
                    error(dName,"already existing")
        elif not path.exists(path.dirname(dName)):
            warning("Directory",path.dirname(dName),"does not exist. Creating")

        sol=SolutionDirectory(sName,
                              archive=None,
                              paraviewLink=False,
                              addLocalConfig=True,
                              parallel=self.opts.parallel)

        if sol.determineVCS()!=None and self.opts.vcs:
            if self.opts.chemkin or self.opts.additional or self.opts.latest:
                self.error("Using an unimplemented option together with VCS")

            vcsInter=getVCS(sol.determineVCS(),
                            path=sol.name)
            vcsInter.clone(dName)
            return

        if self.parser.getOptions().chemkin:
            sol.addToClone("chemkin")

        if self.parser.getOptions().dopyfoam:
            sol.addToClone("customRegexp")

        for a in self.parser.getOptions().additional:
            sol.addToClone(a)

        if self.parser.getOptions().latest:
            sol.addToClone(sol.getLast())

        if self.opts.symlinkMode:
            sol.symlinkCase(
                dName,
                followSymlinks=self.parser.getOptions().followSymlinks,
                maxLevel=self.opts.symlinkLevel,
                relPath=self.opts.symlinkRelative
            )
        else:
            sol.cloneCase(
                dName,
                followSymlinks=self.parser.getOptions().followSymlinks
            )

        self.addToCaseLog(dName,"Cloned to",dName)
开发者ID:martinep,项目名称:foam-extend-svn,代码行数:62,代码来源:CloneCase.py

示例2: run

# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import determineVCS [as 别名]
    def run(self):
        sol=SolutionDirectory(self.parser.getArgs()[0])
        if not self.opts.init:
            vcs=sol.determineVCS()
            if vcs==None:
                self.error("not under version control")                
            if not vcs in self.vcsChoices:
                self.error("Unsupported VCS",vcs)
        else:
            vcs=self.opts.vcs

        vcsInter=getVCS(vcs,
                        path=sol.name,
                        init=self.opts.init)

        vcsInter.addPath(path.join(sol.name,"constant"),rules=ruleList)
        vcsInter.addPath(path.join(sol.name,"system"),rules=ruleList)
        if sol.initialDir()!=None:
            vcsInter.addPath(sol.initialDir(),rules=ruleList)
        else:
            self.warning("No initial-directory found")

        # special PyFoam-files
        for f in ["customRegexp","LocalConfigPyFoam"]:
            p=path.join(sol.name,f)
            if path.exists(p):
                vcsInter.addPath(p,rules=ruleList)

        # Add the usual files from the tutorials
        for g in ["Allrun*","Allclean*"]:
            for f in glob(path.join(sol.name,g)):
                vcsInter.addPath(f,rules=ruleList)
                
        for a in self.opts.additional:
            vcsInter.addPath(a,rules=ruleList)
            
        vcsInter.commit(self.opts.commitMessage)
开发者ID:floli,项目名称:tools,代码行数:39,代码来源:InitVCSCase.py


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