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


Python Dist.from_string方法代码示例

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


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

示例1: test_channel

# 需要导入模块: from conda.models.dist import Dist [as 别名]
# 或者: from conda.models.dist.Dist import from_string [as 别名]
    def test_channel(self):
        d = Dist.from_string("conda-forge::spyder-app-2.3.8-py27_0.tar.bz2")
        assert d.channel == 'conda-forge'
        assert d.quad[0] == "spyder-app"
        assert d.dist_name == "spyder-app-2.3.8-py27_0"

        d = Dist.from_string("s3://some/bucket/name::spyder-app-2.3.8-py27_0.tar.bz2")
        assert d.channel == 's3://some/bucket/name'
        assert d.quad[0] == "spyder-app"
        assert d.dist_name == "spyder-app-2.3.8-py27_0"
开发者ID:jakirkham,项目名称:conda,代码行数:12,代码来源:test_dist.py

示例2: test_dist

# 需要导入模块: from conda.models.dist import Dist [as 别名]
# 或者: from conda.models.dist.Dist import from_string [as 别名]
    def test_dist(self):
        d = Dist.from_string("spyder-app-2.3.8-py27_0.tar.bz2")
        assert d.channel == UNKNOWN_CHANNEL
        assert d.quad[0] == "spyder-app"
        assert d.quad[1] == "2.3.8"
        assert d.quad[2] == "py27_0"
        assert d.build_number == 0
        assert d.dist_name == "spyder-app-2.3.8-py27_0"

        assert d == Dist.from_string("spyder-app-2.3.8-py27_0")
        assert d != Dist.from_string("spyder-app-2.3.8-py27_1.tar.bz2")

        d2 = Dist("spyder-app-2.3.8-py27_0.tar.bz2")
        assert d == d2

        d3 = Dist(d2)
        assert d3 is d2
开发者ID:scopatz,项目名称:conda,代码行数:19,代码来源:test_dist.py

示例3: test_with_feature_depends

# 需要导入模块: from conda.models.dist import Dist [as 别名]
# 或者: from conda.models.dist.Dist import from_string [as 别名]
    def test_with_feature_depends(self):
        d = Dist.from_string("spyder-app-2.3.8-py27_0[mkl]")
        assert d.with_features_depends == "mkl"

        d = Dist("[email protected]")
        assert d.channel == "@"
        assert d.quad[0] == "[email protected]"
        assert d.quad[1] == ""
        assert d.quad[2] == ""
        assert d.with_features_depends is None
        assert d.is_feature_package
开发者ID:jakirkham,项目名称:conda,代码行数:13,代码来源:test_dist.py

示例4: generate_mocked_resolve

# 需要导入模块: from conda.models.dist import Dist [as 别名]
# 或者: from conda.models.dist.Dist import from_string [as 别名]
def generate_mocked_resolve(pkgs, install=None):
    mock_package = namedtuple("IndexRecord",
                              ["preferred_env", "name", "schannel", "version", "fn"])
    mock_resolve = namedtuple("Resolve", ["get_dists_for_spec", "index", "explicit", "install",
                                          "package_name", "dependency_sort"])

    index = {}
    groups = defaultdict(list)
    for preferred_env, name, schannel, version in pkgs:
        dist = Dist.from_string('%s-%s-0' % (name, version), channel_override=schannel)
        pkg = mock_package(preferred_env=preferred_env, name=name, schannel=schannel,
                           version=version, fn=name)
        groups[name].append(dist)
        index[dist] = pkg

    def get_dists_for_spec(spec, emptyok=False):
        # Here, spec should be a MatchSpec
        res = groups[spec.name]
        if not res and not emptyok:
            raise NoPackagesFoundError([(spec,)])
        return res

    def get_explicit(spec):
        return True

    def get_install(spec, installed, update_deps=None):
        return install

    def get_package_name(dist):
        return dist.name

    def get_dependency_sort(specs):
        return tuple(spec for spec in specs.values())

    return mock_resolve(get_dists_for_spec=get_dists_for_spec, index=index, explicit=get_explicit,
                        install=get_install, package_name=get_package_name,
                        dependency_sort=get_dependency_sort)
开发者ID:ESSS,项目名称:conda,代码行数:39,代码来源:test_plan.py

示例5: test_display_actions

# 需要导入模块: from conda.models.dist import Dist [as 别名]
# 或者: from conda.models.dist.Dist import from_string [as 别名]
def test_display_actions():
    os.environ["CONDA_SHOW_CHANNEL_URLS"] = "False"
    reset_context(())
    actions = defaultdict(list, {"FETCH": [Dist("sympy-0.7.2-py27_0"), Dist("numpy-1.7.1-py27_0")]})
    # The older test index doesn't have the size metadata
    index[Dist.from_string("sympy-0.7.2-py27_0.tar.bz2")]["size"] = 4374752
    index[Dist.from_string("numpy-1.7.1-py27_0.tar.bz2")]["size"] = 5994338

    with captured() as c:
        display_actions(actions, index)

    assert (
        c.stdout
        == """
The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    sympy-0.7.2                |           py27_0         4.2 MB
    numpy-1.7.1                |           py27_0         5.7 MB
    ------------------------------------------------------------
                                           Total:         9.9 MB

"""
    )

    actions = defaultdict(
        list,
        {
            "PREFIX": "/Users/aaronmeurer/anaconda/envs/test",
            "SYMLINK_CONDA": ["/Users/aaronmeurer/anaconda"],
            "LINK": ["python-3.3.2-0", "readline-6.2-0 1", "sqlite-3.7.13-0 1", "tk-8.5.13-0 1", "zlib-1.2.7-0 1"],
        },
    )

    with captured() as c:
        display_actions(actions, index)

    assert (
        c.stdout
        == """
The following NEW packages will be INSTALLED:

    python:   3.3.2-0 \n\
    readline: 6.2-0   \n\
    sqlite:   3.7.13-0
    tk:       8.5.13-0
    zlib:     1.2.7-0 \n\

"""
    )

    actions["UNLINK"] = actions["LINK"]
    actions["LINK"] = []

    with captured() as c:
        display_actions(actions, index)

    assert (
        c.stdout
        == """
The following packages will be REMOVED:

    python:   3.3.2-0 \n\
    readline: 6.2-0   \n\
    sqlite:   3.7.13-0
    tk:       8.5.13-0
    zlib:     1.2.7-0 \n\

"""
    )

    actions = defaultdict(list, {"LINK": ["cython-0.19.1-py33_0"], "UNLINK": ["cython-0.19-py33_0"]})

    with captured() as c:
        display_actions(actions, index)

    assert (
        c.stdout
        == """
The following packages will be UPDATED:

    cython: 0.19-py33_0 --> 0.19.1-py33_0

"""
    )

    actions["LINK"], actions["UNLINK"] = actions["UNLINK"], actions["LINK"]

    with captured() as c:
        display_actions(actions, index)

    assert (
        c.stdout
        == """
The following packages will be DOWNGRADED due to dependency conflicts:

    cython: 0.19.1-py33_0 --> 0.19-py33_0

"""
#.........这里部分代码省略.........
开发者ID:jakirkham,项目名称:conda,代码行数:103,代码来源:test_plan.py

示例6: ensure_dist_or_dict

# 需要导入模块: from conda.models.dist import Dist [as 别名]
# 或者: from conda.models.dist.Dist import from_string [as 别名]
 def ensure_dist_or_dict(fn):
     return _Dist.from_string(fn)
开发者ID:jakirkham,项目名称:conda-build-all,代码行数:4,代码来源:conda_interface.py


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