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


Python Spec._normal方法代码示例

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


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

示例1: read_spec

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import _normal [as 别名]
    def read_spec(self, path):
        """Read the contents of a file and parse them as a spec"""
        with closing(open(path)) as spec_file:
            # Specs from files are assumed normal and concrete
            spec = Spec(spec_file.read().replace('\n', ''))

        if all(spack.db.exists(s.name) for s in spec.traverse()):
            copy = spec.copy()

            # TODO: It takes a lot of time to normalize every spec on read.
            # TODO: Storing graph info with spec files would fix this.
            copy.normalize()
            if copy.concrete:
                return copy   # These are specs spack still understands.

        # If we get here, either the spec is no longer in spack, or
        # something about its dependencies has changed. So we need to
        # just assume the read spec is correct.  We'll lose graph
        # information if we do this, but this is just for best effort
        # for commands like uninstall and find.  Currently Spack
        # doesn't do anything that needs the graph info after install.

        # TODO: store specs with full connectivity information, so
        # that we don't have to normalize or reconstruct based on
        # changing dependencies in the Spack tree.
        spec._normal = True
        spec._concrete = True
        return spec
开发者ID:AaronTHolt,项目名称:spack,代码行数:30,代码来源:directory_layout.py

示例2: read_spec

# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import _normal [as 别名]
    def read_spec(self, path):
        """Read the contents of a file and parse them as a spec"""
        with closing(open(path)) as spec_file:
            # Specs from files are assumed normal and concrete
            spec = Spec(spec_file.read().replace('\n', ''))

        # If we do not have a package on hand for this spec, we know
        # it is concrete, and we *assume* that it is normal. This
        # prevents us from trying to fetch a non-existing package, and
        # allows best effort for commands like spack find.
        if not spack.db.exists(spec.name):
            spec._normal = True
            spec._concrete = True
        else:
            spec.normalize()
            if not spec.concrete:
                tty.warn("Spec read from installed package is not concrete:",
                         path, spec)

        return spec
开发者ID:scrobey,项目名称:spack,代码行数:22,代码来源:directory_layout.py


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