Exemple #1
0
    def _create_venv(self):
        if self.func.python is False:
            self.venv = ProcessEnv()
            return

        path = _normalize_path(self.global_config.envdir, self.friendly_name)
        reuse_existing = (self.func.reuse_venv
                          or self.global_config.reuse_existing_virtualenvs)

        if not self.func.venv_backend or self.func.venv_backend == "virtualenv":
            self.venv = VirtualEnv(path,
                                   interpreter=self.func.python,
                                   reuse_existing=reuse_existing)
        elif self.func.venv_backend == "conda":
            self.venv = CondaEnv(path,
                                 interpreter=self.func.python,
                                 reuse_existing=reuse_existing)
        elif self.func.venv_backend == "venv":
            self.venv = VirtualEnv(
                path,
                interpreter=self.func.python,
                reuse_existing=reuse_existing,
                venv=True,
            )
        else:
            raise ValueError(
                "Expected venv_backend one of ('virtualenv', 'conda', 'venv'), but got '{}'."
                .format(self.func.venv_backend))

        self.venv.create()
Exemple #2
0
    def _create_venv(self):
        if self.func.python is False:
            self.venv = ProcessEnv()
            return

        path = _normalize_path(self.global_config.envdir, self.friendly_name)
        reuse_existing = (self.func.reuse_venv
                          or self.global_config.reuse_existing_virtualenvs)
        self.venv = VirtualEnv(path,
                               interpreter=self.func.python,
                               reuse_existing=reuse_existing)
        self.venv.create()
Exemple #3
0
    def _create_venv(self):
        if not self.config.virtualenv:
            self.venv = ProcessEnv()
            self._should_install_deps = False
            return

        self.venv = VirtualEnv(
            _normalize_path(self.global_config.envdir, self.signature
                            or self.name),
            interpreter=self.config.interpreter,
            reuse_existing=(self.config.reuse_existing_virtualenv
                            or self.global_config.reuse_existing_virtualenvs))
        self._should_install_deps = self.venv.create()
Exemple #4
0
    def _create_venv(self) -> None:
        if self.func.python is False:
            self.venv = ProcessEnv()
            return

        reuse_existing = (
            self.func.reuse_venv or self.global_config.reuse_existing_virtualenvs
        )

        if not self.func.venv_backend or self.func.venv_backend == "virtualenv":
            self.venv = VirtualEnv(
                self.envdir,
                interpreter=self.func.python,  # type: ignore
                reuse_existing=reuse_existing,
                venv_params=self.func.venv_params,
            )
        elif self.func.venv_backend == "conda":
            self.venv = CondaEnv(
                self.envdir,
                interpreter=self.func.python,  # type: ignore
                reuse_existing=reuse_existing,
                venv_params=self.func.venv_params,
            )
        elif self.func.venv_backend == "venv":
            self.venv = VirtualEnv(
                self.envdir,
                interpreter=self.func.python,  # type: ignore
                reuse_existing=reuse_existing,
                venv=True,
                venv_params=self.func.venv_params,
            )
        else:
            raise ValueError(
                "Expected venv_backend one of ('virtualenv', 'conda', 'venv'), but got '{}'.".format(
                    self.func.venv_backend
                )
            )

        self.venv.create()