Exemple #1
0
def get_installed_packages(prefix, show_channel_urls=None):
    result = {"packages": {}}

    # Currently, we need to have pip interop disabled :/
    installed = {
        rec: rec
        for rec in PrefixData(prefix,
                              pip_interop_enabled=False).iter_records()
    }

    # add virtual packages as installed packages
    # they are packages installed on the system that conda can do nothing
    # about (e.g. glibc)
    # if another version is needed, installation just fails
    # they don't exist anywhere (they start with __)
    _supplement_index_with_system(installed)
    installed = list(installed)

    for prec in installed:
        json_rec = prec.dist_fields_dump()
        json_rec["depends"] = prec.depends
        json_rec["constrains"] = prec.constrains
        json_rec["build"] = prec.build
        result["packages"][prec.fn] = json_rec

    return installed, result
Exemple #2
0
def test_supplement_index_with_system_glibc():
    index = {}
    with env_vars({'CONDA_OVERRIDE_GLIBC': '2.10'}):
        _supplement_index_with_system(index)

    glibc_pkg = next(iter(_ for _ in index if _.name == '__glibc'))
    assert glibc_pkg.version == '2.10'
    assert glibc_pkg.package_type == PackageType.VIRTUAL_SYSTEM
Exemple #3
0
def test_supplement_index_with_system_osx():
    index = {}
    with env_vars({'CONDA_OVERRIDE_OSX': '0.15'}):
        _supplement_index_with_system(index)

    osx_pkg = next(iter(_ for _ in index if _.name == '__osx'))
    assert osx_pkg.version == '0.15'
    assert osx_pkg.package_type == PackageType.VIRTUAL_SYSTEM
Exemple #4
0
def test_supplement_index_with_system_linux_extended():
    index = {}
    with env_vars({'CONDA_OVERRIDE_LINUX': '4.2.0-42-generic'}):
        _supplement_index_with_system(index)

    linux_pkg = next(iter(_ for _ in index if _.name == '__linux'))
    assert linux_pkg.version == '4.2.0'
    assert linux_pkg.package_type == PackageType.VIRTUAL_SYSTEM
Exemple #5
0
def test_supplement_index_with_system_cuda():
    index = {}
    with env_vars({'CONDA_OVERRIDE_CUDA': '3.2'}):
        _supplement_index_with_system(index)

    cuda_pkg = next(iter(_ for _ in index if _.name == '__cuda'))
    assert cuda_pkg.version == '3.2'
    assert cuda_pkg.package_type == PackageType.VIRTUAL_SYSTEM
Exemple #6
0
def test_supplement_index_with_system():
    index = {}
    with env_vars({'CONDA_OVERRIDE_CUDA': '3.2'}):
        _supplement_index_with_system(index)

    cuda_pkg = index['__cuda']
    assert cuda_pkg.version == '3.2'
    assert cuda_pkg.package_type == PackageType.VIRTUAL_SYSTEM
Exemple #7
0
def test_supplement_index_with_system():
    index = {}
    with env_vars({'CONDA_OVERRIDE_CUDA': '3.2'}):
        _supplement_index_with_system(index)

    cuda_pkg = index['_cuda']
    assert cuda_pkg.version == '3.2'
    assert cuda_pkg.package_type == PackageType.VIRTUAL_SYSTEM
Exemple #8
0
def test_supplement_index_with_system_linux(release_str, version):
    index = {}
    with env_vars({'CONDA_OVERRIDE_LINUX': release_str}):
        _supplement_index_with_system(index)

    linux_pkg = next(iter(_ for _ in index if _.name == '__linux'))
    assert linux_pkg.version == version
    assert linux_pkg.package_type == PackageType.VIRTUAL_SYSTEM
Exemple #9
0
def get_virtual_packages():
    result = {"packages": {}}

    # add virtual packages as installed packages
    # they are packages installed on the system that conda can do nothing
    # about (e.g. glibc)
    # if another version is needed, installation just fails
    # they don't exist anywhere (they start with __)
    installed = dict()
    _supplement_index_with_system(installed)
    installed = list(installed)

    for prec in installed:
        json_rec = prec.dist_fields_dump()
        json_rec["depends"] = prec.depends
        json_rec["build"] = prec.build
        result["packages"][prec.fn] = json_rec

    installed_json_f = tempfile.NamedTemporaryFile("w", delete=False)
    installed_json_f.write(json_dump(result))
    installed_json_f.flush()
    return installed_json_f