Exemplo n.º 1
0
def tox_testenv_install_deps(venv: VirtualEnv, action: Action) -> None:
    config = venv.envconfig
    distributions = config.pytorch_distributions
    if not distributions:
        return None

    links = find_links(distributions,
                       computation_backend=config.pytorch_computation_backend)

    action.setactivity("installdeps-pytorch", ", ".join(links))
    venv._install(links, action=action)
Exemplo n.º 2
0
def tox_testenv_install_deps(venv: VirtualEnv, action: action.Action) -> Any:
    if not detect_pdm_files(venv.path):
        return
    groups = venv.envconfig.groups or []
    if not venv.envconfig.skip_install or groups:
        action.setactivity("pdminstall", groups)
        args = [
            venv.envconfig.config.option.pdm, "install", "-p",
            str(venv.path)
        ]
        if "default" in groups:
            groups.remove("default")
        elif venv.envconfig.skip_install:
            args.append("--no-default")
        for group in groups:
            args.extend(["--group", group])
        args.append("--no-self")
        venv._pcall(
            args,
            cwd=venv.envconfig.config.toxinidir,
            venv=False,
            action=action,
        )

    deps = venv.get_resolved_dependencies()
    if deps:
        depinfo = ", ".join(map(str, deps))
        action.setactivity("installdeps", depinfo)
        venv._install(deps, action=action)

    lib_path = get_env_lib_path(venv.envconfig.config.option.pdm, venv.path)
    bin_dir = os.path.join(lib_path, "bin")
    scripts_dir = os.path.join(os.path.dirname(lib_path),
                               ("Scripts" if os.name == "nt" else "bin"))

    if os.path.exists(bin_dir):
        for item in os.listdir(bin_dir):
            bin_item = os.path.join(bin_dir, item)
            shutil.move(bin_item, os.path.join(scripts_dir, item))
    return True