A context manager which activates the virtualenv.

        :param list extra_dists: Paths added to the context after the virtualenv is activated.

        This context manager sets the following environment variables:
            * `PYTHONUSERBASE`
            * `VIRTUAL_ENV`
            * `PYTHONIOENCODING`
            * `PYTHONDONTWRITEBYTECODE`

        In addition, it activates the virtualenv inline by calling `activate_this.py`.

def activated(self, include_extras=True, extra_dists=[]):
        """A context manager which activates the virtualenv.

        :param list extra_dists: Paths added to the context after the virtualenv is activated.

        This context manager sets the following environment variables:
            * `PYTHONUSERBASE`
            * `VIRTUAL_ENV`
            * `PYTHONIOENCODING`
            * `PYTHONDONTWRITEBYTECODE`

        In addition, it activates the virtualenv inline by calling `activate_this.py`.
        """

        original_path = sys.path
        original_prefix = sys.prefix
        original_user_base = os.environ.get("PYTHONUSERBASE", None)
        original_venv = os.environ.get("VIRTUAL_ENV", None)
        parent_path = vistir.compat.Path(__file__).absolute().parent.parent.as_posix()
        prefix = self.prefix.as_posix()
        with vistir.contextmanagers.temp_environ(), vistir.contextmanagers.temp_path():
            os.environ["PATH"] = os.pathsep.join([
                vistir.compat.fs_str(self.scripts_dir),
                vistir.compat.fs_str(self.prefix.as_posix()),
                os.environ.get("PATH", "")
            ])
            os.environ["PYTHONIOENCODING"] = vistir.compat.fs_str("utf-8")
            os.environ["PYTHONDONTWRITEBYTECODE"] = vistir.compat.fs_str("1")
            os.environ["PATH"] = self.base_paths["PATH"]
            os.environ["PYTHONPATH"] = self.base_paths["PYTHONPATH"]
            if self.is_venv:
                os.environ["VIRTUAL_ENV"] = vistir.compat.fs_str(prefix)
            sys.path = self.sys_path
            sys.prefix = self.sys_prefix
            site.addsitedir(self.base_paths["purelib"])
            if include_extras:
                site.addsitedir(parent_path)
                extra_dists = list(self.extra_dists) + extra_dists
                for extra_dist in extra_dists:
                    if extra_dist not in self.get_working_set():
                        extra_dist.activate(self.sys_path)
                sys.modules["recursive_monkey_patch"] = self.recursive_monkey_patch
            try:
                yield
            finally:
                del os.environ["VIRTUAL_ENV"]
                if original_user_base:
                    os.environ["PYTHONUSERBASE"] = original_user_base
                if original_venv:
                    os.environ["VIRTUAL_ENV"] = original_venv
                sys.path = original_path
                sys.prefix = original_prefix
                six.moves.reload_module(pkg_resources)