[
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: [pyenv] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]\npatreon: # Replace with a single Patreon username\nopen_collective: pyenv # Replace with a single Open Collective username\nko_fi: # Replace with a single Ko-fi username\ntidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\ncustom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n### Prerequisite\n* [ ] Make sure no duplicated issue has already been reported in [the pyenv-virtualenv issues](https://github.com/pyenv/pyenv-virtualenv/issues). You should look in closed issues, too.\n* [ ] Make sure you are reporting a problem in Pyenv-Virtualenv and not seeking consultation with Pyenv-Virtualenv use.\n  * GitHub issues are intended mainly for Pyenv-Virtualenv development purposes. If you are seeking help with Pyenv-Virtualenv use, check [Pyenv-Virtualenv documentation](https://github.com/pyenv/pyenv-virtualenv?tab=readme-ov-file#usage), go to a user community site like [Gitter](https://gitter.im/yyuu/pyenv), [StackOverflow](https://stackoverflow.com/questions/tagged/pyenv), etc, or to [Discussions](https://github.com/orgs/pyenv/discussions).\n* [ ] Make sure your problem is not derived from packaging (e.g. [Homebrew](https://brew.sh)).\n  * Please refer to the package documentation for the installation issues, etc.\n* [ ] Make sure your problem is not derived from other plugins.\n  * This repository is maintaining the `pyenv-virtualenv` plugin only. Please refrain from reporting issues of other plugins here.\n\n### Describe the bug\nA clear and concise description of what the bug is.\nDo specify what the expected behaviour is if that's not obvious from the bug's nature.\n\n#### Reproduction steps\nListing the commands to run in a new console session and their output is usually sufficient.\nPlease use a Markdown code block (three backticks on a line by themselves before and after the text) to denote a console output excerpt.\n\n#### Diagnostic details\n- [ ] Platform information (e.g. Ubuntu Linux 20.04):\n- [ ] OS architecture (e.g. amd64):\n- [ ] pyenv version:\n- [ ] pyenv-virtualenv version:\n- [ ] Python version:\n- [ ] virtualenv version (if installed):\n- [ ] Please attach the debug log of a faulty Pyenv invocation as a gist\n  * If the problem happens in a Pyenv invocation, you can turn on debug logging by setting `PYENV_DEBUG=1`, e.g. `env PYENV_DEBUG=1 pyenv install -v 3.6.4`\n  * If the problem happens outside of a Pyenv invocation, get the debug log like this:\n     ```bash\n     # for Bash\n     export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'\n     # for Zsh\n     export PS4='+(%x:%I): %N(%i): '\n\n     set -x\n     <reproduce the problem>\n     set +x\n     ```\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the intended use case**\n* What your general environment is if it's relevant to the feature request and is not a generic console with a typical Pyenv installation (CI, server with a custom setup, cloud environment, IDE)\n* What you are trying to achieve\n* What specifically you are doing for that regarding Pyenv\n* Where you are stuck\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n[ ] In particular, did you consider [writing a plugin](https://github.com/pyenv/pyenv/blob/master/README.md#pyenv-plugins)? Note that if your plugin has general applicability, you can publish it in the 3rd-party plugin catalog on the Pyenv Wiki as per the link above.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/no-response.yml",
    "content": "# Configuration for probot-no-response - https://github.com/probot/no-response\n\n# Number of days of inactivity before an Issue is closed for lack of response\ndaysUntilClose: 30\n# Label requiring a response\nresponseRequiredLabel: need-feedback\n# Comment to post when closing an Issue for lack of response. Set to `false` to disable\ncloseComment: >\n  This issue has been automatically closed because there has been no response\n  to our request for more information from the original author. With only the\n  information that is currently in the issue, we don't have enough information\n  to take action. Please reach out if you have or find the answers we need so\n  that we can investigate further.\n"
  },
  {
    "path": ".github/workflows/tests.yml",
    "content": "name: tests\non: [pull_request, push]\njobs:\n  tests:\n    strategy:\n      fail-fast: false\n      matrix:\n        os:\n          - ubuntu-24.04\n          - ubuntu-22.04\n          - macos-15-intel\n          - macos-15\n          - macos-14\n    runs-on: ${{ matrix.os }}\n    steps:\n      - uses: actions/checkout@v2\n      - run: git clone https://github.com/bats-core/bats-core.git --depth=1 -b v1.10.0 bats\n      - run: bats/bin/bats --tap test\n"
  },
  {
    "path": ".gitignore",
    "content": "/bats/\n/libexec/pyenv-virtualenv/*/*.class\n/libexec/pyenv-virtualenv/*/*.pyc\n/libexec/pyenv-virtualenv/*/*.pyo\n/libexec/pyenv-virtualenv/*/__pycache__\n*.swo\n*.swp\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\ninstall: git clone --depth=1 https://github.com/sstephenson/bats.git\nscript: bats/bin/bats --tap test\nlanguage: c\nnotifications:\n  email:\n    on_success: never\ndeploy:\n  provider: releases\n  api_key:\n    secure: DsGAt0UmTSGVfsNJ6LmM+LvsV6FYmvX4FcET82XrskPiQW+N8+8JZR8WuZxfmwdJZu+dkkdoq6gYgL2xF7m4LxRG7aw3B5TtbMTrJQeW0hdtCSBwbbYyvwcp2m7ywE8lGAfZQITaGj1R6f2Cgh8cgtcrErjcF0KJsYlVlgNv+/M=\n  on:\n    repo: pyenv/pyenv-virtualenv\n    tags: true\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "## Version History\n\n#### v1.2.6\n* Fix changelog and version numbers\n\n#### v1.2.5\n* Add prompt customization by @jimenezj8 in https://github.com/pyenv/pyenv-virtualenv/pull/476\n* README: fix and distinguish syntax highlighting in Bash vs Fish snippets by @diericx in https://github.com/pyenv/pyenv-virtualenv/pull/489\n* Fix pyenv-virtualenv using a different Python version in a conda environment by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/492\n* Fix confusing activate/deactivate error messages when Pyenv is not installed as a shell function by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/495\n* Fix errorneously creating a symlink inside env directory if running w… by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/496\n* Update LICENSE, fix copyright license year by @JasonnnW3000 in https://github.com/pyenv/pyenv-virtualenv/pull/499\n* docs: add WSL note about core.autocrlf to prevent CRLF issues by @stoneHee99 in https://github.com/pyenv/pyenv-virtualenv/pull/512\n* docs: fix the link to Pyenv shell setup steps by @cshen-dev in https://github.com/pyenv/pyenv-virtualenv/pull/516\n* Convert issue template to new Github format by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/519\n* Prevent loss of data on `virtualenv-delete -f` if the env doesn't exist and the PREFIX envvar is set elsewhere by @SabriRamadanTNG in https://github.com/pyenv/pyenv-virtualenv/pull/518\n\n#### v1.2.4\n* Fix failing to detect `-m venv` when \"python\" is not provided by the distro by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/479\n* README: Remove dollar signs from commands that are meant to be copied by @galonsky in https://github.com/pyenv/pyenv-virtualenv/pull/481\n* Reflect pyenv-latest switch change in 2.4.8 by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/484\n\n#### v1.2.3\n* Fix: add `colorize` helper by @silverjam in https://github.com/pyenv/pyenv-virtualenv/pull/470\n* Bump pyenv-virtualenv reporting version to match release by @ushuz in https://github.com/pyenv/pyenv-virtualenv/pull/471\n* Add fish prompt changing by @romirk in https://github.com/pyenv/pyenv-virtualenv/pull/475\n* Don't activate if a 3rd-party venv is activated over ours by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/478\n\n#### v1.2.2\n* Prompt removal was never done and is not planned anymore by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/447\n* Update PYENV_VIRTUALENV_VERSION by @jack-mcivor in https://github.com/pyenv/pyenv-virtualenv/pull/449\n* Add activate/deactivate hooks by @joshfrench in https://github.com/pyenv/pyenv-virtualenv/pull/452\n* More helpful error message when requesting a nonexistent base version by @MarcinKonowalczyk in https://github.com/pyenv/pyenv-virtualenv/pull/454\n* Add fish install oneliner by @ElijahLynn in https://github.com/pyenv/pyenv-virtualenv/pull/322\n* Link python*-config into VE by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/460\n\n#### v1.2.1\n* Support prefixes resolved by pyenv-latest as base version names by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/446\n\n#### v1.2.0\n* ~/.*rc should be modified instead of ~/.*profile by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/384\n* Fixes #394 - update pyenv virtualenvs to list virtualenvs start with dot prefixes by @Gauravtalreja1 in https://github.com/pyenv/pyenv-virtualenv/pull/395\n* Fix installation steps to allow for Pyenv 2 by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/388\n* Fix get-pip.py URLs for older versions of Python by @jivanf in https://github.com/pyenv/pyenv-virtualenv/pull/403\n* Add (y/N) prompt help text by @sh-cho in https://github.com/pyenv/pyenv-virtualenv/pull/404\n* perf(sh-activate): avoid a pyenv-version-name call by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/380\n* Fix unbound variable errors when running `pyenv activate` with `set -u` Use default empty value. This fixes #422. by @ackalker in https://github.com/pyenv/pyenv-virtualenv/pull/423\n* Fix another unbound variable error by @ackalker in https://github.com/pyenv/pyenv-virtualenv/pull/424\n* Update `get-pip.py` URLs in `pyenv-virtualenv` by @mcdonnnj in https://github.com/pyenv/pyenv-virtualenv/pull/426\n* Deduplicate shims in $PATH for the fish shell during initialization by @ericvw in https://github.com/pyenv/pyenv-virtualenv/pull/430\n* Upgrade uninstall hook after pyenv/pyenv#2432 by @laggardkernel in https://github.com/pyenv/pyenv-virtualenv/pull/438\n* Stop delete force failing when virtualenv does not exist by @eganjs in https://github.com/pyenv/pyenv-virtualenv/pull/330\n* fix: relative path to pyenv-realpath.dylib by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/378\n* Spelling fixes by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/352\n* Clone bats with --depth=1, gitignore it by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/351\n* set -u fixes by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/350\n* Set up Github Actions CI by @native-api in https://github.com/pyenv/pyenv-virtualenv/pull/440\n* Enhance documentation about options for `pyenv virtualenv` by @pylipp in https://github.com/pyenv/pyenv-virtualenv/pull/425\n* Return control to pyenv-uninstall in uninstall/envs.bash by @aiguofer in https://github.com/pyenv/pyenv-virtualenv/pull/321\n* Use realpath of scripts to determine relative locations by @andrew-christianson in https://github.com/pyenv/pyenv-virtualenv/pull/308\n* Shell detect improvements by @scop in https://github.com/pyenv/pyenv-virtualenv/pull/377\n\n#### v1.1.5\n\n* Fix install script (#290, #302)\n\n#### v1.1.4\n\n* Support newer conda (#290)\n* Prefer `python3.x` executable if available (#206, #282, #296)\n\n#### v1.1.3\n\n* No code changes since 1.1.2\n\n#### v1.1.2\n\n* Use custom get-pip URL based on the target version (#253, #254, #255)\n* Source conda 4.4.4 shell files (#251)\n* Evaluate force flag before testing if venv exists (#232)\n\n#### v1.1.1\n\n* Set `CONDA_PREFIX` to make is useable in conda activate/deactivate scripts (#224)\n* Generate `pydoc` executable after creating new virtualenv (#197, #230)\n\n#### v1.1.0\n\n* fish: use \"set -gx\" instead of \"setenv\" (#215, #216, #217, #218)\n\n#### v1.0.0\n\n* Use similar versioning scheme as pyenv; YYYYMMDD -> X.Y.Z\n\n#### v20160716\n\n* Suppress activate/deactivate messages by default (#169, #170, #171)\n* Source conda package activate/deactivat scripts if exist (#173)\n* Use `source` in favor of `.` for `fish` (#175)\n* Use `python -m venv` instead of `pyvenv` due to deprecation of `pyvenv` after 3.6 (#184, #185)\n\n#### v20160315\n\n* Evaluate `${PATH}` when outputted code is eval'd. (#154)\n* Set proper `CONDA_DEFAULT_ENV` for shorter name (#160)\n\n#### v20160202\n\n* Install virtualenv 13.1.2 for CPython/Stackless 3.2.x (yyuu/pyenv#531)\n\n#### v20160112\n\n* Fix problem with `virtualenv` to look up executables from source version with `--system-site-packages` (#62)\n\n#### v20151229\n\n* Fix `deactivate` error on `fish` (#136)\n\n#### v20151222\n\n* Improved interoperability with Anaconda/Miniconda (#103, #106, #107, #108)\n* Create `virtualenv` inside `envs` directory of source version, like Anaconda/Miniconda (#103, #107)\n* Rewrite `pyenv activate` and `pyenv deactivate` without using scripts provided by virtualenv and conda (#51, #69, #103, #104, #121)\n* Improve the `pyenv activate` behaviour on multiple versions (#105, #111)\n* Reject creating a virtualenv named `system` (yyuu/pyenv#475)\n* Add `--skip-aliases` to `pyenv virtualenvs` (#120)\n* Stop showing `version not installed` warning messages in precmd (#49)\n\n#### v20151103\n\n* Passing return value from executed command. (#100)\n* Add workaround for commands installed in a virtual environment created by `pyvenv` (#62)\n* init: zsh: prepend hook to `precmd_functions` (#101)\n\n#### v20151006\n\n* Ignore user's site-packages on ensurepip/get-pip (#89)\n* Find `python-config` from source version if current version is a virtualenv\n* Fix pyenv-virtualenv-init script for fish where command was in string and not being evaluated (#98)\n* Add foolproof for `-p` argument. (yyuu/pyenv#98)\n\n#### v20150719\n\n* Add support for `conda` environments created by Anaconda/Miniconda (#91)\n* Look up commands for original version as well if the environment is created with `--system-site-packages` (#62)\n* Add error message if the source version is not installed (#83)\n\n#### v20150526\n\n* Use `typeset -g` with `precmd_functions` (#75)\n* activate: display setup instructions only with `PYENV_VIRTUALENV_INIT=0` (#78)\n* Ignore failure of pyenv activate (#68)\n\n#### v20150119\n\n * Ignore errors from `pyenv-version-name` since it might fail if there is configuration error (yyuu/pyenv#291)\n * The _shell_ version set in `activate` should be unset in `deactivate` (#61)\n * Anaconda has `activate` script nevertheless it is not a virtual environment (#65)\n\n#### v20141106\n\n * Stop creating after `ensurepip` since it has done by `ensurepip` itself\n * Suppress some useless warnings from `pyenv virtualenv-init`\n\n#### v20141012\n\n * Fix warnings from `shellcheck` to improve support for POSIX sh (#40)\n * Do not allow whitespace in `VIRTUALENV_NAME` (#44)\n * Should not persist `PYENV_DEACTIVATE` after automatic deactivation (#47, #48)\n\n#### v20140705\n\n * Display information on auto-(de)?activation\n * Support manual (de)?activation with auto-activation enabled (#32, #34)\n * Exit as error when (de)?activation failed\n * Use https://bootstrap.pypa.io/ to install setuptools and pip\n * Create backup of original virtualenv within `$(pyenv root)/versions` when `--upgrade`\n\n#### v20140615\n\n * Fix incompatibility issue of `pyenv activate` and `pyenv deactivate` (#26)\n * Workaround for the issue with pyenv-which-ext (#26)\n\n#### v20140614\n\n * Add `pyenv virtualenv-init` to enable auto-activation feature (#24)\n * Create symlinks for executables with version suffix (yyuu/pyenv#182)\n\n#### v20140602\n\n * Use new style GH raw url to avoid redirects (raw.github.com -> raw.githubusercontent.com)\n * Repaired virtualenv activation and deactivation for the fish shell (#23)\n\n#### v20140421\n\n * Display error if `pyenv activate` was invoked as a command\n * Fix completion of `pyenv activate` (#15)\n * Use `virtualenv` instead of `pyvenv` if `-p` has given (yyuu/pyenv#158)\n\n#### v20140123\n\n * Add `activate` and `deactivate` to make `pyenv-virtualenv` work with [jedi](https://github.com/davidhalter/jedi) (#9)\n * Use `ensurepip` to install `pip` if it is available\n * Unset `PIP_REQUIRE_VENV` to avoid problem on the installation of `virtualenv` (#10)\n * Add tests\n\n#### v20140110.1\n\n * Fix install script\n\n#### v20140110\n\n * Support environment variables of `EZ_SETUP` and `GET_PIP`.\n * Support a short option `-p` of `virtualenv`.\n\n#### v20131216\n\n * Use latest release of setuptools and pip if the version not given via environment variables.\n\n#### v20130622\n\n * Removed bundled `virtualenv.py` script. Now pyenv-virtualenv installs `virtualenv` package into source version and then use it.\n * On Python 3.3+, use `pyvenv` as virtualenv command if `virtualenv` is not available.\n * Install setuptools and pip into environments created by `pyvenv`.\n\n#### v20130614\n\n * Add `pyenv virtualenvs` to list all virtualenv versions.\n * *EXPERIMENTAL*: Add `--upgrade` option to re-create virtualenv with migrating packages\n\n#### v20130527\n\n * Remove `python-virtualenv` which was no longer used.\n * Change the installation path of the `virtualenv.py` script. (`./libexec` -> `./libexec/pyenv-virtualenv/${VIRTUALENV_VERSION}`)\n * Download `virtualenv.py` if desired version has not been installed.\n\n#### v20130507\n\n * Display virtualenv information in `--help` and `--version`\n * Update virtualenv version; 1.8.4 -> 1.9.1\n\n#### v20130307\n\n * Rename the project; `s/python-virtualenv/pyenv-virtualenv/g`\n * The `pyenv-virtualenv` script is not depending on `python-virtualenv` now.\n   `python-virtualenv` will left for compatibility and will not continue for future releases.\n * Update virtualenv version; 1.8.2 -> 1.8.4\n\n#### v20130218\n\n * Add pyenv 0.2.x (rbenv 0.4.x) style help messages.\n\n#### v20121023\n\n * Create virtualenv with exact name of python executables.\n * Changed command-line options of python-virtualenv.\n   First argument should be a path to the python executable.\n * Add install script.\n\n#### v20120927\n\n * Initial public release.\n\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) 2025 Yamashita, Yuu\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "MAINTENANCE.md",
    "content": "Creating a release\n==================\n\nThe release of the new version of Pyenv is done via GitHub Releases.\n\nRelease checklist:\n* Start [drafting a new release on GitHub](https://github.com/pyenv/pyenv-virtualenv/releases) to generate a summary of changes. Save the summary locally.\n  * The summary may need editing. E.g. rephrase entries, delete/merge entries that are too minor or irrelevant to the users (e.g. typo fixes, CI)\n* Push the version number in `bin/pyenv-virtualenv`\n  * Minor version is pushed if there are significant functional changes (not e.g. bugfixes/formula adaptations/supporting niche use cases).\n  * Major version is pushed if there are breaking changes\n* Update `CHANGELOG.md` with the new version number and the edited summary (only the changes section), reformatting it like the rest of the changelog sections\n* Commit the changes locally into `master`\n* Create a new tag with the new version number and push the changes including the tag\n* Create a new release on GitHub based on the tag, using the saved summary"
  },
  {
    "path": "README.md",
    "content": "# pyenv-virtualenv\n\n[![Join the chat at https://gitter.im/yyuu/pyenv-virtualenv](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yyuu/pyenv-virtualenv?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n[![Build Status](https://travis-ci.org/pyenv/pyenv-virtualenv.svg?branch=master)](https://travis-ci.org/pyenv/pyenv-virtualenv)\n\npyenv-virtualenv is a [pyenv](https://github.com/pyenv/pyenv) plugin\nthat provides features to manage virtualenvs and conda environments\nfor Python on UNIX-like systems.\n\n(NOTICE: If you are an existing user of [virtualenvwrapper](http://pypi.python.org/pypi/virtualenvwrapper)\nand you love it, [pyenv-virtualenvwrapper](https://github.com/pyenv/pyenv-virtualenvwrapper) may help you\n(additionally) to manage your virtualenvs.)\n\n## Installation\n\n### Installing as a pyenv plugin\n\nThis will install the latest development version of pyenv-virtualenv into\nthe `$(pyenv root)/plugins/pyenv-virtualenv` directory.\n\n**Important note:**  If you installed pyenv into a non-standard directory, make\nsure that you clone this repo into the 'plugins' directory of wherever you\ninstalled into.\n\nFrom inside that directory you can:\n - Check out a specific release tag.\n - Get the latest development release by running `git pull` to download the\n   latest changes.\n\n💡 **WSL note:** If you're using WSL, we recommend setting Git to use Unix-style line endings to prevent script execution errors:\n\n```sh\ngit config --global core.autocrlf input\n```\n\n1. **Check out pyenv-virtualenv into plugin directory**\n\n    ```bash\n    git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv\n    ```\n\n    For the Fish shell:\n\n    ```fish\n    git clone https://github.com/pyenv/pyenv-virtualenv.git (pyenv root)/plugins/pyenv-virtualenv\n    ```\n\n2. (OPTIONAL) **Add `pyenv virtualenv-init` to your shell** to enable auto-activation of virtualenvs. This is entirely optional but pretty useful. See \"Activate virtualenv\" below.\n\n    ```bash\n    echo 'eval \"$(pyenv virtualenv-init -)\"' >> ~/.bashrc\n    ```\n\n    **Fish shell note**:  Add this to your `~/.config/fish/config.fish`\n\n    ```fish\n    status --is-interactive; and pyenv virtualenv-init - | source\n    ```\n\n    **Zsh note**: Modify your `~/.zshrc` file instead of `~/.bashrc`.\n    \n3. **Restart your shell to enable pyenv-virtualenv**\n\n    ```bash\n    exec \"$SHELL\"\n    ```\n\n\n### Installing with Homebrew (for macOS users)\n\nmacOS users can install pyenv-virtualenv with the\n[Homebrew](https://brew.sh) package manager.\nThis will give you access to the `pyenv-virtualenv` command. If you have pyenv\ninstalled, you will also be able to use the `pyenv virtualenv` command.\n\n*This is the recommended method of installation if you installed pyenv\n with Homebrew.*\n\n```sh\nbrew install pyenv-virtualenv\n```\n\nOr, if you would like to install the latest development release:\n\n```sh\nbrew install --HEAD pyenv-virtualenv\n```\n\nAfter installation, you'll still need to do\n[Pyenv shell setup steps](https://github.com/pyenv/pyenv#b-set-up-your-shell-environment-for-pyenv)\nthen add \n```sh\neval \"$(pyenv virtualenv-init -)\"\n```\nto your shell's `.rc` file (as stated in the caveats). You'll only ever have to do this once.\n\n\n## Usage\n\n### Using `pyenv virtualenv` with pyenv\n\nTo create a virtualenv for the Python version used with pyenv, run\n`pyenv virtualenv`, specifying the Python version you want and the name\nof the virtualenv directory. For example,\n\n```sh\npyenv virtualenv 2.7.10 my-virtual-env-2.7.10\n```\n\nwill create a virtualenv based on Python 2.7.10 under `$(pyenv root)/versions` in a\nfolder called `my-virtual-env-2.7.10`.\n\n`pyenv virtualenv` forwards any options to the underlying command that actually\ncreates the virtual environment (`conda`, `virtualenv`, or `python -m venv`).\nSee the output of `pyenv virtualenv --help` for details.\n\n### Create virtualenv from current version\n\nIf there is only one argument given to `pyenv virtualenv`, the virtualenv will\nbe created with the given name based on the current pyenv Python version.\n\n```sh\n$ pyenv version\n3.4.3 (set by /home/yyuu/.pyenv/version)\n$ pyenv virtualenv venv34\n```\n\n\n### List existing virtualenvs\n\n`pyenv virtualenvs` shows you the list of existing virtualenvs and `conda` environments.\n\n```sh\n$ pyenv shell venv34\n$ pyenv virtualenvs\n  miniconda3-3.9.1 (created from /home/yyuu/.pyenv/versions/miniconda3-3.9.1)\n  miniconda3-3.9.1/envs/myenv (created from /home/yyuu/.pyenv/versions/miniconda3-3.9.1)\n  2.7.10/envs/my-virtual-env-2.7.10 (created from /home/yyuu/.pyenv/versions/2.7.10)\n  3.4.3/envs/venv34 (created from /home/yyuu/.pyenv/versions/3.4.3)\n  my-virtual-env-2.7.10 (created from /home/yyuu/.pyenv/versions/2.7.10)\n* venv34 (created from /home/yyuu/.pyenv/versions/3.4.3)\n```\n\nThere are two entries for each virtualenv, and the shorter one is just a symlink.\n\n\n### Activate virtualenv\n\nSome external tools (e.g. [jedi](https://github.com/davidhalter/jedi)) might\nrequire you to `activate` the virtualenv and `conda` environments.\n\nIf `eval \"$(pyenv virtualenv-init -)\"` is configured in your shell, `pyenv-virtualenv` will automatically activate/deactivate virtualenvs on entering/leaving directories which contain a `.python-version` file that contains the name of a valid virtual environment as shown in the output of `pyenv virtualenvs` (e.g., `venv34` or `3.4.3/envs/venv34` in example above) . `.python-version` files are used by pyenv to denote local Python versions and can be created and deleted with the [`pyenv local`](https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-local) command.\n\nYou can also activate and deactivate a pyenv virtualenv manually:\n\n```sh\npyenv activate <name>\npyenv deactivate\n```\n\n\n### Delete existing virtualenv\n\nRemoving the directories in `$(pyenv root)/versions` and `$(pyenv root)/versions/{version}/envs` will delete the virtualenv, or you can run:\n\n```sh\npyenv uninstall my-virtual-env\n```\n\nYou can also delete existing virtualenvs by using `virtualenv-delete` command, e.g. you can run:\n```sh\npyenv virtualenv-delete my-virtual-env\n```\nThis will delete virtualenv called `my-virtual-env`.\n\n\n### virtualenv and venv\n\nThere is a [venv](http://docs.python.org/3/library/venv.html) module available\nfor CPython 3.3 and newer.\nIt provides an executable module `venv` which is the successor of `virtualenv`\nand distributed by default.\n\n`pyenv-virtualenv` uses `python -m venv` if it is available and the `virtualenv`\ncommand is not available.\n\n\n### Anaconda and Miniconda\n\nYou can manage `conda` environments by `conda create` as same manner as standard Anaconda/Miniconda installations.\nTo use those environments, you can use `pyenv activate` and `pyenv deactivate`.\n\n```sh\n$ pyenv version\nminiconda3-3.9.1 (set by /home/yyuu/.pyenv/version)\n$ conda env list\n# conda environments:\n#\nmyenv                    /home/yyuu/.pyenv/versions/miniconda3-3.9.1/envs/myenv\nroot                  *  /home/yyuu/.pyenv/versions/miniconda3-3.9.1\n$ pyenv activate miniconda3-3.9.1/envs/myenv\ndiscarding /home/yyuu/.pyenv/versions/miniconda3-3.9.1/bin from PATH\nprepending /home/yyuu/.pyenv/versions/miniconda3-3.9.1/envs/myenv/bin to PATH\n$ python --version\nPython 3.4.3 :: Continuum Analytics, Inc.\n$ pyenv deactivate\ndiscarding /home/yyuu/.pyenv/versions/miniconda3-3.9.1/envs/myenv/bin from PATH\n```\n\nIf `conda` is available, `pyenv virtualenv` will use it to create environment by `conda create`.\n\n```sh\n$ pyenv version\nminiconda3-3.9.1 (set by /home/yyuu/.pyenv/version)\n$ pyenv virtualenv myenv2\n$ conda env list\n# conda environments:\n#\nmyenv                    /home/yyuu/.pyenv/versions/miniconda3-3.9.1/envs/myenv\nmyenv                    /home/yyuu/.pyenv/versions/miniconda3-3.9.1/envs/myenv2\nroot                  *  /home/yyuu/.pyenv/versions/miniconda3-3.9.1\n```\n\nYou can use version like `miniconda3-3.9.1/envs/myenv` to specify `conda` environment as a version in pyenv.\n\n```sh\n$ pyenv version\nminiconda3-3.9.1 (set by /home/yyuu/.pyenv/version)\n$ pyenv shell miniconda3-3.9.1/envs/myenv\n$ which python\n/home/yyuu/.pyenv/versions/miniconda3-3.9.1/envs/myenv/bin/python\n```\n\n\n### Special environment variables\n\nYou can set certain environment variables to control pyenv-virtualenv.\n\n* `PYENV_VIRTUALENV_CACHE_PATH`, if set, specifies a directory to use for\n  caching downloaded package files.\n* `VIRTUALENV_VERSION`, if set, forces pyenv-virtualenv to install the desired\n  version of virtualenv. If `virtualenv` has not been installed,\n  pyenv-virtualenv will try to install the given version of virtualenv.\n* `GET_PIP`, if set and `venv` is preferred over `virtualenv`,\n  use `get_pip.py` from the specified location.\n* `GET_PIP_URL`, if set and `venv` is preferred over\n  `virtualenv`, download `get_pip.py` from the specified URL.\n* `PIP_VERSION`, if set and `venv` is preferred\n  over `virtualenv`, install the specified version of pip.\n* `PYENV_VIRTUALENV_VERBOSE_ACTIVATE`, if set, shows some verbose outputs on activation and deactivation\n* `PYENV_VIRTUALENV_PROMPT`, if set, allows users to customize how `pyenv-virtualenv` modifies their shell prompt. The default prompt (\"(venv)\") is overwritten with any user-specified text. Specify the location of the virtual environment name with the string `{venv}`. For example, the default prompt string would be `({venv})`.\n\n## Version History\n\nSee [CHANGELOG.md](CHANGELOG.md).\n\n\n### License\n\n[(The MIT License)](LICENSE)\n\n* Copyright (c) 2015 Yamashita, Yuu\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "bin/pyenv-activate",
    "content": "#!/usr/bin/env bash\n#\n# Summary: Activate virtual environment\n#\n# Usage: pyenv activate <virtualenv>\n#        pyenv activate --unset\n#\n# Activate a Python virtualenv environment in current shell.\n# This acts almost as same as `pyenv shell`, but this invokes the `activate`\n# script in your shell.\n#\n# <virtualenv> should be a string matching a Python version known to pyenv.\n\nset -e\n[ -n \"$PYENV_DEBUG\" ] && set -x\n\n# Provide pyenv completions\nif [ \"$1\" = \"--complete\" ]; then\n  echo --unset\n  exec pyenv-virtualenvs --bare\nfi\n\n{ printf \"\\x1B[31;1m\"\n  echo\n  echo \"\\`pyenv activate' requires Pyenv and Pyenv-Virtualenv to be loaded into your shell.\"\n  echo \"Check your shell configuration and Pyenv and Pyenv-Virtualenv installation instructions.\"\n  echo\n  printf \"\\x1B[0m\"\n} 1>&2\nexit 1\n"
  },
  {
    "path": "bin/pyenv-deactivate",
    "content": "#!/usr/bin/env bash\n#\n# Summary: Deactivate virtual environment\n#\n# Usage: pyenv deactivate\n#\n# Deactivate a Python virtual environment.\n\nset -e\n[ -n \"$PYENV_DEBUG\" ] && set -x\n\n{ printf \"\\x1B[31;1m\"\n  echo\n  echo \"\\`pyenv deactivate' requires Pyenv and Pyenv-Virtualenv to be loaded into your shell.\"\n  echo \"Check your shell configuration and Pyenv and Pyenv-Virtualenv installation instructions.\"\n  echo\n  printf \"\\x1B[0m\"\n} 1>&2\nexit 1\n"
  },
  {
    "path": "bin/pyenv-sh-activate",
    "content": "#!/usr/bin/env bash\n#\n# Summary: Activate virtual environment\n#\n# Usage: pyenv activate <virtualenv>\n#        pyenv activate --unset\n#\n# Activate a Python virtualenv environment in current shell.\n# This acts almost as same as `pyenv shell`, but this invokes the `activate`\n# script in your shell.\n#\n# <virtualenv> should be a string matching a Python version known to pyenv.\n\nset -e\n[ -n \"$PYENV_DEBUG\" ] && set -x\n\nif [ -z \"${PYENV_ROOT}\" ]; then\n  PYENV_ROOT=\"$(pyenv-root)\"\nfi\n\nresolve_link() {\n  $(type -p greadlink readlink | head -1) \"$1\"\n}\n\nunset FORCE\nunset QUIET\n\n# Define `before_activate` and `after_activate` functions that allow\n# plugin hooks to register a string of code for execution before or\n# after activating a virtualenv.\ndeclare -a before_hooks after_hooks\n\nbefore_activate() {\n  local hook=\"$1\"\n  before_hooks[\"${#before_hooks[@]}\"]=\"$hook\"\n}\n\nafter_activate() {\n  local hook=\"$1\"\n  after_hooks[\"${#after_hooks[@]}\"]=\"$hook\"\n}\n\n# Load plugin hooks.\nOLDIFS=\"$IFS\"\nIFS=$'\\n' scripts=(`pyenv-hooks activate`)\nIFS=\"$OLDIFS\"\nfor script in \"${scripts[@]}\"; do source \"$script\"; done\n\nwhile [ $# -gt 0 ]; do\n  case \"$1\" in\n  \"--complete\" )\n    # Provide pyenv completions\n    echo --unset\n    exec pyenv-virtualenvs --bare\n    ;;\n  \"-f\" | \"--force\" )\n    FORCE=1\n    ;;\n  \"-q\" | \"--quiet\" )\n    QUIET=1\n    ;;\n  \"--unset\" )\n    exec pyenv-sh-deactivate\n    ;;\n  \"-v\" | \"--verbose\" )\n    unset QUIET\n    PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1\n    ;;\n  * )\n    break\n    ;;\n  esac\n  shift 1\ndone\n\nget_current_versions() {\n  local IFS=:\n  current_versions=($(pyenv-version-name 2>/dev/null))\n}\n\nno_shell=\nversions=(\"$@\")\ncurrent_versions=()\nif [ -z \"${versions}\" ]; then\n  no_shell=1\n  get_current_versions\n  versions=(\"${current_versions[@]}\")\nfi\n\nif [ -z \"${PYENV_VIRTUALENV_INIT}\" ]; then\n  # Backward compatibility issue\n  # https://github.com/yyuu/pyenv-virtualenv/issues/26\n  no_shell=\nfi\n\nvenv=\"${versions}\"\n\nif [ -n \"${VIRTUAL_ENV}\" ]; then\n  # exit as success if a non-pyenv virtualenv is active\n  if [[ -z $PYENV_VIRTUAL_ENV || $PYENV_VIRTUAL_ENV != \"$VIRTUAL_ENV\" ]]; then\n    if [ -z \"${FORCE}\" ]; then\n      if [ -z \"${QUIET}\" ]; then\n        echo \"pyenv-virtualenv: virtualenv \\`${VIRTUAL_ENV}' is already activated\" 1>&2\n      fi\n      echo \"true\"\n      exit 0\n    fi\n  fi\nfi\n\nif ! pyenv-virtualenv-prefix \"${venv}\" 1>/dev/null 2>&1; then\n  # fallback to virtualenv of current version\n  [ -n \"${current_versions}\" ] || get_current_versions\n  new_venv=\"${current_versions%/envs/*}/envs/${venv}\"\n  if pyenv-virtualenv-prefix \"${new_venv}\" 1>/dev/null 2>&1; then\n    venv=\"${new_venv}\"\n    versions[0]=\"${new_venv}\"\n  else\n    if [ -z \"${QUIET}\" ]; then\n      echo \"pyenv-virtualenv: version \\`${venv}' is not a virtualenv\" 1>&2\n    fi\n    echo \"false\"\n    exit 1\n  fi\nfi\n\n# exit as error if there are multiple virtualenvs\n# https://github.com/yyuu/pyenv-virtualenv/issues/105\nfor version in \"${versions[@]}\"; do\n  if [[ \"${version}\" != \"${venv}\" ]]; then\n    if pyenv-virtualenv-prefix \"${version}\" 1>/dev/null 2>&1; then\n      if [ -z \"${QUIET}\" ]; then\n        echo \"pyenv-virtualenv: cannot activate multiple versions at once: ${versions[@]}\" 1>&2\n      fi\n      echo \"false\"\n      exit 1\n    fi\n  fi\ndone\n\nshell=\"${PYENV_SHELL:-${SHELL##*/}}\"\nprefix=\"$(pyenv-prefix \"${venv}\")\"\n\nif [ -L \"${prefix}\" ]; then\n  prefix=\"$(resolve_link \"${prefix}\" 2>/dev/null)\"\nfi\n\n# exit as success if the virtualenv is already activated\nif [[ \"${VIRTUAL_ENV}\" == \"${prefix}\" ]]; then\n  if [ -z \"${FORCE}\" ]; then\n    if [ -z \"${QUIET}\" ]; then\n      echo \"pyenv-virtualenv: version \\`${venv}' is already activated\" 1>&2\n    fi\n    echo \"true\"\n    exit 0\n  fi\nfi\n\npyenv-sh-deactivate --force --quiet || true\n\n# Execute `before_activate` hooks.\nfor hook in \"${before_hooks[@]}\"; do eval \"$hook\"; done\n\nif [ -n \"$PYENV_VIRTUALENV_VERBOSE_ACTIVATE\" ]; then\n  echo \"pyenv-virtualenv: activate ${venv}\" 1>&2\nfi\n\nif [ -z \"$no_shell\" ]; then\n  # shell version set in pyenv-sh-activate should be unset\n  # https://github.com/yyuu/pyenv-virtualenv/issues/61\n  OLDIFS=\"$IFS\"\n  IFS=:\n  case \"$shell\" in\n  fish )\n    cat <<EOS\nset -gx PYENV_VERSION \"${versions[*]}\";\nset -gx PYENV_ACTIVATE_SHELL 1;\nEOS\n    ;;\n  * )\n    cat <<EOS\nexport PYENV_VERSION=\"${versions[*]}\";\nexport PYENV_ACTIVATE_SHELL=1;\nEOS\n    ;;\n  esac\n  IFS=\"$OLDIFS\"\nfi\n\n# virtualenv/venv\ncase \"${shell}\" in\nfish )\n  cat <<EOS\nset -gx PYENV_VIRTUAL_ENV \"${prefix}\";\nset -gx VIRTUAL_ENV \"${prefix}\";\nEOS\n  ;;\n* )\n  cat <<EOS\nexport PYENV_VIRTUAL_ENV=\"${prefix}\";\nexport VIRTUAL_ENV=\"${prefix}\";\nEOS\n  ;;\nesac\n\n# anaconda/miniconda\nif [ -d \"${prefix}/conda-meta\" ] ||\n     [ -x \"${prefix}/bin/conda\" ]; then\n  if [[ \"${prefix}\" != \"${prefix%/envs/*}\" ]]; then\n    CONDA_DEFAULT_ENV=\"${venv##*/envs/}\"\n  else\n    CONDA_DEFAULT_ENV=\"root\"\n  fi\n  case \"${shell}\" in\n  fish )\n    echo \"set -gx CONDA_DEFAULT_ENV \\\"${CONDA_DEFAULT_ENV}\\\";\"\n    ;;\n  * )\n    echo \"export CONDA_DEFAULT_ENV=\\\"${CONDA_DEFAULT_ENV}\\\";\"\n    ;;\n  esac\nfi\n\nif [ -n \"${PYTHONHOME}\" ]; then\n  case \"${shell}\" in\n  fish )\n    cat <<EOS\nset -gx _OLD_VIRTUAL_PYTHONHOME \"${PYTHONHOME}\";\nset -e PYTHONHOME;\nEOS\n    ;;\n  * )\n    cat <<EOS\nexport _OLD_VIRTUAL_PYTHONHOME=\"${PYTHONHOME}\";\nunset PYTHONHOME;\nEOS\n    ;;\n  esac\nfi\n\nPYENV_VIRTUALENV_DISABLE_PROMPT=\"${PYENV_VIRTUALENV_DISABLE_PROMPT:-${PYENV_VIRTUAL_ENV_DISABLE_PROMPT}}\"\nPYENV_VIRTUALENV_DISABLE_PROMPT=\"${PYENV_VIRTUALENV_DISABLE_PROMPT:-${VIRTUAL_ENV_DISABLE_PROMPT}}\"\n\nif [ -z \"${PYENV_VIRTUALENV_DISABLE_PROMPT}\" ]; then\n  case \"${shell}\" in\n  fish )\n    if [ -z \"${QUIET}\" ]; then\n      cat <<EOS\nfunctions -e _pyenv_old_prompt              # remove old prompt function if exists. \n                                            # since everything is in memory, it's safe to\n                                            # remove it.\nfunctions -c fish_prompt _pyenv_old_prompt  # backup old prompt function\n\n# from python-venv\nfunction fish_prompt\n    set -l prompt (_pyenv_old_prompt)       # call old prompt function first since it might \n                                            # read exit status\n    echo -n \"(${venv}) \"                    # add virtualenv to prompt\n    string join -- \\n \\$prompt              # handle multiline prompts\nend\nEOS\n    fi\n    ;;\n  * )\n    if [ -z \"${PYENV_VIRTUALENV_PROMPT}\" ]; then\n      PYENV_VIRTUALENV_PROMPT=\"(${venv})\"\n    else\n      PYENV_VIRTUALENV_PROMPT=\"${PYENV_VIRTUALENV_PROMPT/\\{venv\\}/${venv}}\"\n    fi\n    cat <<EOS\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"${PYENV_VIRTUALENV_PROMPT} \\${PS1:-}\";\nEOS\n    ;;\n  esac\nfi\n\n# conda package anaconda/miniconda scripts (#173)\nif [ -d \"${prefix}/conda-meta\" ] ||\n     [ -x \"${prefix}/bin/conda\" ]; then\n  shopt -s nullglob\n  case \"${shell}\" in\n  fish )\n    # conda 4.4 and above\n    for script in \"${prefix}/etc/fish/conf.d\"/*.fish; do\n      echo \"source \\\"${script}\\\";\"\n    done\n    ;;\n  * )\n    CONDA_PREFIX=\"$prefix\"\n    echo \"export CONDA_PREFIX=\\\"${CONDA_PREFIX}\\\";\"\n    for script in \"${prefix}/etc/conda/activate.d\"/*.sh; do\n      echo \". \\\"${script}\\\";\"\n    done\n    # conda 4.4 and above\n    for script in \"${prefix}/etc/profile.d\"/*.sh; do\n      echo \". \\\"${script}\\\";\"\n    done\n    ;;\n  esac\n  shopt -u nullglob\nfi\n\n# Execute `after_activate` hooks.\nfor hook in \"${after_hooks[@]}\"; do eval \"$hook\"; done\n"
  },
  {
    "path": "bin/pyenv-sh-deactivate",
    "content": "#!/usr/bin/env bash\n#\n# Summary: Deactivate virtual environment\n#\n# Usage: pyenv deactivate\n#\n# Deactivate a Python virtual environment.\n\nset -e\n[ -n \"$PYENV_DEBUG\" ] && set -x\n\nif [ -z \"${PYENV_ROOT}\" ]; then\n  PYENV_ROOT=\"$(pyenv-root)\"\nfi\n\nunset FORCE\nunset QUIET\n\n# Define `before_deactivate` and `after_deactivate` functions that allow\n# plugin hooks to register a string of code for execution before or\n# after deactivating a virtualenv.\ndeclare -a before_hooks after_hooks\n\nbefore_deactivate() {\n  local hook=\"$1\"\n  before_hooks[\"${#before_hooks[@]}\"]=\"$hook\"\n}\n\nafter_deactivate() {\n  local hook=\"$1\"\n  after_hooks[\"${#after_hooks[@]}\"]=\"$hook\"\n}\n\n# Load plugin hooks.\nOLDIFS=\"$IFS\"\nIFS=$'\\n' scripts=(`pyenv-hooks deactivate`)\nIFS=\"$OLDIFS\"\nfor script in \"${scripts[@]}\"; do source \"$script\"; done\n\nwhile [ $# -gt 0 ]; do\n  case \"$1\" in\n  \"-f\" | \"--force\" )\n    FORCE=1\n    ;;\n  \"-q\" | \"--quiet\")\n    QUIET=1\n    ;;\n  \"-v\" | \"--verbose\" )\n    unset QUIET\n    PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1\n    ;;\n  * )\n    break\n    ;;\n  esac\n  shift 1\ndone\n\nif [ -z \"${VIRTUAL_ENV}\" ]; then\n  if [ -z \"${FORCE}\" ]; then\n    if [ -z \"${QUIET}\" ]; then\n      echo \"pyenv-virtualenv: no virtualenv has been activated.\" 1>&2\n    fi\n    echo \"false\"\n    exit 1\n  fi\nfi\n\nshell=\"$(basename \"${PYENV_SHELL:-$SHELL}\")\"\nprefix=\"${VIRTUAL_ENV}\"\n\nif [[ \"${prefix%/*/envs/*}\" == \"${PYENV_ROOT}/versions\" ]]; then\n  venv=\"${prefix#${PYENV_ROOT}/versions/}\"\nelse\n  venv=\"${prefix##*/}\"\nfi\n\n# Execute `before_deactivate` hooks.\nfor hook in \"${before_hooks[@]}\"; do eval \"$hook\"; done\n\nif [ -n \"$PYENV_VIRTUALENV_VERBOSE_ACTIVATE\" ]; then\n  echo \"pyenv-virtualenv: deactivate ${venv}\" 1>&2\nfi\n\n# conda package anaconda/miniconda scripts (#173)\nif [ -d \"${prefix}/conda-meta\" ] ||\n     [ -x \"${prefix}/bin/conda\" ]; then\n  shopt -s nullglob\n  case \"${shell}\" in\n  fish )\n    : # conda doesn't support fish\n    ;;\n  * )\n    for script in \"${prefix}/etc/conda/deactivate.d\"/*.sh; do\n      echo \". \\\"${script}\\\";\"\n    done\n    echo \"unset CONDA_PREFIX\"\n    ;;\n  esac\n  shopt -u nullglob\nfi\n\nif [ -n \"${PYENV_ACTIVATE_SHELL}\" ]; then\n  # shell version set in pyenv-sh-activate should be unset\n  # https://github.com/yyuu/pyenv-virtualenv/issues/61\n  case \"$shell\" in\n  fish )\n    cat <<EOS\nset -e PYENV_VERSION;\nset -e PYENV_ACTIVATE_SHELL;\nEOS\n    ;;\n  * )\n    cat <<EOS\nunset PYENV_VERSION;\nunset PYENV_ACTIVATE_SHELL;\nEOS\n    ;;\n  esac\nfi\n\n# virtualenv/venv\ncase \"${shell}\" in\nfish )\n  cat <<EOS\nset -e PYENV_VIRTUAL_ENV;\nset -e VIRTUAL_ENV;\nEOS\n  ;;\n* )\n  cat <<EOS\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nEOS\n  ;;\nesac\n\n# anaconda/miniconda\nif [ -n \"${CONDA_DEFAULT_ENV}\" ]; then\n  case \"${shell}\" in\n  fish )\n    echo \"set -e CONDA_DEFAULT_ENV;\"\n    ;;\n  * )\n    echo \"unset CONDA_DEFAULT_ENV;\"\n    ;;\n  esac\nfi\n\ncase \"${shell}\" in\nfish )\n  cat <<EOS\nif [ -n \"\\$_OLD_VIRTUAL_PATH\" ];\n  set -gx PATH \"\\$_OLD_VIRTUAL_PATH\";\n  set -e _OLD_VIRTUAL_PATH;\nend;\nEOS\n  ;;\n* )\n  cat <<EOS\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nEOS\n  ;;\nesac\n\ncase \"${shell}\" in\nfish )\n  cat <<EOS\nif [ -n \"\\$_OLD_VIRTUAL_PYTHONHOME\" ];\n  set -gx PYTHONHOME \"\\$_OLD_VIRTUAL_PYTHONHOME\";\n  set -e _OLD_VIRTUAL_PYTHONHOME;\nend;\nEOS\n  ;;\n* )\n  cat <<EOS\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nEOS\n  ;;\nesac\n\ncase \"${shell}\" in\nfish )\n  cat <<EOS\n# check if old prompt function exists\nif functions -q _pyenv_old_prompt\n  # remove old prompt function if exists.\n  functions -e fish_prompt\n  functions -c _pyenv_old_prompt fish_prompt\n  functions -e _pyenv_old_prompt\nend\nEOS\n  ;;\n* )\n  cat <<EOS\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nEOS\n  ;;\nesac\n\ncase \"${shell}\" in\nfish )\n  cat <<EOS\nif functions -q deactivate;\n  functions -e deactivate;\nend;\nEOS\n  ;;\n* )\n  cat <<EOS\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nEOS\n  ;;\nesac\n\n# Execute `after_deactivate` hooks.\nfor hook in \"${after_hooks[@]}\"; do eval \"$hook\"; done\n"
  },
  {
    "path": "bin/pyenv-virtualenv",
    "content": "#!/usr/bin/env bash\n#\n# Summary: Create a Python virtualenv using the pyenv-virtualenv plugin\n#\n# Usage: pyenv virtualenv [-f|--force] [VIRTUALENV_OPTIONS] [version] <virtualenv-name>\n#        pyenv virtualenv --version\n#        pyenv virtualenv --help\n#\n#   -f/--force       Install even if the version appears to be installed already. Skip\n#                    prompting for confirmation\n#\n# Notable VIRTUALENV_OPTIONS passed to venv-creating executable, if applicable:\n#   -u/--upgrade     Imply --force\n#\n\nPYENV_VIRTUALENV_VERSION=\"1.2.6\"\n\nset -e\n[ -n \"$PYENV_DEBUG\" ] && set -x\n\nif [ -z \"${PYENV_ROOT}\" ]; then\n  PYENV_ROOT=\"$(pyenv-root)\"\nfi\n\n# Provide pyenv completions\nif [ \"$1\" = \"--complete\" ]; then\n  exec pyenv-versions --bare\nfi\n\nunset PIP_REQUIRE_VENV\nunset PIP_REQUIRE_VIRTUALENV\n\n# Define library functions\nparse_options() {\n  OPTIONS=()\n  ARGUMENTS=()\n  local arg option index\n\n  for arg in \"$@\"; do\n    if [ \"${arg:0:1}\" = \"-\" ]; then\n      if [ \"${arg:1:1}\" = \"-\" ]; then\n        OPTIONS[${#OPTIONS[*]}]=\"${arg:2}\"\n      else\n        index=1\n        while option=\"${arg:$index:1}\"; do\n          [ -n \"$option\" ] || break\n          OPTIONS[${#OPTIONS[*]}]=\"$option\"\n          index=$(($index+1))\n        done\n      fi\n    else\n      ARGUMENTS[${#ARGUMENTS[*]}]=\"$arg\"\n    fi\n  done\n}\n\ncolorize() {\n  if [ -t 1 ]; then printf \"\\e[%sm%s\\e[m\" \"$1\" \"$2\"\n  else echo -n \"$2\"\n  fi\n}\n\nresolve_link() {\n  $(type -p greadlink readlink | head -1) \"$1\"\n}\n\nabs_dirname() {\n  local cwd=\"$(pwd)\"\n  local path=\"$1\"\n\n  while [ -n \"$path\" ]; do\n    cd \"${path%/*}\"\n    local name=\"${path##*/}\"\n    path=\"$(resolve_link \"$name\" || true)\"\n  done\n\n  pwd\n  cd \"$cwd\"\n}\n\nhttp() {\n  local method=\"$1\"\n  local url=\"$2\"\n  local file=\"$3\"\n  [ -n \"$url\" ] || return 1\n\n  if type curl &>/dev/null; then\n    \"http_${method}_curl\" \"$url\" \"$file\"\n  elif type wget &>/dev/null; then\n    \"http_${method}_wget\" \"$url\" \"$file\"\n  else\n    echo \"error: please install \\`curl\\` or \\`wget\\` and try again\" >&2\n    exit 1\n  fi\n}\n\nhttp_head_curl() {\n  curl -qsILf \"$1\" >&4 2>&1\n}\n\nhttp_get_curl() {\n  curl -C - -o \"${2:--}\" -qsSLf \"$1\"\n}\n\nhttp_head_wget() {\n  wget -q --spider \"$1\" >&4 2>&1\n}\n\nhttp_get_wget() {\n  wget -nv -c -O \"${2:--}\" \"$1\"\n}\n\nversion() {\n  if [[ -z \"${PYENV_VERSION:-}\" ]]; then\n    # `PYENV_VERSION` might not be declared if this was invoked via `--version`\n    export PYENV_VERSION=\"$(pyenv-version-name)\"\n  fi\n  detect_venv\n  local version\n  if [ -n \"${USE_CONDA}\" ]; then\n    version=\"$(pyenv-exec conda --version 2>/dev/null || true)\"\n    echo \"pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (conda ${version:-unknown})\"\n  else\n    if [ -n \"$USE_M_VENV\" ]; then\n      echo \"pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (${M_VENV_PYTHON_BIN:-python} -m venv)\"\n    else\n      version=\"$(pyenv-exec virtualenv --version 2>/dev/null || true)\"\n      echo \"pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (virtualenv ${version:-unknown})\"\n    fi\n  fi\n}\n\nusage() {\n  # We can remove the sed fallback once pyenv 0.2.0 is widely available.\n  pyenv-help virtualenv 2>/dev/null || sed -ne '/^#/!q;s/.//;s/.//;1,4d;p' < \"$0\"\n  if [ -n \"${USE_CONDA}\" ]; then\n    pyenv-exec conda create --help 2>/dev/null || true\n  else\n    if [ -n \"${USE_M_VENV}\" ]; then\n      pyenv-exec \"${M_VENV_PYTHON_BIN:-python}\" -m venv --help 2>/dev/null || true\n    else\n      pyenv-exec virtualenv --help 2>/dev/null || true\n    fi\n  fi\n  [ -z \"$1\" ] || exit \"$1\"\n}\n\ndetect_venv() {\n  # Check the existence of executables as a workaround for the issue with pyenv-which-ext\n  # https://github.com/yyuu/pyenv-virtualenv/issues/26\n  local prefix=\"$(pyenv-prefix)\"\n  if [ -x \"${prefix}/bin/conda\" ]; then\n    HAS_CONDA=1\n  else\n    if [ -x \"${prefix}/bin/virtualenv\" ]; then\n      HAS_VIRTUALENV=1\n    fi\n    local python\n    local -a pythons\n    if [[ $PYENV_VERSION == \"system\" ]]; then\n      # Prefer `python3.x` executable if available (#206, #282)\n      pythons=(\"python3\" \"python\" \"python2\")\n    else\n      # as per PEP 394, custom activated Python environments should provide the \"python\" command\n      # this includes Pyenv-provided installations\n      pythons=(\"python\")\n    fi\n    for python in \"${pythons[@]}\"; do\n      if pyenv-exec \"${python}\" -m venv --help 1>/dev/null 2>&1; then\n        HAS_M_VENV=1\n        M_VENV_PYTHON_BIN=\"${python}\"\n        break\n      fi\n    done\n  fi\n  # Use `python -m venv` only if there is venv available, virtualenv is not installed, and `-p` not given\n  if [ -n \"${HAS_CONDA}\" ]; then\n    USE_CONDA=1\n  else\n    if [ -n \"${HAS_M_VENV}\" ] && [ -z \"${HAS_VIRTUALENV}\" ] && [ -z \"${VIRTUALENV_PYTHON}\" ]; then\n      USE_M_VENV=1\n    fi\n  fi\n}\n\nbuild_package_ez_setup() {\n  local ez_setup=\"${PYENV_VIRTUALENV_CACHE_PATH}/ez_setup.py\"\n  rm -f \"${ez_setup}\"\n  { if [ \"${EZ_SETUP+defined}\" ] && [ -f \"${EZ_SETUP}\" ]; then\n      echo \"Installing setuptools from ${EZ_SETUP}...\" 1>&2\n      cat \"${EZ_SETUP}\"\n    else\n      [ -n \"${EZ_SETUP_URL}\" ]\n      echo \"Installing setuptools from ${EZ_SETUP_URL}...\" 1>&2\n      http get \"${EZ_SETUP_URL}\"\n    fi\n  } 1> \"${ez_setup}\"\n  pyenv-exec python -s \"${ez_setup}\" ${EZ_SETUP_OPTS} 1>&2 || {\n    echo \"error: failed to install setuptools via ez_setup.py\" >&2\n    return 1\n  }\n}\n\nbuild_package_get_pip() {\n  local get_pip=\"${PYENV_VIRTUALENV_CACHE_PATH}/get-pip.py\"\n  rm -f \"${get_pip}\"\n  { if [ \"${GET_PIP+defined}\" ] && [ -f \"${GET_PIP}\" ]; then\n      echo \"Installing pip from ${GET_PIP}...\" 1>&2\n      cat \"${GET_PIP}\"\n    else\n      [ -n \"${GET_PIP_URL}\" ]\n      echo \"Installing pip from ${GET_PIP_URL}...\" 1>&2\n      http get \"${GET_PIP_URL}\"\n    fi\n  } 1> \"${get_pip}\"\n  pyenv-exec python -s \"${get_pip}\" ${GET_PIP_OPTS} 1>&2 || {\n    echo \"error: failed to install pip via get-pip.py\" >&2\n    return 1\n  }\n}\n\nbuild_package_ensurepip() {\n  pyenv-exec python -s -m ensurepip 2>/dev/null || build_package_get_pip \"$@\" || return 1\n}\n\nprepare_requirements() {\n  pyenv-exec pip freeze > \"${REQUIREMENTS}\"\n  mv -f \"${VIRTUALENV_PATH}\" \"${VIRTUALENV_ORIG}\"\n}\n\ninstall_requirements() {\n  if [ -f \"${REQUIREMENTS}\" ]; then\n    ## Migrate previously installed packages from requirements.txt\n    pyenv-exec pip install $QUIET $VERBOSE --requirement \"${REQUIREMENTS}\" || {\n      echo\n      echo \"PIP INSTALL FAILED\"\n      echo\n      echo \"Inspect or clean up the original tree at ${VIRTUALENV_ORIG}\"\n      echo\n      echo \"Package list:\"\n      cat \"${REQUIREMENTS}\" | sed 's/^/ * /'\n      return 1\n    } 1>&2\n    rm -f \"${REQUIREMENTS}\"\n    rm -fr \"${VIRTUALENV_ORIG}\"\n  fi\n}\n\nPYENV_VIRTUALENV_ROOT=\"$(abs_dirname \"$0\")/..\"\nif [ -z \"${PYENV_VIRTUALENV_CACHE_PATH}\" ]; then\n  PYENV_VIRTUALENV_CACHE_PATH=\"${PYTHON_BUILD_CACHE_PATH:-${PYENV_ROOT}/cache}\"\nfi\nVIRTUALENV_OPTIONS=()\n\nunset FORCE\nunset NO_ENSUREPIP\nunset QUIET\nunset UPGRADE\nunset VERBOSE\nunset VIRTUALENV_PYTHON\n\nparse_options \"$@\"\nfor option in \"${OPTIONS[@]}\"; do\n  case \"$option\" in\n  \"f\" | \"force\" )\n    FORCE=true\n    ;;\n  \"h\" | \"help\" )\n    usage 0\n    ;;\n  \"no-pip\" )\n    NO_ENSUREPIP=1\n    VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]=\"--$option\"\n    ;;\n  \"no-setuptools\" )\n    NO_ENSUREPIP=1\n    VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]=\"--$option\"\n    ;;\n  \"p\" | \"python\" )\n    VIRTUALENV_PYTHON=\"${ARGUMENTS[0]}\"\n    ARGUMENTS=(\"${ARGUMENTS[@]:1}\") # shift 1\n    ;;\n  \"q\" | \"quiet\" )\n    QUIET=\"--quiet\"\n    ;;\n  \"u\" | \"upgrade\" )\n    UPGRADE=true\n    ;;\n  \"v\" | \"verbose\" )\n    VERBOSE=\"--verbose\"\n    ;;\n  \"version\" )\n    version\n    exit 0\n    ;;\n  \"without-pip\" )\n    NO_ENSUREPIP=1\n    VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]=\"--$option\"\n    ;;\n  * ) # virtualenv long options\n    if [[ \"$option\" == \"python=\"* ]]; then\n      VIRTUALENV_PYTHON=\"${option#python=}\"\n    else\n      VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]=\"--$option\"\n    fi\n    ;;\n  esac\ndone\n\nif [[ \"${#ARGUMENTS[@]}\" == 0 ]]; then\n  echo \"pyenv-virtualenv: no virtualenv name given.\" 1>&2\n  exit 1\nelif [[ \"${#ARGUMENTS[@]}\" == 1 ]]; then\n  # If only one argument given, use current version as source version\n  OLDIFS=\"${IFS}\"\n  IFS=:\n  VERSION_NAMES=($(pyenv-version-name))\n  IFS=\"${OLDIFS}\"\n  VERSION_NAME=\"${VERSION_NAMES}\"\n  VIRTUALENV_NAME=\"${ARGUMENTS[0]}\"\nelse\n  # Otherwise, use former as source version, and latter as virtualenv version\n  VERSION_NAME=\"${ARGUMENTS[0]}\"\n  VIRTUALENV_NAME=\"${ARGUMENTS[1]}\"\nfi\n\nif [[ -n \"${VERSION_NAME}\" ]] && command -v pyenv-latest >/dev/null; then\n  VERSION_NAME=\"$(pyenv-latest -f \"${VERSION_NAME}\")\"\nfi\n\nif [ -z \"${VERSION_NAME}\" ] || [ -z \"${VIRTUALENV_NAME}\" ]; then\n  usage 1\nfi\n\nif [[ \"${VIRTUALENV_NAME##*/}\" == \"system\" ]]; then\n  echo \"pyenv-virtualenv: \\`system' is not allowed as virtualenv name.\" 1>&2\n  exit 1\nfi\n\nif [ \"$VIRTUALENV_NAME\" != \"${VIRTUALENV_NAME%[[:space:]]*}\" ]; then\n  echo \"pyenv-virtualenv: no whitespace allowed in virtualenv name.\" 1>&2\n  exit 1\nfi\n\nif [ \"${VIRTUALENV_NAME}\" != \"${VIRTUALENV_NAME%/*}\" ] && [[ \"${VIRTUALENV_NAME}\" != \"${VERSION_NAME%%/*}/envs/${VIRTUALENV_NAME##*/}\" ]] ; then\n  echo \"pyenv-virtualenv: no slash allowed in virtualenv name.\" 1>&2\n  exit 1\nfi\n\n# Set VERSION_NAME as default version in this script\nexport PYENV_VERSION=\"${VERSION_NAME}\"\n\nnot_installed_message() {\n    local is_available=$(python-build --definitions | grep -F -x \"$1\")\n    echo \"pyenv-virtualenv: \\`${1}' is not installed in pyenv.\" 1>&2\n    if [[ $is_available ]]; then\n        echo \"Run \\`pyenv install ${1}' to install it.\" 1>&2\n    else\n        echo \"It does not look like a valid Python version. See \\`pyenv install --list' for available versions.\" 1>&2\n    fi\n}\n\n# Source version must exist before creating virtualenv.\nPREFIX=\"$(pyenv-prefix 2>/dev/null || true)\"\nif [ ! -d \"${PREFIX}\" ]; then\n  not_installed_message \"${PYENV_VERSION}\"\n  exit 1\nfi\n\nif [ -z \"$TMPDIR\" ]; then\n  TMP=\"/tmp\"\nelse\n  TMP=\"${TMPDIR%/}\"\nfi\n\n# Not create `system/envs` directory even if source version is `system`\nif [[ \"${VERSION_NAME%/envs/*}\" == \"system\" ]]; then\n  VIRTUALENV_NAME=\"${VIRTUALENV_NAME##*/}\"\nelse\n  VIRTUALENV_PREFIX=\"$(pyenv-virtualenv-prefix 2>/dev/null || true)\"\n  if [[ \"${VIRTUALENV_PREFIX%/*}\" == \"${PYENV_ROOT}/versions\" ]]; then\n    VIRTUALENV_NAME=\"${VIRTUALENV_PREFIX#${PYENV_ROOT}/versions/}/envs/${VIRTUALENV_NAME##*/}\"\n  else\n    VIRTUALENV_NAME=\"${VERSION_NAME}/envs/${VIRTUALENV_NAME##*/}\"\n  fi\nfi\n\nVIRTUALENV_PATH=\"${PYENV_ROOT}/versions/${VIRTUALENV_NAME}\"\nif [[ \"${VIRTUALENV_PATH/*/envs/*}\" != \"${PYENV_ROOT}/versions\" ]]; then\n  COMPAT_VIRTUALENV_PATH=\"${PYENV_ROOT}/versions/${VIRTUALENV_NAME##*/}\"\nfi\n\nif [ -n \"${COMPAT_VIRTUALENV_PATH}\" ]; then\n  if [ -z ${FORCE} ]; then\n    if [ -e \"${COMPAT_VIRTUALENV_PATH}\" ] || [ -L \"${COMPAT_VIRTUALENV_PATH}\" ]; then\n      echo \"pyenv-virtualenv: \\`${COMPAT_VIRTUALENV_PATH}' already exists.\" 1>&2\n      exit 1\n    fi\n  fi\nfi\n\nunset HAS_VIRTUALENV\nunset HAS_M_VENV\nunset USE_CONDA\nunset USE_M_VENV\ndetect_venv\n\nSEED=\"$(date \"+%Y%m%d%H%M%S\").$$\"\nVIRTUALENV_ORIG=\"${VIRTUALENV_PATH}.${SEED}\"\nREQUIREMENTS=\"${TMP}/requirements.${SEED}.txt\"\n\n# Upgrade existing virtualenv\nif [ -n \"$UPGRADE\" ]; then\n  FORCE=1\n  # `python -m venv` has `--upgrade` by default\n  if [ -n \"${USE_M_VENV}\" ]; then\n    unset UPGRADE\n    VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]=\"--upgrade\"\n  fi\nfi\n\nif [ -z \"${VIRTUALENV_VERSION}\" ]; then\n  case \"${PYENV_VERSION}\" in\n  \"3.0\"* )\n    NO_ENSUREPIP=1\n    ;;\n  \"3.1\"* )\n    NO_ENSUREPIP=1\n    ;;\n  \"3.2\"* | \"stackless-3.2\"* )\n    # pip 8.x (bundled with virtualenv 14+) doesn't support 3.2 anymore\n    # https://github.com/yyuu/pyenv/issues/531\n    VIRTUALENV_VERSION=\"13.1.2\"\n    NO_ENSUREPIP=1\n    ;;\n  esac\nfi\n\nif [ -n \"${USE_CONDA}\" ]; then\n  # e.g. `conda create -n py35 python=3.5 anaconda`\n  if [ -n \"${VIRTUALENV_PYTHON}\" ]; then\n    VIRTUALENV_PYTHON=\"${VIRTUALENV_PYTHON##*/}\"\n    VIRTUALENV_PYTHON=\"${VIRTUALENV_PYTHON#python}\"\n    if [ -n \"${VIRTUALENV_PYTHON}\" ]; then\n      VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]=\"python=${VIRTUALENV_PYTHON}\"\n    fi\n  fi\nelse\n  if [ -n \"${USE_M_VENV}\" ]; then\n    # Unset some arguments not supported by `python -m venv`\n    unset QUIET\n    unset VERBOSE\n    if [ -n \"${VIRTUALENV_PYTHON}\" ]; then\n      echo \"pyenv-virtualenv: \\`--python=${VIRTUALENV_PYTHON}' is not supported by \\`python -m venv'.\" 1>&2\n      exit 1\n    fi\n  else\n    if [ -n \"${VIRTUALENV_PYTHON}\" ]; then\n      if [[ \"${VIRTUALENV_PYTHON}\" == \"${VIRTUALENV_PYTHON##*/}\" ]] || [[ \"${VIRTUALENV_PYTHON}\" == \"${PYENV_ROOT}/shims/\"* ]]; then\n        python=\"$(pyenv-which \"${VIRTUALENV_PYTHON##*/}\" 2>/dev/null || true)\"\n        if [ -x \"${python}\" ]; then\n          VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]=\"--python=${python}\"\n        else\n          python=\"$(PYENV_VERSION=\"$(pyenv-whence \"${VIRTUALENV_PYTHON##*/}\" 2>/dev/null | tail -n 1 || true)\" pyenv-which \"${VIRTUALENV_PYTHON##*/}\" 2>/dev/null || true)\"\n          if [ -x \"${python}\" ]; then\n            VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]=\"--python=${python}\"\n          else\n            # echo \"pyenv-virtualenv: \\`${VIRTUALENV_PYTHON##*/}' is not installed in pyenv.\" 1>&2\n            not_installed_message \"${VIRTUALENV_PYTHON##*/}\"\n            exit 1\n          fi\n        fi\n      else\n        VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]=\"--python=${VIRTUALENV_PYTHON}\"\n      fi\n    fi\n    if [ -z \"${HAS_VIRTUALENV}\" ]; then\n      if [ -n \"${VIRTUALENV_VERSION}\" ]; then\n        virtualenv_spec=\"virtualenv==${VIRTUALENV_VERSION}\"\n      else\n        virtualenv_spec=\"virtualenv\"\n      fi\n      pyenv-exec pip install $QUIET $VERBOSE \"${virtualenv_spec}\"\n      HAS_VIRTUALENV=1\n    fi\n  fi\nfi\n\n# Unset environment variables which start with `VIRTUALENV_`.\n# These variables are reserved for virtualenv.\nunset VIRTUALENV_VERSION\n\n\n# Download specified version of ez_setup.py/get-pip.py.\nif [ -z \"${EZ_SETUP_URL}\" ]; then\n  if [ -n \"${SETUPTOOLS_VERSION}\" ]; then\n    EZ_SETUP_URL=\"https://bitbucket.org/pypa/setuptools/raw/${SETUPTOOLS_VERSION}/ez_setup.py\"\n    unset SETUPTOOLS_VERSION\n  else\n    EZ_SETUP_URL=\"https://bootstrap.pypa.io/ez_setup.py\"\n  fi\nfi\nif [ -z \"${GET_PIP_URL}\" ]; then\n  if [ -n \"${PIP_VERSION}\" ]; then\n    { colorize 1 \"WARNING\"\n      echo \": Setting PIP_VERSION=${PIP_VERSION} is no longer supported and may cause failures during the install process.\"\n    } 1>&2\n    GET_PIP_URL=\"https://raw.githubusercontent.com/pypa/pip/${PIP_VERSION}/contrib/get-pip.py\"\n    # Unset `PIP_VERSION` from environment before invoking `get-pip.py` to deal with \"ValueError: invalid truth value\" (pypa/pip#4528)\n    unset PIP_VERSION\n  else\n    # Use custom get-pip URL based on the target version (#1127)\n    case \"${PYENV_VERSION}\" in\n    2.6 | 2.6.* )\n      GET_PIP_URL=\"https://bootstrap.pypa.io/pip/2.6/get-pip.py\"\n      ;;\n    2.7 | 2.7.* )\n      GET_PIP_URL=\"https://bootstrap.pypa.io/pip/2.7/get-pip.py\"\n      ;;\n    3.2 | 3.2.* )\n      GET_PIP_URL=\"https://bootstrap.pypa.io/pip/3.2/get-pip.py\"\n      ;;\n    3.3 | 3.3.* )\n      GET_PIP_URL=\"https://bootstrap.pypa.io/pip/3.3/get-pip.py\"\n      ;;\n    3.4 | 3.4.* )\n      GET_PIP_URL=\"https://bootstrap.pypa.io/pip/3.4/get-pip.py\"\n      ;;\n    3.5 | 3.5.* )\n      GET_PIP_URL=\"https://bootstrap.pypa.io/pip/3.5/get-pip.py\"\n      ;;\n    3.6 | 3.6.* )\n      GET_PIP_URL=\"https://bootstrap.pypa.io/pip/3.6/get-pip.py\"\n      ;;\n    * )\n      GET_PIP_URL=\"https://bootstrap.pypa.io/pip/get-pip.py\"\n      ;;\n    esac\n  fi\nfi\n\n\n# Define `before_virtualenv` and `after_virtualenv` functions that allow\n# plugin hooks to register a string of code for execution before or\n# after the installation process.\ndeclare -a before_hooks after_hooks\n\nbefore_virtualenv() {\n  local hook=\"$1\"\n  before_hooks[\"${#before_hooks[@]}\"]=\"$hook\"\n}\n\nafter_virtualenv() {\n  local hook=\"$1\"\n  after_hooks[\"${#after_hooks[@]}\"]=\"$hook\"\n}\n\n# Load plugin hooks.\nOLDIFS=\"$IFS\"\nIFS=$'\\n' scripts=(`pyenv-hooks virtualenv`)\nIFS=\"$OLDIFS\"\nfor script in \"${scripts[@]}\"; do source \"$script\"; done\n\n\n[ -d \"${VIRTUALENV_PATH}\" ] && PREFIX_EXISTS=1\n\n# If the virtualenv exists, prompt for confirmation unless\n# the --force option was specified.\nif [ -d \"${VIRTUALENV_PATH}/bin\" ]; then\n  if [ -z \"$FORCE\" ]; then\n    echo \"pyenv-virtualenv: ${VIRTUALENV_PATH} already exists\" 1>&2\n    read -p \"continue with installation? (y/N) \"\n\n    case \"$REPLY\" in\n    y* | Y* ) ;;\n    * ) exit 1 ;;\n    esac\n  fi\n\n  if [ -n \"$UPGRADE\" ]; then\n    if [ -n \"${NO_ENSUREPIP}\" ]; then\n      echo \"pyenv-virtualenv: upgrading will not work with --no-setuptools or --no-pip\" 1>&2\n      exit 1\n    else\n      PYENV_VERSION=\"${VIRTUALENV_NAME}\" prepare_requirements\n    fi\n  fi\nfi\n\n# Execute `before_virtualenv` hooks.\nfor hook in \"${before_hooks[@]}\"; do eval \"$hook\"; done\n\n# Plan cleanup on unsuccessful installation.\ncleanup() {\n  [[ -L \"${COMPAT_VIRTUALENV_PATH}\" ]] && rm \"${COMPAT_VIRTUALENV_PATH}\"\n  [ -z \"${PREFIX_EXISTS}\" ] && rm -rf \"$VIRTUALENV_PATH\"\n}\n\ntrap cleanup SIGINT ERR\n\n# Invoke virtualenv and record exit status in $STATUS.\nSTATUS=0\n# virtualenv may download distribute/setuptools into the current directory.\n# Change to cache directory to reuse them between invocations.\nmkdir -p \"${PYENV_VIRTUALENV_CACHE_PATH}\"\ncd \"${PYENV_VIRTUALENV_CACHE_PATH}\"\nif [ -n \"${USE_CONDA}\" ]; then\n  if [ -z \"$VIRTUALENV_PYTHON\" ]; then\n    #process substitution doesn't seem to work unless it's directly inserted to the command line\n    #if we add it to VIRTUALENV_OPTIONS instead, \"broken pipe\" happens\n    pyenv-exec conda create $QUIET $VERBOSE --name \"${VIRTUALENV_PATH##*/}\" --yes \"${VIRTUALENV_OPTIONS[@]}\" --file <(pyenv-exec conda list python --full-name --export) || STATUS=\"$?\"\n  else\n    pyenv-exec conda create $QUIET $VERBOSE --name \"${VIRTUALENV_PATH##*/}\" --yes \"${VIRTUALENV_OPTIONS[@]}\" || STATUS=\"$?\"\n  fi\nelse\n  if [ -n \"${USE_M_VENV}\" ]; then\n    pyenv-exec \"${M_VENV_PYTHON_BIN:-python}\" -m venv $QUIET $VERBOSE \"${VIRTUALENV_OPTIONS[@]}\" \"${VIRTUALENV_PATH}\" || STATUS=\"$?\"\n  else\n    pyenv-exec virtualenv $QUIET $VERBOSE \"${VIRTUALENV_OPTIONS[@]}\" \"${VIRTUALENV_PATH}\" || STATUS=\"$?\"\n  fi\nfi\n\n(\n  shopt -s nullglob\n  for extra_binary in \"$PREFIX\"/bin/python*-config; do\n    extra_binary_linkname=\"$VIRTUALENV_PATH/bin/$(basename $extra_binary)\"\n    [[ -e \"$extra_binary_linkname\" ]] || \\\n        ln -s \"$extra_binary\" \"$extra_binary_linkname\"\n  done\n)\n\n## Create symlink in the `versions` directory for backward compatibility\nif [ -d \"${VIRTUALENV_PATH}\" ] && [ -n \"${COMPAT_VIRTUALENV_PATH}\" ]; then\n  # Overwrite an existing link, can happen if running with -f\n  ln -fsn \"${VIRTUALENV_PATH}\" \"${COMPAT_VIRTUALENV_PATH}\"\nfi\n\nif [ ! -e \"${VIRTUALENV_PATH}/bin/pydoc\" ]; then\n  mkdir -p \"${VIRTUALENV_PATH}/bin\"\n  cat <<EOS > \"${VIRTUALENV_PATH}/bin/pydoc\"\n#!${VIRTUALENV_PATH}/bin/python\nimport pydoc\nif __name__ == '__main__':\n      pydoc.cli()\nEOS\n  chmod +x \"${VIRTUALENV_PATH}/bin/pydoc\"\nfi\n\nif [ -z \"${NO_ENSUREPIP}\" ]; then\n  ## Install setuptools and pip.\n  PYENV_VERSION=\"${VIRTUALENV_NAME}\" build_package_ensurepip\n\n  ## Migrate previously installed packages from requirements.txt.\n  PYENV_VERSION=\"${VIRTUALENV_NAME}\" install_requirements || true\nfi\n\n# Execute `after_virtualenv` hooks.\nfor hook in \"${after_hooks[@]}\"; do eval \"$hook\"; done\n\n# Run `pyenv-rehash` after a successful installation.\nif [ \"$STATUS\" == \"0\" ]; then\n  pyenv-rehash\nelse\n  cleanup\nfi\n\nexit \"$STATUS\"\n"
  },
  {
    "path": "bin/pyenv-virtualenv-delete",
    "content": "#!/usr/bin/env bash\n#\n# Summary: Uninstall a specific Python virtualenv\n#\n# Usage: pyenv virtualenv-delete [-f|--force] <virtualenv>\n#\n#    -f  Attempt to remove the specified virtualenv without prompting\n#        for confirmation. If the virtualenv does not exist, do not\n#        display an error message.\n#\n# See `pyenv virtualenvs` for a complete list of installed versions.\n#\nset -e\n[ -n \"$PYENV_DEBUG\" ] && set -x\n\nif [ -z \"${PYENV_ROOT}\" ]; then\n  PYENV_ROOT=\"$(pyenv-root)\"\nfi\n\n# Provide pyenv completions\nif [ \"$1\" = \"--complete\" ]; then\n  exec pyenv virtualenvs --bare\nfi\n\nresolve_link() {\n  $(type -p greadlink readlink | head -1) \"$1\"\n}\n\nusage() {\n  pyenv-help virtualenv-delete 2>/dev/null\n  [ -z \"$1\" ] || exit \"$1\"\n}\n\nif [ -z \"$PYENV_ROOT\" ]; then\n  PYENV_ROOT=\"${HOME}/.pyenv\"\nfi\n\nif [ \"$1\" = \"-h\" ] || [ \"$1\" = \"--help\" ]; then\n  usage 0\nfi\n\nunset FORCE\nif [ \"$1\" = \"-f\" ] || [ \"$1\" = \"--force\" ]; then\n  FORCE=true\n  shift\nfi\n\n[ \"$#\" -eq 1 ] || usage 1 >&2\n\nDEFINITION=\"$1\"\ncase \"$DEFINITION\" in\n\"\" | -* )\n  usage 1 >&2\n  ;;\nesac\n\nVERSION_NAME=\"${DEFINITION##*/}\"\n# Must initialize because it might be set in the environment\nENV_PREFIX=\nENV_COMPAT_PREFIX=\"${PYENV_ROOT}/versions/${VERSION_NAME}\"\n\nif [[ \"${DEFINITION}\" != \"${DEFINITION%/envs/*}\" ]]; then\n  ENV_PREFIX=\"${PYENV_ROOT}/versions/${DEFINITION}\"\n  if [ -L \"${ENV_COMPAT_PREFIX}\" ]; then\n    if [[ \"${ENV_PREFIX}\" != \"$(resolve_link \"${ENV_COMPAT_PREFIX}\" 2>/dev/null || true)\" ]]; then\n      unset ENV_COMPAT_PREFIX\n    fi\n  fi\nelse\n  if [ -L \"${ENV_COMPAT_PREFIX}\" ]; then\n    ENV_PREFIX=\"$(resolve_link \"${ENV_COMPAT_PREFIX}\" 2>/dev/null || true)\"\n    if [[ \"${ENV_PREFIX%/*/envs/*}\" != \"${PYENV_ROOT}/versions\" ]]; then\n      echo \"pyenv-virtualenv: \\`${ENV_COMPAT_PREFIX}' is a symlink for unknown location.\" 1>&2\n      exit 1\n    fi\n  else\n    if pyenv-virtualenv-prefix \"${VERSION_NAME}\" 1>/dev/null 2>&1; then\n      ENV_PREFIX=\"${PYENV_ROOT}/versions/${VERSION_NAME}\"\n      unset ENV_COMPAT_PREFIX\n    elif [ -z \"$FORCE\" ]; then\n      echo \"pyenv-virtualenv: \\`${DEFINITION}' is not a virtualenv.\" 1>&2\n      exit 1\n    fi\n  fi\nfi\n\nif [ ! -d \"$ENV_PREFIX\" ]; then\n  if [ -z \"$FORCE\" ]; then\n    echo \"pyenv-virtualenv: virtualenv \\`$VERSION_NAME' not installed\" >&2\n    exit 1\n  else\n    exit 0\n  fi\nfi\n\nif [ -z \"$FORCE\" ]; then\n  read -p \"pyenv-virtualenv: remove $ENV_PREFIX? (y/N) \"\n  case \"$REPLY\" in\n  y* | Y* ) ;;\n  * ) exit 1 ;;\n  esac\nfi\n\nrm -rf \"$ENV_PREFIX\"\nif [ -L \"$ENV_COMPAT_PREFIX\" ]; then\n  rm -rf \"$ENV_COMPAT_PREFIX\"\nfi\npyenv-rehash\n"
  },
  {
    "path": "bin/pyenv-virtualenv-init",
    "content": "#!/usr/bin/env bash\n# Summary: Configure the shell environment for pyenv-virtualenv\n# Usage: eval \"$(pyenv virtualenv-init - [<shell>])\"\n#\n# Automatically activates a Python virtualenv environment based on current\n# pyenv version.\n#\n\nset -e\n[ -n \"$PYENV_DEBUG\" ] && set -x\n\nresolve_link() {\n  $(type -p greadlink readlink | head -1) \"$1\"\n}\n\nabs_dirname() {\n  local cwd=\"$(pwd)\"\n  local path=\"$1\"\n\n  while [ -n \"$path\" ]; do\n    cd \"${path%/*}\"\n    local name=\"${path##*/}\"\n    path=\"$(resolve_link \"$name\" || true)\"\n  done\n\n  pwd\n  cd \"$cwd\"\n}\n\nPYENV_VIRTUALENV_INSTALL_PREFIX=\"$(dirname \"$(abs_dirname \"$0\")\")\"\n\nprint=\"\"\nfor args in \"$@\"\ndo\n  if [ \"$args\" = \"-\" ]; then\n    print=1\n    shift\n  fi\ndone\n\nshell=\"${1:-$PYENV_SHELL}\"\nif [ -z \"$shell\" ]; then\n  shell=\"$(ps -p \"$PPID\" -o 'args=' 2>/dev/null || true)\"\n  shell=\"${shell##-}\"\n  shell=\"${shell%% *}\"\n  shell=\"${shell:-$SHELL}\"\n  shell=\"${shell##*/}\"\n  shell=\"${shell%%-*}\"\nfi\n\nif [ -z \"$print\" ]; then\n  case \"$shell\" in\n  bash )\n    profile='~/.bashrc'\n    ;;\n  zsh )\n    profile='~/.zshrc'\n    ;;\n  ksh )\n    profile='~/.profile'\n    ;;\n  fish )\n    profile='~/.config/fish/config.fish'\n    ;;\n  * )\n    profile='your profile'\n    ;;\n  esac\n\n  { echo \"# Load pyenv-virtualenv automatically by adding\"\n    echo \"# the following to ${profile}:\"\n    echo\n    case \"$shell\" in\n    fish )\n      echo 'status --is-interactive; and source (pyenv virtualenv-init -|psub)'\n      ;;\n    * )\n      echo 'eval \"$(pyenv virtualenv-init -)\"'\n      ;;\n    esac\n    echo\n  } >&2\n\n  exit 1\nfi\n\ncase \"$shell\" in\nfish )\n  cat <<EOS\nwhile set index (contains -i -- \"${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims\" \\$PATH)\nset -eg PATH[\\$index]; end; set -e index\nset -gx PATH '${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims' \\$PATH;\nset -gx PYENV_VIRTUALENV_INIT 1;\nEOS\n  ;;\n* )\n  cat <<EOS\nexport PATH=\"${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims:\\${PATH}\";\nexport PYENV_VIRTUALENV_INIT=1;\nEOS\n  ;;\nesac\n\ncase \"$shell\" in\nfish )\n  cat <<EOS\nfunction _pyenv_virtualenv_hook --on-event fish_prompt;\n  set -l ret \\$status\n  if [ -n \"\\$VIRTUAL_ENV\" ]\n    pyenv activate --quiet; or pyenv deactivate --quiet; or true\n  else\n    pyenv activate --quiet; or true\n  end\n  return \\$ret\nend\nEOS\n ;;\nksh )\n  cat <<EOS\nfunction _pyenv_virtualenv_hook() {\nEOS\n  ;;\n* )\n  cat <<EOS\n_pyenv_virtualenv_hook() {\nEOS\n  ;;\nesac\n\nif [[ \"$shell\" != \"fish\" ]]; then\n  cat <<EOS\n  local ret=\\$?\n  if [ -n \"\\${VIRTUAL_ENV-}\" ]; then\n    eval \"\\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)\" || true\n  else\n    eval \"\\$(pyenv sh-activate --quiet || true)\" || true\n  fi\n  return \\$ret\n};\nEOS\n\n  case \"$shell\" in\n  bash )\n    cat <<EOS\nif ! [[ \"\\${PROMPT_COMMAND-}\" =~ _pyenv_virtualenv_hook ]]; then\n  PROMPT_COMMAND=\"_pyenv_virtualenv_hook;\\${PROMPT_COMMAND-}\"\nfi\nEOS\n    ;;\n  zsh )\n    cat <<EOS\ntypeset -g -a precmd_functions\nif [[ -z \\$precmd_functions[(r)_pyenv_virtualenv_hook] ]]; then\n  precmd_functions=(_pyenv_virtualenv_hook \\$precmd_functions);\nfi\nEOS\n    ;;\n  * )\n    # FIXME: what should i do here??\n    ;;\n  esac\nfi\n"
  },
  {
    "path": "bin/pyenv-virtualenv-prefix",
    "content": "#!/usr/bin/env bash\n#\n# Summary: Display real_prefix for a Python virtualenv version\n# Usage: pyenv virtualenv-prefix [<virtualenv>]\n#\n\nset -e\n[ -n \"$PYENV_DEBUG\" ] && set -x\nif [ -L \"${BASH_SOURCE}\" ]; then\n    READLINK=$(type -p greadlink readlink | head -1)\n    if [ -z \"$READLINK\" ]; then\n        echo \"pyenv: cannot find readlink - are you missing GNU coreutils?\" >&2\n        exit 1\n    fi\n    resolve_link() {\n        $READLINK -f \"$1\"\n    }\n    script_path=$(resolve_link ${BASH_SOURCE})\nelse\n    script_path=${BASH_SOURCE}\nfi\n\n. ${script_path%/*}/../libexec/pyenv-virtualenv-realpath\n\nif [ -z \"$PYENV_ROOT\" ]; then\n  PYENV_ROOT=\"${HOME}/.pyenv\"\nfi\n\nif [ -n \"$1\" ]; then\n  versions=($@)\n  IFS=: PYENV_VERSION=\"${versions[*]}\"\n  export PYENV_VERSION\nelse\n  IFS=: versions=($(pyenv-version-name))\nfi\n\nappend_virtualenv_prefix() {\n  if [ -d \"${VIRTUALENV_PREFIX_PATH}\" ]; then\n    VIRTUALENV_PREFIX_PATHS=(\"${VIRTUALENV_PREFIX_PATHS[@]}\" \"${VIRTUALENV_PREFIX_PATH:-${PYENV_PREFIX_PATH}}\")\n  else\n    echo \"pyenv-virtualenv: version \\`${version}' is not a virtualenv\" 1>&2\n    exit 1\n  fi\n}\n\nVIRTUALENV_PREFIX_PATHS=()\nfor version in \"${versions[@]}\"; do\n  if [ \"$version\" = \"system\" ]; then\n    echo \"pyenv-virtualenv: version \\`${version}' is not a virtualenv\" 1>&2\n    exit 1\n  fi\n  PYENV_PREFIX_PATH=\"$(pyenv-prefix \"${version}\")\"\n  if [ -x \"${PYENV_PREFIX_PATH}/bin/python\" ]; then\n    if [ -f \"${PYENV_PREFIX_PATH}/bin/activate\" ]; then\n      if [ -f \"${PYENV_PREFIX_PATH}/bin/conda\" ]; then\n        # conda\n        VIRTUALENV_PREFIX_PATH=\"${PYENV_PREFIX_PATH}\"\n      else\n        if [ -f \"${PYENV_ROOT}/versions/${version}/pyvenv.cfg\" ]; then\n          # venv\n          virtualenv_binpath=\"$(cut -b 1-1024 \"${PYENV_ROOT}/versions/${version}/pyvenv.cfg\" | sed -n '/^ *home *= */s///p' || true)\"\n          VIRTUALENV_PREFIX_PATH=\"${virtualenv_binpath%/bin}\"\n        else\n          # virtualenv\n          if [ -d \"${PYENV_ROOT}/versions/${version}/Lib\" ]; then\n            # jython\n            virtualenv_libpath=\"${PYENV_ROOT}/versions/${version}/Lib\"\n          else\n            if [ -d \"${PYENV_ROOT}/versions/${version}/lib-python\" ]; then\n              # pypy\n              virtualenv_libpath=\"${PYENV_ROOT}/versions/${version}/lib-python\"\n            else\n              virtualenv_libpath=\"${PYENV_ROOT}/versions/${version}/lib\"\n            fi\n          fi\n          virtualenv_orig_prefix=\"$(find \"${virtualenv_libpath}/\" -maxdepth 2 -type f -and -name \"orig-prefix.txt\" 2>/dev/null | head -1)\"\n          if [ -f \"${virtualenv_orig_prefix}\" ]; then\n            VIRTUALENV_PREFIX_PATH=\"$(cat \"${virtualenv_orig_prefix}\" 2>/dev/null || true)\"\n          fi\n        fi\n      fi\n      append_virtualenv_prefix\n    elif [ -d \"${PYENV_PREFIX_PATH}/conda-meta\" ]; then\n      # conda\n      VIRTUALENV_PREFIX_PATH=\"$(realpath \"${PYENV_PREFIX_PATH}\"/../..)\"\n      append_virtualenv_prefix\n    else\n      echo \"pyenv-virtualenv: version \\`${version}' is not a virtualenv\" 1>&2\n      exit 1\n    fi\n  else\n    echo \"pyenv-virtualenv: \\`python' not found in version \\`${version}'\" 1>&2\n    exit 1\n  fi\ndone\n\nIFS=: echo \"${VIRTUALENV_PREFIX_PATHS[*]}\"\n"
  },
  {
    "path": "bin/pyenv-virtualenvs",
    "content": "#!/usr/bin/env bash\n#\n# Summary: List all Python virtualenvs found in `$PYENV_ROOT/versions/*'.\n# Usage: pyenv virtualenvs [--bare] [--skip-aliases]\n#\n# List all virtualenvs found in `$PYENV_ROOT/versions/*' and its `$PYENV_ROOT/versions/envs/*'.\n\nset -e\n[ -n \"$PYENV_DEBUG\" ] && set -x\nif [ -L \"${BASH_SOURCE}\" ]; then\n    READLINK=$(type -p greadlink readlink | head -1)\n    if [ -z \"$READLINK\" ]; then\n        echo \"pyenv: cannot find readlink - are you missing GNU coreutils?\" >&2\n        exit 1\n    fi\n    resolve_link() {\n        $READLINK -f \"$1\"\n    }\n    script_path=$(resolve_link ${BASH_SOURCE})\nelse\n    script_path=${BASH_SOURCE}\nfi\n\n. ${script_path%/*}/../libexec/pyenv-virtualenv-realpath\n\nif [ -z \"$PYENV_ROOT\" ]; then\n  PYENV_ROOT=\"${HOME}/.pyenv\"\nfi\n\nunset bare\nunset skip_aliases\n# Provide pyenv completions\nfor arg; do\n  case \"$arg\" in\n  --complete )\n    echo --bare\n    echo --skip-aliases\n    exit ;;\n  --bare ) bare=1 ;;\n  --skip-aliases ) skip_aliases=1 ;;\n  * )\n    pyenv-help --usage virtualenvs >&2\n    exit 1\n    ;;\n  esac\ndone\n\nversions_dir=\"${PYENV_ROOT}/versions\"\n\nif [ -d \"$versions_dir\" ]; then\n  versions_dir=\"$(realpath \"$versions_dir\")\"\nfi\n\nif [ -n \"$bare\" ]; then\n  hit_prefix=\"\"\n  miss_prefix=\"\"\n  current_versions=()\n  unset print_origin\n  include_system=\"\"\nelse\n  hit_prefix=\"* \"\n  miss_prefix=\"  \"\n  OLDIFS=\"$IFS\"\n  IFS=: current_versions=($(pyenv-version-name || true))\n  IFS=\"$OLDIFS\"\n  print_origin=\"1\"\n  include_system=\"\"\nfi\n\nnum_versions=0\n\nexists() {\n  local car=\"$1\"\n  local cdar\n  shift\n  for cdar in \"$@\"; do\n    if [ \"${car}\" == \"${cdar}\" ]; then\n      return 0\n    fi\n  done\n  return 1\n}\n\nprint_version() {\n  if exists \"$1\" \"${current_versions[@]}\"; then\n    echo \"${hit_prefix}${1}${print_origin+$2}\"\n  else\n    echo \"${miss_prefix}${1}${print_origin+$2}\"\n  fi\n  num_versions=$((num_versions + 1))\n}\n\nshopt -s dotglob\nshopt -s nullglob\nfor path in \"$versions_dir\"/*; do\n  if [ -d \"$path\" ]; then\n    if [ -n \"$skip_aliases\" ] && [ -L \"$path\" ]; then\n      target=\"$(realpath \"$path\")\"\n      [ \"${target%/*/envs/*}\" != \"$versions_dir\" ] || continue\n    fi\n    virtualenv_prefix=\"$(pyenv-virtualenv-prefix \"${path##*/}\" 2>/dev/null || true)\"\n    if [ -d \"${virtualenv_prefix}\" ]; then\n      print_version \"${path##*/}\" \" (created from ${virtualenv_prefix})\"\n    fi\n    for venv_path in \"${path}/envs/\"*; do\n      venv=\"${path##*/}/envs/${venv_path##*/}\"\n      virtualenv_prefix=\"$(pyenv-virtualenv-prefix \"${venv}\" 2>/dev/null || true)\"\n      if [ -d \"${virtualenv_prefix}\" ]; then\n        print_version \"${venv}\" \" (created from ${virtualenv_prefix})\"\n      fi\n    done\n  fi\ndone\nshopt -u dotglob\nshopt -u nullglob\n\nif [ \"$num_versions\" -eq 0 ] && [ -n \"$include_system\" ]; then\n  echo \"Warning: no Python virtualenv detected on the system\" >&2\n  exit 1\nfi\n"
  },
  {
    "path": "etc/pyenv.d/rehash/envs.bash",
    "content": "virtualenv_list_executable_names() {\n  local file\n  shopt -s nullglob\n  for file in \"$PYENV_ROOT\"/versions/*/envs/*/bin/*; do\n    echo \"${file##*/}\"\n  done\n  shopt -u nullglob\n}\nif declare -f make_shims 1>/dev/null 2>&1; then\n  make_shims $(virtualenv_list_executable_names | sort -u)\nfi\n"
  },
  {
    "path": "etc/pyenv.d/uninstall/envs.bash",
    "content": "resolve_link() {\n  $(type -p greadlink readlink | head -1) \"$1\"\n}\n\nuninstall_related_virtual_env() {\n  if [ -n \"${DEFINITION}\" ]; then\n    if [[ \"${DEFINITION}\" != \"${DEFINITION%/envs/*}\" ]]; then\n      # Uninstall virtualenv by long name\n      pyenv-virtualenv-delete ${FORCE+-f} \"${DEFINITION}\"\n    else\n      VERSION_NAME=\"${VERSION_NAME:-${DEFINITION##*/}}\"\n      PREFIX=\"${PREFIX:-${PYENV_ROOT}/versions/${VERSION_NAME}}\"\n      if [ -L \"${PREFIX}\" ]; then\n        REAL_PREFIX=\"$(resolve_link \"${PREFIX}\" 2>/dev/null || true)\"\n        REAL_DEFINITION=\"${REAL_PREFIX#${PYENV_ROOT}/versions/}\"\n        if [[ \"${REAL_DEFINITION}\" != \"${REAL_DEFINITION%/envs/*}\" ]]; then\n          # Uninstall virtualenv by short name\n          pyenv-virtualenv-delete ${FORCE+-f} \"${REAL_DEFINITION}\"\n        fi\n      else\n        # Uninstall all virtualenvs inside `envs` directory too\n        shopt -s nullglob\n        for virtualenv in \"${PREFIX}/envs/\"*; do\n          pyenv-virtualenv-delete ${FORCE+-f} \"${DEFINITION}/envs/${virtualenv##*/}\"\n        done\n        shopt -u nullglob\n      fi\n    fi\n  fi\n}\n\nbefore_uninstall \"uninstall_related_virtual_env\"\n"
  },
  {
    "path": "etc/pyenv.d/which/conda.bash",
    "content": "# newer versions of conda share programs from the real prefix\n# this hook tries to find the executable there\n\nif [ ! -x \"${PYENV_COMMAND_PATH}\" ] && [[ \"${PYENV_COMMAND_PATH##*/}\" == \"conda\" ]]; then\n  if [ -d \"${PYENV_ROOT}/versions/${version}/conda-meta\" ]; then\n    conda_command_path=\"$(pyenv-virtualenv-prefix \"$version\")\"/bin/\"${PYENV_COMMAND_PATH##*/}\"\n    if [ -x \"${conda_command_path}\" ]; then\n      PYENV_COMMAND_PATH=\"${conda_command_path}\"\n    fi\n  fi\nfi\n"
  },
  {
    "path": "etc/pyenv.d/which/python-config.bash",
    "content": "# some of libraries require `python-config` in PATH to build native extensions.\n# as a workaround, this hook will try to find the executable from the source\n# version of the virtualenv.\n# https://github.com/yyuu/pyenv/issues/397\n\nif [ ! -x \"${PYENV_COMMAND_PATH}\" ] && [[ \"${PYENV_COMMAND_PATH##*/}\" == \"python\"*\"-config\" ]]; then\n  OLDIFS=\"${IFS}\"\n  IFS=:\n  version=\"$(pyenv-version-name)\"\n  IFS=\"${OLDIFS}\"\n  if [ -f \"${PYENV_ROOT}/versions/${version}/bin/activate\" ]; then\n    if [ -f \"${PYENV_ROOT}/versions/${version}/bin/conda\" ]; then\n      : # do nothing for conda's environments\n    else\n      if [ -f \"${PYENV_ROOT}/versions/${version}/pyvenv.cfg\" ]; then\n        # venv\n        virtualenv_binpath=\"$(cut -b 1-1024 \"${PYENV_ROOT}/versions/${version}/pyvenv.cfg\" | sed -n '/^ *home *= */s///p' || true)\"\n        virtualenv_prefix=\"${virtualenv_binpath%/bin}\"\n      else\n        # virtualenv\n        if [ -d \"${PYENV_ROOT}/versions/${version}/Lib\" ]; then\n          # jython\n          virtualenv_libpath=\"${PYENV_ROOT}/versions/${version}/Lib\"\n        else\n          if [ -d \"${PYENV_ROOT}/versions/${version}/lib-python\" ]; then\n            # pypy\n            virtualenv_libpath=\"${PYENV_ROOT}/versions/${version}/lib-python\"\n          else\n            virtualenv_libpath=\"${PYENV_ROOT}/versions/${version}/lib\"\n          fi\n        fi\n        virtualenv_orig_prefix=\"$(find \"${virtualenv_libpath}/\" -maxdepth 2 -type f -and -name \"orig-prefix.txt\" 2>/dev/null | head -1)\"\n        if [ -f \"${virtualenv_orig_prefix}\" ]; then\n          virtualenv_prefix=\"$(cat \"${virtualenv_orig_prefix}\" 2>/dev/null || true)\"\n        fi\n      fi\n      virtualenv_command_path=\"${virtualenv_prefix}/bin/${PYENV_COMMAND_PATH##*/}\"\n      if [ -x \"${virtualenv_command_path}\" ]; then\n        PYENV_COMMAND_PATH=\"${virtualenv_command_path}\"\n      fi\n    fi\n  fi\nfi\n"
  },
  {
    "path": "etc/pyenv.d/which/system-site-packages.bash",
    "content": "# if virtualenv is created with `--system-site-packages`,\n# looks up executables for source version as well if none is\n# installed in the virtualenv.\n# https://github.com/yyuu/pyenv-virtualenv/issues/62\n\nif [ ! -x \"${PYENV_COMMAND_PATH}\" ]; then\n  OLDIFS=\"${IFS}\"\n  IFS=:\n  version=\"$(pyenv-version-name)\"\n  IFS=\"${OLDIFS}\"\n  if [ -f \"${PYENV_ROOT}/versions/${version}/bin/activate\" ]; then\n    unset include_system_site_packages\n    if [ -f \"${PYENV_ROOT}/versions/${version}/bin/conda\" ]; then\n      : # do nothing for conda's environments\n    else\n      if [ -f \"${PYENV_ROOT}/versions/${version}/pyvenv.cfg\" ]; then\n        # venv\n        virtualenv_binpath=\"$(cut -b 1-1024 \"${PYENV_ROOT}/versions/${version}/pyvenv.cfg\" | sed -n '/^ *home *= */s///p' || true)\"\n        virtualenv_prefix=\"${virtualenv_binpath%/bin}\"\n        if grep -q -i \"include-system-site-packages *= *true\" \"${PYENV_ROOT}/versions/${version}/pyvenv.cfg\" 1>/dev/null 2>&1; then\n          include_system_site_packages=1\n        fi\n      else\n        # virtualenv\n        if [ -d \"${PYENV_ROOT}/versions/${version}/Lib\" ]; then\n          # jython\n          virtualenv_libpath=\"${PYENV_ROOT}/versions/${version}/Lib\"\n        else\n          if [ -d \"${PYENV_ROOT}/versions/${version}/lib-python\" ]; then\n            # pypy\n            virtualenv_libpath=\"${PYENV_ROOT}/versions/${version}/lib-python\"\n          else\n            virtualenv_libpath=\"${PYENV_ROOT}/versions/${version}/lib\"\n          fi\n        fi\n        no_global_site_packages=\"$(find \"${virtualenv_libpath}/\" -maxdepth 2 -type f -and -name \"no-global-site-packages.txt\" 2>/dev/null | head -1)\"\n        if [ ! -f \"${no_global_site_packages}\" ]; then\n          include_system_site_packages=1\n        fi\n        virtualenv_orig_prefix=\"$(find \"${virtualenv_libpath}/\" -maxdepth 2 -type f -and -name \"orig-prefix.txt\" 2>/dev/null | head -1)\"\n        if [ -f \"${virtualenv_orig_prefix}\" ]; then\n          virtualenv_prefix=\"$(cat \"${virtualenv_orig_prefix}\" 2>/dev/null || true)\"\n        fi\n      fi\n      if [ -n \"${include_system_site_packages}\" ] && [ -n \"${virtualenv_prefix}\" ]; then\n        # virtualenv is created with `--system-site-packages`\n        virtualenv_command_path=\"${virtualenv_prefix}/bin/${PYENV_COMMAND_PATH##*/}\"\n        if [ -x \"${virtualenv_command_path}\" ]; then\n          PYENV_COMMAND_PATH=\"${virtualenv_command_path}\"\n        fi\n      fi\n    fi\n  fi\nfi\n"
  },
  {
    "path": "install.sh",
    "content": "#!/bin/sh\n# Usage: PREFIX=/usr/local ./install.sh\n#\n# Installs pyenv-virtualenv under $PREFIX.\n\nset -e\n\ncd \"$(dirname \"$0\")\"\n\nif [ -z \"${PREFIX}\" ]; then\n  PREFIX=\"/usr/local\"\nfi\n\nBIN_PATH=\"${PREFIX}/bin\"\nLIBEXEC_PATH=\"${PREFIX}/libexec\"\nSHIMS_PATH=\"${PREFIX}/shims\"\nHOOKS_PATH=\"${PREFIX}/etc/pyenv.d\"\n\nmkdir -p \"$BIN_PATH\"\nmkdir -p \"$LIBEXEC_PATH\"\nmkdir -p \"$SHIMS_PATH\"\nmkdir -p \"$HOOKS_PATH\"\n\ninstall -p bin/* \"$BIN_PATH\"\ninstall -p libexec/* \"$LIBEXEC_PATH\"\ninstall -p shims/* \"$SHIMS_PATH\"\nfor hook in etc/pyenv.d/*; do\n  if [ -d \"$hook\" ]; then\n    cp -RPp \"$hook\" \"$HOOKS_PATH\"\n  else\n    install -p -m 0644 \"$hook\" \"$HOOKS_PATH\"\n  fi\ndone\n"
  },
  {
    "path": "libexec/pyenv-virtualenv-realpath",
    "content": "#!/usr/bin/env bash\n# Summary: Substitute realpath if unavailable as a builtin or file\n# Usage: . pyenv-virtualenv-realpath\n\nif ! {\n    enable -f \"${BASH_SOURCE%/*}\"/../../../libexec/pyenv-realpath.dylib realpath ||\n      type realpath\n  } >/dev/null 2>&1; then\n  if [ -n \"$PYENV_NATIVE_EXT\" ]; then\n    echo \"pyenv: failed to load \\`realpath' builtin\" >&2\n    exit 1\n  fi\n\n  READLINK=$(type -p greadlink readlink | head -1)\n  if [ -z \"$READLINK\" ]; then\n    echo \"pyenv: cannot find readlink - are you missing GNU coreutils?\" >&2\n    exit 1\n  fi\n\n  resolve_link() {\n    $READLINK \"$1\"\n  }\n\n  realpath() {\n    local f=\"$*\" \\\n          name dir\n    [[ $f ]] || {\n      >&2 echo ${FUNCNAME[0]}: missing operand\n      return\n    }\n    while [[ -L $f ]]; do\n      f=\"$(resolve_link \"$f\")\"\n    done\n    if [[ ! -d $f ]]; then\n      name=\"/${f##*/}\"\n      # parent?\n      dir=\"${f%/*}\"\n      if [[ $dir == $f ]]; then\n        #lacks /: parent is current directory\n        f=\"$PWD\"\n      else\n        f=\"$dir\"\n      fi\n    fi\n    #absolute directory\n    dir=\"$(cd \"$f\"\n           pwd)\"\n    echo \"$dir$name\"\n  }\nfi\n"
  },
  {
    "path": "shims/activate",
    "content": "#!/usr/bin/env bash\nif [[ \"$0\" != \"${BASH_SOURCE}\" ]]; then\n  eval \"$(pyenv sh-activate --verbose \"$@\" || true)\"\nelse\n  echo \"pyenv-virtualenv: activate must be sourced. Run 'source activate envname' instead of 'activate envname'\" 1>&2\n  false\nfi\n"
  },
  {
    "path": "shims/deactivate",
    "content": "#!/usr/bin/env bash\nif [[ \"$0\" != \"${BASH_SOURCE}\" ]]; then\n  eval \"$(pyenv sh-deactivate --verbose \"$@\" || true)\"\nelse\n  echo \"pyenv-virtualenv: deactivate must be sourced. Run 'source deactivate' instead of 'deactivate'\" 1>&2\n  false\nfi\n"
  },
  {
    "path": "test/activate.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export HOME=\"${TMP}\"\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n  unset PYENV_VERSION\n  unset PYENV_ACTIVATE_SHELL\n  unset VIRTUAL_ENV\n  unset CONDA_DEFAULT_ENV\n  unset PYTHONHOME\n  unset _OLD_VIRTUAL_PYTHONHOME\n  unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE\n  unset PYENV_VIRTUALENV_DISABLE_PROMPT\n  unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT\n  unset VIRTUAL_ENV_DISABLE_PROMPT\n  unset PYENV_VIRTUALENV_PROMPT\n  unset _OLD_VIRTUAL_PS1\n  stub pyenv-hooks \"activate : echo\"\n}\n\n@test \"activate virtualenv from current version\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  stub pyenv-version-name \"echo venv\"\n  stub pyenv-virtualenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"venv\" run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(venv) \\${PS1:-}\";\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from current version with custom prompt\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  stub pyenv-version-name \"echo venv\"\n  stub pyenv-virtualenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"venv\" PYENV_VIRTUALENV_PROMPT='venv:{venv}' run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"venv:venv \\${PS1:-}\";\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from current version (quiet)\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  stub pyenv-version-name \"echo venv\"\n  stub pyenv-virtualenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"venv\" run pyenv-sh-activate --quiet\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(venv) \\${PS1:-}\";\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from current version (verbose)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1\n\n  stub pyenv-version-name \"echo venv\"\n  stub pyenv-virtualenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"venv\" run pyenv-sh-activate --verbose\n\n  assert_success\n  assert_output <<EOS\ndeactivated\npyenv-virtualenv: activate venv\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(venv) \\${PS1:-}\";\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from current version (without pyenv-virtualenv-init)\" {\n  export PYENV_VIRTUALENV_INIT=\n\n  stub pyenv-version-name \"echo venv\"\n  stub pyenv-virtualenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"venv\" run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VERSION=\"venv\";\nexport PYENV_ACTIVATE_SHELL=1;\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(venv) \\${PS1:-}\";\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from current version (fish)\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  stub pyenv-version-name \"echo venv\"\n  stub pyenv-virtualenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"fish\" PYENV_VERSION=\"venv\" run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nset -gx PYENV_VIRTUAL_ENV \"${PYENV_ROOT}/versions/venv\";\nset -gx VIRTUAL_ENV \"${PYENV_ROOT}/versions/venv\";\nfunctions -e _pyenv_old_prompt              # remove old prompt function if exists. \n                                            # since everything is in memory, it's safe to\n                                            # remove it.\nfunctions -c fish_prompt _pyenv_old_prompt  # backup old prompt function\n\n# from python-venv\nfunction fish_prompt\n    set -l prompt (_pyenv_old_prompt)       # call old prompt function first since it might \n                                            # read exit status\n    echo -n \"(venv) \"                    # add virtualenv to prompt\n    string join -- \\n \\$prompt              # handle multiline prompts\nend\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from current version (fish) (without pyenv-virtualenv-init)\" {\n  export PYENV_VIRTUALENV_INIT=\n\n  stub pyenv-version-name \"echo venv\"\n  stub pyenv-virtualenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"fish\" PYENV_VERSION=\"venv\" run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nset -gx PYENV_VERSION \"venv\";\nset -gx PYENV_ACTIVATE_SHELL 1;\nset -gx PYENV_VIRTUAL_ENV \"${PYENV_ROOT}/versions/venv\";\nset -gx VIRTUAL_ENV \"${PYENV_ROOT}/versions/venv\";\nfunctions -e _pyenv_old_prompt              # remove old prompt function if exists. \n                                            # since everything is in memory, it's safe to\n                                            # remove it.\nfunctions -c fish_prompt _pyenv_old_prompt  # backup old prompt function\n\n# from python-venv\nfunction fish_prompt\n    set -l prompt (_pyenv_old_prompt)       # call old prompt function first since it might \n                                            # read exit status\n    echo -n \"(venv) \"                    # add virtualenv to prompt\n    string join -- \\n \\$prompt              # handle multiline prompts\nend\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from command-line argument\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  stub pyenv-virtualenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n  stub pyenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"venv\" run pyenv-sh-activate \"venv27\"\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VERSION=\"venv27\";\nexport PYENV_ACTIVATE_SHELL=1;\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv27\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv27\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(venv27) \\${PS1:-}\";\nEOS\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from command-line argument (without pyenv-virtualenv-init)\" {\n  export PYENV_VIRTUALENV_INIT=\n\n  stub pyenv-virtualenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n  stub pyenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"venv\" run pyenv-sh-activate \"venv27\"\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VERSION=\"venv27\";\nexport PYENV_ACTIVATE_SHELL=1;\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv27\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv27\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(venv27) \\${PS1:-}\";\nEOS\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from command-line argument (fish)\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  stub pyenv-virtualenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n  stub pyenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"fish\" PYENV_VERSION=\"venv\" run pyenv-sh-activate \"venv27\"\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nset -gx PYENV_VERSION \"venv27\";\nset -gx PYENV_ACTIVATE_SHELL 1;\nset -gx PYENV_VIRTUAL_ENV \"${PYENV_ROOT}/versions/venv27\";\nset -gx VIRTUAL_ENV \"${PYENV_ROOT}/versions/venv27\";\nfunctions -e _pyenv_old_prompt              # remove old prompt function if exists. \n                                            # since everything is in memory, it's safe to\n                                            # remove it.\nfunctions -c fish_prompt _pyenv_old_prompt  # backup old prompt function\n\n# from python-venv\nfunction fish_prompt\n    set -l prompt (_pyenv_old_prompt)       # call old prompt function first since it might \n                                            # read exit status\n    echo -n \"(venv27) \"                    # add virtualenv to prompt\n    string join -- \\n \\$prompt              # handle multiline prompts\nend\nEOS\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"activate virtualenv from command-line argument (fish) (without pyenv-virtualenv-init)\" {\n  export PYENV_VIRTUALENV_INIT=\n\n  stub pyenv-virtualenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n  stub pyenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"fish\" PYENV_VERSION=\"venv\" run pyenv-sh-activate \"venv27\"\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nset -gx PYENV_VERSION \"venv27\";\nset -gx PYENV_ACTIVATE_SHELL 1;\nset -gx PYENV_VIRTUAL_ENV \"${PYENV_ROOT}/versions/venv27\";\nset -gx VIRTUAL_ENV \"${PYENV_ROOT}/versions/venv27\";\nfunctions -e _pyenv_old_prompt              # remove old prompt function if exists. \n                                            # since everything is in memory, it's safe to\n                                            # remove it.\nfunctions -c fish_prompt _pyenv_old_prompt  # backup old prompt function\n\n# from python-venv\nfunction fish_prompt\n    set -l prompt (_pyenv_old_prompt)       # call old prompt function first since it might \n                                            # read exit status\n    echo -n \"(venv27) \"                    # add virtualenv to prompt\n    string join -- \\n \\$prompt              # handle multiline prompts\nend\nEOS\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n}\n\n@test \"unset invokes deactivate\" {\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=\n\n  stub pyenv-sh-deactivate \" : echo deactivated\"\n\n  run pyenv-sh-activate --unset\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nEOS\n\n  unstub pyenv-sh-deactivate\n}\n\n@test \"should fail if the version is not a virtualenv\" {\n  stub pyenv-virtualenv-prefix \"3.3.3 : false\"\n  stub pyenv-version-name \" : echo 3.3.3\"\n  stub pyenv-virtualenv-prefix \"3.3.3/envs/3.3.3 : false\"\n\n  run pyenv-sh-activate \"3.3.3\"\n\n  assert_failure\n  assert_output <<EOS\npyenv-virtualenv: version \\`3.3.3' is not a virtualenv\nfalse\nEOS\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-version-name\n}\n\n@test \"should fail if the version is not a virtualenv (quiet)\" {\n  stub pyenv-virtualenv-prefix \"3.3.3 : false\"\n  stub pyenv-version-name \" : echo 3.3.3\"\n  stub pyenv-virtualenv-prefix \"3.3.3/envs/3.3.3 : false\"\n\n  run pyenv-sh-activate --quiet \"3.3.3\"\n\n  assert_failure\n  assert_output <<EOS\nfalse\nEOS\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-version-name\n}\n\n@test \"should fail if there are multiple versions\" {\n  stub pyenv-virtualenv-prefix \"venv : true\"\n  stub pyenv-virtualenv-prefix \"venv27 : true\"\n\n  run pyenv-sh-activate \"venv\" \"venv27\"\n\n  assert_failure\n  assert_output <<EOS\npyenv-virtualenv: cannot activate multiple versions at once: venv venv27\nfalse\nEOS\n\n  unstub pyenv-virtualenv-prefix\n}\n\n@test \"should fail if there are multiple virtualenvs (quiet)\" {\n  stub pyenv-virtualenv-prefix \"venv : true\"\n  stub pyenv-virtualenv-prefix \"venv27 : true\"\n\n  run pyenv-sh-activate --quiet \"venv\" \"venv27\"\n\n  assert_failure\n  assert_output <<EOS\nfalse\nEOS\n\n  unstub pyenv-virtualenv-prefix\n}\n\n@test \"should fail if the first version is not a virtualenv\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  stub pyenv-virtualenv-prefix \"2.7.10 : false\"\n  stub pyenv-version-name \" : echo 2.7.10\"\n  stub pyenv-virtualenv-prefix \"2.7.10/envs/2.7.10 : false\"\n\n  run pyenv-sh-activate \"2.7.10\" \"venv27\"\n\n  assert_failure\n  assert_output <<EOS\npyenv-virtualenv: version \\`2.7.10' is not a virtualenv\nfalse\nEOS\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-version-name\n}\n\n@test \"activate if the first virtualenv is a virtualenv\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n  stub pyenv-virtualenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n  stub pyenv-virtualenv-prefix \"2.7.10 : false\"\n  stub pyenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/venv27\\\"\"\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-activate \"venv27\" \"2.7.10\"\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VERSION=\"venv27:2.7.10\";\nexport PYENV_ACTIVATE_SHELL=1;\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv27\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv27\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(venv27) \\${PS1:-}\";\nEOS\n\n  unstub pyenv-sh-deactivate\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n}\n\n@test \"do nothing if a 3rd-party virtualenv is active\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export VIRTUAL_ENV=\"${TMP}/venv-3rd-party\"\n  unset PYENV_VIRTUAL_ENV\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-activate \"venv\"\n\n  assert_success\n  assert_output <<EOS\npyenv-virtualenv: virtualenv \\`${TMP}/venv-3rd-party' is already activated\ntrue\nEOS\n}\n\n@test \"do nothing if a 3rd-party virtualenv is active over ours\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export VIRTUAL_ENV=\"${TMP}/venv-3rd-party\"\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-activate \"venv\"\n\n  assert_success\n  assert_output <<EOS\npyenv-virtualenv: virtualenv \\`${TMP}/venv-3rd-party' is already activated\ntrue\nEOS\n}\n\n@test \"should fail if activate is invoked as a command\" {\n  run pyenv-activate\n\n  assert_failure\n}\n"
  },
  {
    "path": "test/conda-activate.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export HOME=\"${TMP}\"\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n  unset PYENV_VERSION\n  unset PYENV_ACTIVATE_SHELL\n  unset PYENV_VIRTUAL_ENV\n  unset VIRTUAL_ENV\n  unset CONDA_DEFAULT_ENV\n  unset PYTHONHOME\n  unset _OLD_VIRTUAL_PYTHONHOME\n  unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE\n  unset PYENV_VIRTUALENV_DISABLE_PROMPT\n  unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT\n  unset VIRTUAL_ENV_DISABLE_PROMPT\n  unset PYENV_VIRTUALENV_PROMPT\n  unset _OLD_VIRTUAL_PS1\n  stub pyenv-hooks \"activate : echo\"\n}\n\nteardown() {\n  unstub pyenv-hooks\n}\n\n@test \"activate conda root from current version\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  setup_conda \"anaconda-2.3.0\"\n  stub pyenv-version-name \"echo anaconda-2.3.0\"\n  stub pyenv-virtualenv-prefix \"anaconda-2.3.0 : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0\\\"\"\n  stub pyenv-prefix \"anaconda-2.3.0 : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"anaconda-2.3.0\" run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0\";\nexport CONDA_DEFAULT_ENV=\"root\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(anaconda-2.3.0) \\${PS1:-}\";\nexport CONDA_PREFIX=\"${TMP}/pyenv/versions/anaconda-2.3.0\";\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n  teardown_conda \"anaconda-2.3.0\"\n}\n\n@test \"activate conda root from current version with custom prompt\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  setup_conda \"anaconda-2.3.0\"\n  stub pyenv-version-name \"echo anaconda-2.3.0\"\n  stub pyenv-virtualenv-prefix \"anaconda-2.3.0 : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0\\\"\"\n  stub pyenv-prefix \"anaconda-2.3.0 : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"anaconda-2.3.0\" PYENV_VIRTUALENV_PROMPT='venv:{venv}' run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0\";\nexport CONDA_DEFAULT_ENV=\"root\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"venv:anaconda-2.3.0 \\${PS1:-}\";\nexport CONDA_PREFIX=\"${TMP}/pyenv/versions/anaconda-2.3.0\";\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n  teardown_conda \"anaconda-2.3.0\"\n}\n\n@test \"activate conda root from current version (fish)\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  setup_conda \"anaconda-2.3.0\"\n  stub pyenv-version-name \"echo anaconda-2.3.0\"\n  stub pyenv-virtualenv-prefix \"anaconda-2.3.0 : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0\\\"\"\n  stub pyenv-prefix \"anaconda-2.3.0 : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"fish\" PYENV_VERSION=\"anaconda-2.3.0\" run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nset -gx PYENV_VIRTUAL_ENV \"${TMP}/pyenv/versions/anaconda-2.3.0\";\nset -gx VIRTUAL_ENV \"${TMP}/pyenv/versions/anaconda-2.3.0\";\nset -gx CONDA_DEFAULT_ENV \"root\";\nfunctions -e _pyenv_old_prompt              # remove old prompt function if exists. \n                                            # since everything is in memory, it's safe to\n                                            # remove it.\nfunctions -c fish_prompt _pyenv_old_prompt  # backup old prompt function\n\n# from python-venv\nfunction fish_prompt\n    set -l prompt (_pyenv_old_prompt)       # call old prompt function first since it might \n                                            # read exit status\n    echo -n \"(anaconda-2.3.0) \"                    # add virtualenv to prompt\n    string join -- \\n \\$prompt              # handle multiline prompts\nend\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n  teardown_conda \"anaconda-2.3.0\"\n}\n\n@test \"activate conda root from command-line argument\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  setup_conda \"anaconda-2.3.0\"\n  setup_conda \"miniconda-3.9.1\"\n  stub pyenv-virtualenv-prefix \"miniconda-3.9.1 : echo \\\"${PYENV_ROOT}/versions/miniconda-3.9.1\\\"\"\n  stub pyenv-prefix \"miniconda-3.9.1 : echo \\\"${PYENV_ROOT}/versions/miniconda-3.9.1\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"anaconda-2.3.0\" run pyenv-sh-activate \"miniconda-3.9.1\"\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VERSION=\"miniconda-3.9.1\";\nexport PYENV_ACTIVATE_SHELL=1;\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/miniconda-3.9.1\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/miniconda-3.9.1\";\nexport CONDA_DEFAULT_ENV=\"root\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(miniconda-3.9.1) \\${PS1:-}\";\nexport CONDA_PREFIX=\"${TMP}/pyenv/versions/miniconda-3.9.1\";\nEOS\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n  teardown_conda \"anaconda-2.3.0\"\n  teardown_conda \"miniconda-3.9.1\"\n}\n\n@test \"activate conda env from current version\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  setup_conda \"anaconda-2.3.0\" \"foo\"\n  stub pyenv-version-name \"echo anaconda-2.3.0/envs/foo\"\n  stub pyenv-virtualenv-prefix \"anaconda-2.3.0/envs/foo : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\\\"\"\n  stub pyenv-prefix \"anaconda-2.3.0/envs/foo : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"anaconda-2.3.0/envs/foo\" run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\";\nexport CONDA_DEFAULT_ENV=\"foo\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(anaconda-2.3.0/envs/foo) \\${PS1:-}\";\nexport CONDA_PREFIX=\"${TMP}/pyenv/versions/anaconda-2.3.0/envs/foo\";\n. \"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/activate.d/activate.sh\";\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n  teardown_conda \"anaconda-2.3.0\" \"foo\"\n}\n\n@test \"activate conda env from command-line argument\" {\n  export PYENV_VIRTUALENV_INIT=1\n\n  setup_conda \"anaconda-2.3.0\" \"foo\"\n  setup_conda \"miniconda-3.9.1\" \"bar\"\n  stub pyenv-virtualenv-prefix \"miniconda-3.9.1/envs/bar : echo \\\"${PYENV_ROOT}/versions/miniconda-3.9.1\\\"\"\n  stub pyenv-prefix \"miniconda-3.9.1/envs/bar : echo \\\"${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar\\\"\"\n  stub pyenv-sh-deactivate \"--force --quiet : echo deactivated\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"anaconda-2.3.0/envs/foo\" run pyenv-sh-activate \"miniconda-3.9.1/envs/bar\"\n\n  assert_success\n  assert_output <<EOS\ndeactivated\nexport PYENV_VERSION=\"miniconda-3.9.1/envs/bar\";\nexport PYENV_ACTIVATE_SHELL=1;\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar\";\nexport CONDA_DEFAULT_ENV=\"bar\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(miniconda-3.9.1/envs/bar) \\${PS1:-}\";\nexport CONDA_PREFIX=\"${TMP}/pyenv/versions/miniconda-3.9.1/envs/bar\";\n. \"${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar/etc/conda/activate.d/activate.sh\";\nEOS\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-sh-deactivate\n  teardown_conda \"anaconda-2.3.0\" \"foo\"\n  teardown_conda \"miniconda-3.9.1\" \"bar\"\n}\n"
  },
  {
    "path": "test/conda-deactivate.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n  unset PYENV_VERSION\n  unset PYENV_ACTIVATE_SHELL\n  unset PYENV_VIRTUAL_ENV\n  unset VIRTUAL_ENV\n  unset CONDA_DEFAULT_ENV\n  unset PYTHONHOME\n  unset _OLD_VIRTUAL_PYTHONHOME\n  unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE\n  unset PYENV_VIRTUALENV_DISABLE_PROMPT\n  unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT\n  unset VIRTUAL_ENV_DISABLE_PROMPT\n  unset _OLD_VIRTUAL_PS1\n  stub pyenv-hooks \"deactivate : echo\"\n}\n\nteardown() {\n  unstub pyenv-hooks\n}\n\n@test \"deactivate conda root\" {\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0\"\n  export PYENV_ACTIVATE_SHELL=\n  export CONDA_DEFAULT_ENV=\"root\"\n\n  setup_conda \"anaconda-2.3.0\"\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\nunset CONDA_PREFIX\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nunset CONDA_DEFAULT_ENV;\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nEOS\n\n  teardown_conda \"anaconda-2.3.0\"\n}\n\n@test \"deactivate conda root (fish)\" {\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0\"\n  export PYENV_ACTIVATE_SHELL=\n  export CONDA_DEFAULT_ENV=\"root\"\n\n  setup_conda \"anaconda-2.3.0\"\n\n  PYENV_SHELL=\"fish\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\nset -e PYENV_VIRTUAL_ENV;\nset -e VIRTUAL_ENV;\nset -e CONDA_DEFAULT_ENV;\nif [ -n \"\\$_OLD_VIRTUAL_PATH\" ];\n  set -gx PATH \"\\$_OLD_VIRTUAL_PATH\";\n  set -e _OLD_VIRTUAL_PATH;\nend;\nif [ -n \"\\$_OLD_VIRTUAL_PYTHONHOME\" ];\n  set -gx PYTHONHOME \"\\$_OLD_VIRTUAL_PYTHONHOME\";\n  set -e _OLD_VIRTUAL_PYTHONHOME;\nend;\n# check if old prompt function exists\nif functions -q _pyenv_old_prompt\n  # remove old prompt function if exists.\n  functions -e fish_prompt\n  functions -c _pyenv_old_prompt fish_prompt\n  functions -e _pyenv_old_prompt\nend\nif functions -q deactivate;\n  functions -e deactivate;\nend;\nEOS\n\n  teardown_conda \"anaconda-2.3.0\"\n}\n\n@test \"deactivate conda env\" {\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\"\n  export PYENV_ACTIVATE_SHELL=\n  export CONDA_DEFAULT_ENV=\"foo\"\n\n  setup_conda \"anaconda-2.3.0\" \"foo\"\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\n. \"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/deactivate.d/deactivate.sh\";\nunset CONDA_PREFIX\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nunset CONDA_DEFAULT_ENV;\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nEOS\n\n  teardown_conda \"anaconda-2.3.0\" \"foo\"\n}\n"
  },
  {
    "path": "test/conda-prefix.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n}\n\n@test \"display conda root\" {\n  setup_conda \"anaconda-2.3.0\"\n  stub pyenv-version-name \"echo anaconda-2.3.0\"\n  stub pyenv-prefix \"anaconda-2.3.0 : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0\\\"\"\n\n  PYENV_VERSION=\"anaconda-2.3.0\" run pyenv-virtualenv-prefix\n\n  assert_success\n  assert_output <<OUT\n${PYENV_ROOT}/versions/anaconda-2.3.0\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  teardown_conda \"anaconda-2.3.0\"\n}\n\n@test \"display conda env\" {\n  setup_conda \"anaconda-2.3.0\" \"foo\"\n  stub pyenv-version-name \"echo anaconda-2.3.0/envs/foo\"\n  stub pyenv-prefix \"anaconda-2.3.0/envs/foo : echo \\\"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\\\"\"\n\n  PYENV_VERSION=\"anaconda-2.3.0/envs/foo\" run pyenv-virtualenv-prefix\n\n  assert_success\n  assert_output <<OUT\n${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  teardown_conda \"anaconda-2.3.0\" \"foo\"\n}\n"
  },
  {
    "path": "test/conda.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n}\n\nstub_pyenv() {\n  stub pyenv-version-name \"echo \\${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-hooks \"virtualenv : echo\"\n  stub pyenv-rehash \" : echo rehashed\"\n}\n\nunstub_pyenv() {\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  unstub pyenv-hooks\n  unstub pyenv-rehash\n}\n\n@test \"create virtualenv by conda create\" {\n  export PYENV_VERSION=\"miniconda3-3.16.0\"\n  setup_conda \"${PYENV_VERSION}\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub -N pyenv-exec \"conda list * : true\"\n  stub -N pyenv-exec \"conda create * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : true\"\n\n  run pyenv-virtualenv venv\n\n  assert_success\n  assert_output_wildcards <<OUT\nPYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes --file /dev/fd/*\nrehashed\nOUT\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"miniconda3-3.16.0\"\n}\n\n@test \"create virtualenv by conda create with -p\" {\n  export PYENV_VERSION=\"miniconda3-3.16.0\"\n  setup_conda \"${PYENV_VERSION}\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-exec \"conda create * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : true\"\n\n  run pyenv-virtualenv -p python3.5 venv\n  \n  assert_success\n  assert_output <<OUT\nPYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5\nrehashed\nOUT\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"miniconda3-3.16.0\"\n}\n\n@test \"create virtualenv by conda create with --python\" {\n  export PYENV_VERSION=\"miniconda3-3.16.0\"\n  setup_conda \"${PYENV_VERSION}\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-exec \"conda create * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : true\"\n\n  run pyenv-virtualenv --python=python3.5 venv\n\n  assert_success\n  assert_output <<OUT\nPYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5\nrehashed\nOUT\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"miniconda3-3.16.0\"\n}\n"
  },
  {
    "path": "test/deactivate.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n  unset PYENV_VERSION\n  unset PYENV_ACTIVATE_SHELL\n  unset PYENV_VIRTUAL_ENV\n  unset VIRTUAL_ENV\n  unset CONDA_DEFAULT_ENV\n  unset PYTHONHOME\n  unset _OLD_VIRTUAL_PYTHONHOME\n  unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE\n  unset PYENV_VIRTUALENV_DISABLE_PROMPT\n  unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT\n  unset VIRTUAL_ENV_DISABLE_PROMPT\n  unset _OLD_VIRTUAL_PS1\n  stub pyenv-hooks \"deactivate : echo\"\n}\n\n@test \"deactivate virtualenv\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nEOS\n}\n\n@test \"deactivate virtualenv (quiet)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-deactivate --quiet\n\n  assert_success\n  assert_output <<EOS\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nEOS\n}\n\n@test \"deactivate virtualenv (verbose)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=\n  export PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-deactivate --verbose\n\n  assert_success\n  assert_output <<EOS\npyenv-virtualenv: deactivate venv\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nEOS\n}\n\n@test \"deactivate virtualenv (with shell activation)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=1\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\nunset PYENV_VERSION;\nunset PYENV_ACTIVATE_SHELL;\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nEOS\n}\n\n@test \"deactivate virtualenv (with shell activation) (quiet)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=1\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-deactivate --quiet\n\n  assert_success\n  assert_output <<EOS\nunset PYENV_VERSION;\nunset PYENV_ACTIVATE_SHELL;\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nEOS\n}\n\n@test \"deactivate virtualenv which has been activated manually\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nEOS\n}\n\n@test \"deactivate virtualenv (fish)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=\n\n  PYENV_SHELL=\"fish\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\nset -e PYENV_VIRTUAL_ENV;\nset -e VIRTUAL_ENV;\nif [ -n \"\\$_OLD_VIRTUAL_PATH\" ];\n  set -gx PATH \"\\$_OLD_VIRTUAL_PATH\";\n  set -e _OLD_VIRTUAL_PATH;\nend;\nif [ -n \"\\$_OLD_VIRTUAL_PYTHONHOME\" ];\n  set -gx PYTHONHOME \"\\$_OLD_VIRTUAL_PYTHONHOME\";\n  set -e _OLD_VIRTUAL_PYTHONHOME;\nend;\n# check if old prompt function exists\nif functions -q _pyenv_old_prompt\n  # remove old prompt function if exists.\n  functions -e fish_prompt\n  functions -c _pyenv_old_prompt fish_prompt\n  functions -e _pyenv_old_prompt\nend\nif functions -q deactivate;\n  functions -e deactivate;\nend;\nEOS\n}\n\n@test \"deactivate virtualenv (fish) (quiet)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=\n\n  PYENV_SHELL=\"fish\" run pyenv-sh-deactivate --quiet\n\n  assert_success\n  assert_output <<EOS\nset -e PYENV_VIRTUAL_ENV;\nset -e VIRTUAL_ENV;\nif [ -n \"\\$_OLD_VIRTUAL_PATH\" ];\n  set -gx PATH \"\\$_OLD_VIRTUAL_PATH\";\n  set -e _OLD_VIRTUAL_PATH;\nend;\nif [ -n \"\\$_OLD_VIRTUAL_PYTHONHOME\" ];\n  set -gx PYTHONHOME \"\\$_OLD_VIRTUAL_PYTHONHOME\";\n  set -e _OLD_VIRTUAL_PYTHONHOME;\nend;\n# check if old prompt function exists\nif functions -q _pyenv_old_prompt\n  # remove old prompt function if exists.\n  functions -e fish_prompt\n  functions -c _pyenv_old_prompt fish_prompt\n  functions -e _pyenv_old_prompt\nend\nif functions -q deactivate;\n  functions -e deactivate;\nend;\nEOS\n}\n\n@test \"deactivate virtualenv (fish) (with shell activation)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=1\n\n  PYENV_SHELL=\"fish\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\nset -e PYENV_VERSION;\nset -e PYENV_ACTIVATE_SHELL;\nset -e PYENV_VIRTUAL_ENV;\nset -e VIRTUAL_ENV;\nif [ -n \"\\$_OLD_VIRTUAL_PATH\" ];\n  set -gx PATH \"\\$_OLD_VIRTUAL_PATH\";\n  set -e _OLD_VIRTUAL_PATH;\nend;\nif [ -n \"\\$_OLD_VIRTUAL_PYTHONHOME\" ];\n  set -gx PYTHONHOME \"\\$_OLD_VIRTUAL_PYTHONHOME\";\n  set -e _OLD_VIRTUAL_PYTHONHOME;\nend;\n# check if old prompt function exists\nif functions -q _pyenv_old_prompt\n  # remove old prompt function if exists.\n  functions -e fish_prompt\n  functions -c _pyenv_old_prompt fish_prompt\n  functions -e _pyenv_old_prompt\nend\nif functions -q deactivate;\n  functions -e deactivate;\nend;\nEOS\n}\n\n@test \"deactivate virtualenv (fish) (with shell activation) (quiet)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=1\n\n  PYENV_SHELL=\"fish\" run pyenv-sh-deactivate --quiet\n\n  assert_success\n  assert_output <<EOS\nset -e PYENV_VERSION;\nset -e PYENV_ACTIVATE_SHELL;\nset -e PYENV_VIRTUAL_ENV;\nset -e VIRTUAL_ENV;\nif [ -n \"\\$_OLD_VIRTUAL_PATH\" ];\n  set -gx PATH \"\\$_OLD_VIRTUAL_PATH\";\n  set -e _OLD_VIRTUAL_PATH;\nend;\nif [ -n \"\\$_OLD_VIRTUAL_PYTHONHOME\" ];\n  set -gx PYTHONHOME \"\\$_OLD_VIRTUAL_PYTHONHOME\";\n  set -e _OLD_VIRTUAL_PYTHONHOME;\nend;\n# check if old prompt function exists\nif functions -q _pyenv_old_prompt\n  # remove old prompt function if exists.\n  functions -e fish_prompt\n  functions -c _pyenv_old_prompt fish_prompt\n  functions -e _pyenv_old_prompt\nend\nif functions -q deactivate;\n  functions -e deactivate;\nend;\nEOS\n}\n\n@test \"deactivate virtualenv which has been activated manually (fish)\" {\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=\n\n  PYENV_SHELL=\"fish\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\nset -e PYENV_VIRTUAL_ENV;\nset -e VIRTUAL_ENV;\nif [ -n \"\\$_OLD_VIRTUAL_PATH\" ];\n  set -gx PATH \"\\$_OLD_VIRTUAL_PATH\";\n  set -e _OLD_VIRTUAL_PATH;\nend;\nif [ -n \"\\$_OLD_VIRTUAL_PYTHONHOME\" ];\n  set -gx PYTHONHOME \"\\$_OLD_VIRTUAL_PYTHONHOME\";\n  set -e _OLD_VIRTUAL_PYTHONHOME;\nend;\n# check if old prompt function exists\nif functions -q _pyenv_old_prompt\n  # remove old prompt function if exists.\n  functions -e fish_prompt\n  functions -c _pyenv_old_prompt fish_prompt\n  functions -e _pyenv_old_prompt\nend\nif functions -q deactivate;\n  functions -e deactivate;\nend;\nEOS\n}\n\n@test \"should fail if deactivate is invoked as a command\" {\n  run pyenv-deactivate\n\n  assert_failure\n}\n"
  },
  {
    "path": "test/delete.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n}\n\n@test \"delete virtualenv\" {\n  mkdir -p \"${PYENV_ROOT}/versions/venv27\"\n\n  stub pyenv-virtualenv-prefix \"venv27 : true\"\n  stub pyenv-rehash \"true\"\n\n  run pyenv-virtualenv-delete -f \"venv27\"\n\n  assert_success\n\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-rehash\n\n  [ ! -d \"${PYENV_ROOT}/versions/venv27\" ]\n}\n\n@test \"delete virtualenv by symlink\" {\n  mkdir -p \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\"\n  ln -fs \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\" \"${PYENV_ROOT}/versions/venv27\"\n\n  stub pyenv-rehash \"true\"\n\n  run pyenv-virtualenv-delete -f \"venv27\"\n\n  assert_success\n\n  unstub pyenv-rehash\n\n  [ ! -d \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\" ]\n  [ ! -L \"${PYENV_ROOT}/versions/venv27\" ]\n}\n\n@test \"delete virtualenv with symlink\" {\n  mkdir -p \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\"\n  ln -fs \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\" \"${PYENV_ROOT}/versions/venv27\"\n\n  stub pyenv-rehash \"true\"\n\n  run pyenv-virtualenv-delete -f \"2.7.11/envs/venv27\"\n\n  assert_success\n\n  unstub pyenv-rehash\n\n  [ ! -d \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\" ]\n  [ ! -L \"${PYENV_ROOT}/versions/venv27\" ]\n}\n\n@test \"not delete virtualenv with different symlink\" {\n  mkdir -p \"${PYENV_ROOT}/versions/2.7.8/envs/venv27\"\n  mkdir -p \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\"\n  ln -fs \"${PYENV_ROOT}/versions/2.7.8/envs/venv27\" \"${PYENV_ROOT}/versions/venv27\"\n\n  stub pyenv-rehash \"true\"\n\n  run pyenv-virtualenv-delete -f \"2.7.11/envs/venv27\"\n\n  assert_success\n\n  unstub pyenv-rehash\n\n  [ ! -d \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\" ]\n  [ -L \"${PYENV_ROOT}/versions/venv27\" ]\n}\n\n@test \"not delete virtualenv with same name\" {\n  mkdir -p \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\"\n  mkdir -p \"${PYENV_ROOT}/versions/venv27\"\n\n  stub pyenv-rehash \"true\"\n\n  run pyenv-virtualenv-delete -f \"2.7.11/envs/venv27\"\n\n  assert_success\n\n  unstub pyenv-rehash\n\n  [ ! -d \"${PYENV_ROOT}/versions/2.7.11/envs/venv27\" ]\n  [ -d \"${PYENV_ROOT}/versions/venv27\" ]\n}\n"
  },
  {
    "path": "test/envs.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/envs/pyenv\"\n}\n\nstub_pyenv() {\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-hooks \"virtualenv : echo\"\n  stub pyenv-rehash \" : echo rehashed\"\n}\n\nunstub_pyenv() {\n  unstub pyenv-prefix\n  unstub pyenv-hooks\n  unstub pyenv-rehash\n}\n\n@test \"path should be handled properly even if there is 'envs' in PYENV_ROOT\" {\n  export PYENV_VERSION=\"3.5.1\"\n  setup_m_venv \"3.5.1\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-version-name \"echo '${PYENV_VERSION}'\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : true\"\n  stub pyenv-exec \"python -m venv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\";mkdir -p \\${PYENV_ROOT}/versions/3.5.1/envs/venv/bin\"\n  stub pyenv-exec \"python -s -m ensurepip : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\";touch \\${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pip\"\n\n  run pyenv-virtualenv venv\n\n  assert_success\n  assert_output <<OUT\nPYENV_VERSION=3.5.1 python -m venv ${PYENV_ROOT}/versions/3.5.1/envs/venv\nPYENV_VERSION=3.5.1/envs/venv python -s -m ensurepip\nrehashed\nOUT\n  assert [ -e \"${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pip\" ]\n\n  unstub_pyenv\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"3.5.1\"\n}\n"
  },
  {
    "path": "test/hooks.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n  export HOOK_PATH=\"${TMP}/i has hooks\"\n  mkdir -p \"$HOOK_PATH\"\n  unset PYENV_VIRTUALENV_PROMPT\n}\n\n@test \"pyenv-virtualenv hooks\" {\n  cat > \"${HOOK_PATH}/virtualenv.bash\" <<OUT\nbefore_virtualenv 'echo before: \\$VIRTUALENV_PATH'\nafter_virtualenv 'echo after: \\$STATUS'\nOUT\n  setup_version \"3.5.1\"\n  create_executable \"3.5.1\" \"virtualenv\"\n  stub pyenv-prefix \"echo '${PYENV_ROOT}/versions/3.5.1'\"\n  stub pyenv-prefix \"echo '${PYENV_ROOT}/versions/3.5.1'\"\n  stub pyenv-exec \"python -m venv --help : true\"\n  stub pyenv-hooks \"virtualenv : echo '$HOOK_PATH'/virtualenv.bash\"\n  stub pyenv-exec \"echo PYENV_VERSION=3.5.1 \\\"\\$@\\\"\"\n  stub pyenv-exec \"echo PYENV_VERSION=3.5.1 \\\"\\$@\\\"\"\n  stub pyenv-rehash \"echo rehashed\"\n\n  run pyenv-virtualenv \"3.5.1\" venv\n\n  assert_success\n  assert_output <<-OUT\nbefore: ${PYENV_ROOT}/versions/3.5.1/envs/venv\nPYENV_VERSION=3.5.1 virtualenv ${PYENV_ROOT}/versions/3.5.1/envs/venv\nPYENV_VERSION=3.5.1 python -s -m ensurepip\nafter: 0\nrehashed\nOUT\n\n  unstub pyenv-prefix\n  unstub pyenv-hooks\n  unstub pyenv-exec\n  unstub pyenv-rehash\n  teardown_version \"3.5.1\"\n}\n\n@test \"pyenv-sh-activate hooks\" {\n  cat > \"${HOOK_PATH}/activate.bash\" <<OUT\nbefore_activate 'echo \"before\"'\nafter_activate 'echo \"after\"'\nOUT\n  export PYENV_VIRTUALENV_INIT=1\n\n  stub pyenv-version-name \"echo venv\"\n  stub pyenv-virtualenv-prefix \"\"\n  stub pyenv-prefix \"venv : echo \\\"${PYENV_ROOT}/versions/venv\\\"\"\n  stub pyenv-hooks \"activate : echo '$HOOK_PATH'/activate.bash\"\n  stub pyenv-sh-deactivate \"\"\n\n  PYENV_SHELL=\"bash\" PYENV_VERSION=\"venv\" run pyenv-sh-activate\n\n  assert_success\n  assert_output <<EOS\nbefore\nexport PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\";\nexport _OLD_VIRTUAL_PS1=\"\\${PS1:-}\";\nexport PS1=\"(venv) \\${PS1:-}\";\nafter\nEOS\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-prefix\n  unstub pyenv-hooks\n  unstub pyenv-sh-deactivate\n}\n\n@test \"deactivate virtualenv\" {\n  cat > \"${HOOK_PATH}/deactivate.bash\" <<OUT\nbefore_deactivate 'echo \"before\"'\nafter_deactivate 'echo \"after\"'\nOUT\n  export PYENV_VIRTUALENV_INIT=1\n  export PYENV_VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export VIRTUAL_ENV=\"${PYENV_ROOT}/versions/venv\"\n  export PYENV_ACTIVATE_SHELL=\n  stub pyenv-hooks \"deactivate : echo '$HOOK_PATH'/deactivate.bash\"\n\n  PYENV_SHELL=\"bash\" run pyenv-sh-deactivate\n\n  assert_success\n  assert_output <<EOS\nbefore\nunset PYENV_VIRTUAL_ENV;\nunset VIRTUAL_ENV;\nif [ -n \"\\${_OLD_VIRTUAL_PATH:-}\" ]; then\n  export PATH=\"\\${_OLD_VIRTUAL_PATH}\";\n  unset _OLD_VIRTUAL_PATH;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PYTHONHOME:-}\" ]; then\n  export PYTHONHOME=\"\\${_OLD_VIRTUAL_PYTHONHOME}\";\n  unset _OLD_VIRTUAL_PYTHONHOME;\nfi;\nif [ -n \"\\${_OLD_VIRTUAL_PS1:-}\" ]; then\n  export PS1=\"\\${_OLD_VIRTUAL_PS1}\";\n  unset _OLD_VIRTUAL_PS1;\nfi;\nif declare -f deactivate 1>/dev/null 2>&1; then\n  unset -f deactivate;\nfi;\nafter\nEOS\n\n  unstub pyenv-hooks\n}\n"
  },
  {
    "path": "test/init.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\n@test \"detect parent shell\" {\n  unset PYENV_SHELL\n  SHELL=/bin/false run pyenv-virtualenv-init -\n  assert_success\n  assert_output_contains '  PROMPT_COMMAND=\"_pyenv_virtualenv_hook;${PROMPT_COMMAND-}\"'\n}\n\n@test \"detect parent shell from script (sh)\" {\n  unset PYENV_SHELL\n  printf '#!/bin/sh\\necho \"$(pyenv-virtualenv-init -)\"' > \"${TMP}/script.sh\"\n  chmod +x ${TMP}/script.sh\n  run ${TMP}/script.sh\n  assert_success\n  assert_output_contains_not '  PROMPT_COMMAND=\"_pyenv_virtualenv_hook;${PROMPT_COMMAND-}\"'\n  rm -f \"${TMP}/script.sh\"\n}\n\n@test \"detect parent shell from script (bash)\" {\n  unset PYENV_SHELL\n  printf '#!/bin/bash\\necho \"$(pyenv-virtualenv-init -)\"' > \"${TMP}/script.sh\"\n  chmod +x ${TMP}/script.sh\n  run ${TMP}/script.sh\n  assert_success\n  assert_output_contains '  PROMPT_COMMAND=\"_pyenv_virtualenv_hook;${PROMPT_COMMAND-}\"'\n  rm -f \"${TMP}/script.sh\"\n}\n\n@test \"sh-compatible instructions\" {\n  run pyenv-virtualenv-init bash\n  assert [ \"$status\" -eq 1 ]\n  assert_output_contains 'eval \"$(pyenv virtualenv-init -)\"'\n\n  run pyenv-virtualenv-init zsh\n  assert [ \"$status\" -eq 1 ]\n  assert_output_contains 'eval \"$(pyenv virtualenv-init -)\"'\n}\n\n@test \"fish instructions\" {\n  run pyenv-virtualenv-init fish\n  assert [ \"$status\" -eq 1 ]\n  assert_output_contains 'status --is-interactive; and source (pyenv virtualenv-init -|psub)'\n}\n\n@test \"outputs bash-specific syntax\" {\n  export PYENV_VIRTUALENV_ROOT=\"${TMP}/pyenv/plugins/pyenv-virtualenv\"\n  run pyenv-virtualenv-init - bash\n  assert_success\n  assert_output <<EOS\nexport PATH=\"${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\\${PATH}\";\nexport PYENV_VIRTUALENV_INIT=1;\n_pyenv_virtualenv_hook() {\n  local ret=\\$?\n  if [ -n \"\\${VIRTUAL_ENV-}\" ]; then\n    eval \"\\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)\" || true\n  else\n    eval \"\\$(pyenv sh-activate --quiet || true)\" || true\n  fi\n  return \\$ret\n};\nif ! [[ \"\\${PROMPT_COMMAND-}\" =~ _pyenv_virtualenv_hook ]]; then\n  PROMPT_COMMAND=\"_pyenv_virtualenv_hook;\\${PROMPT_COMMAND-}\"\nfi\nEOS\n}\n\n@test \"outputs fish-specific syntax\" {\n  export PYENV_VIRTUALENV_ROOT=\"${TMP}/pyenv/plugins/pyenv-virtualenv\"\n  run pyenv-virtualenv-init - fish\n  assert_success\n  assert_output <<EOS\nwhile set index (contains -i -- \"${TMP}/pyenv/plugins/pyenv-virtualenv/shims\" \\$PATH)\nset -eg PATH[\\$index]; end; set -e index\nset -gx PATH '${TMP}/pyenv/plugins/pyenv-virtualenv/shims' \\$PATH;\nset -gx PYENV_VIRTUALENV_INIT 1;\nfunction _pyenv_virtualenv_hook --on-event fish_prompt;\n  set -l ret \\$status\n  if [ -n \"\\$VIRTUAL_ENV\" ]\n    pyenv activate --quiet; or pyenv deactivate --quiet; or true\n  else\n    pyenv activate --quiet; or true\n  end\n  return \\$ret\nend\nEOS\n}\n\n@test \"outputs zsh-specific syntax\" {\n  export PYENV_VIRTUALENV_ROOT=\"${TMP}/pyenv/plugins/pyenv-virtualenv\"\n  run pyenv-virtualenv-init - zsh\n  assert_success\n  assert_output <<EOS\nexport PATH=\"${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\\${PATH}\";\nexport PYENV_VIRTUALENV_INIT=1;\n_pyenv_virtualenv_hook() {\n  local ret=\\$?\n  if [ -n \"\\${VIRTUAL_ENV-}\" ]; then\n    eval \"\\$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)\" || true\n  else\n    eval \"\\$(pyenv sh-activate --quiet || true)\" || true\n  fi\n  return \\$ret\n};\ntypeset -g -a precmd_functions\nif [[ -z \\$precmd_functions[(r)_pyenv_virtualenv_hook] ]]; then\n  precmd_functions=(_pyenv_virtualenv_hook \\$precmd_functions);\nfi\nEOS\n}\n"
  },
  {
    "path": "test/installer.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\n@test \"installs pyenv-virtualenv into PREFIX\" {\n  cd \"$TMP\"\n  PREFIX=\"${PWD}/usr\" run \"${BATS_TEST_DIRNAME}/../install.sh\"\n  assert_success \"\"\n\n  cd usr\n\n  assert [ -x bin/pyenv-activate ]\n  assert [ -x bin/pyenv-deactivate ]\n  assert [ -x bin/pyenv-sh-activate ]\n  assert [ -x bin/pyenv-sh-deactivate ]\n  assert [ -x bin/pyenv-virtualenv ]\n  assert [ -x bin/pyenv-virtualenv-init ]\n  assert [ -x bin/pyenv-virtualenv-prefix ]\n  assert [ -x bin/pyenv-virtualenvs ]\n}\n\n@test \"overwrites old installation\" {\n  cd \"$TMP\"\n  mkdir -p bin\n  touch bin/pyenv-virtualenv\n\n  PREFIX=\"$PWD\" run \"${BATS_TEST_DIRNAME}/../install.sh\"\n  assert_success \"\"\n\n  assert [ -x bin/pyenv-virtualenv ]\n  run grep \"virtualenv\" bin/pyenv-virtualenv\n  assert_success\n}\n\n@test \"unrelated files are untouched\" {\n  cd \"$TMP\"\n  mkdir -p bin share/bananas\n  chmod g-w bin\n  touch bin/bananas\n\n  PREFIX=\"$PWD\" run \"${BATS_TEST_DIRNAME}/../install.sh\"\n  assert_success \"\"\n\n  assert [ -e bin/bananas ]\n\n  run ls -ld bin\n  assert_equal \"r-x\" \"${output:4:3}\"\n}\n"
  },
  {
    "path": "test/pip.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n}\n\nstub_pyenv() {\n  stub pyenv-version-name \"echo \\${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-hooks \"virtualenv : echo\"\n  stub pyenv-rehash \" : echo rehashed\"\n}\n\nunstub_pyenv() {\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  unstub pyenv-hooks\n  unstub pyenv-rehash\n}\n\n@test \"install pip with ensurepip\" {\n  export PYENV_VERSION=\"3.5.1\"\n  setup_m_venv \"3.5.1\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : true\"\n  stub pyenv-exec \"python -m venv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\";mkdir -p \\${PYENV_ROOT}/versions/3.5.1/envs/venv/bin\"\n  stub pyenv-exec \"python -s -m ensurepip : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\";touch \\${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pip\"\n\n  run pyenv-virtualenv venv\n\n  assert_success\n\n  assert_output <<OUT\nPYENV_VERSION=3.5.1 python -m venv ${TMP}/pyenv/versions/3.5.1/envs/venv\nPYENV_VERSION=3.5.1/envs/venv python -s -m ensurepip\nrehashed\nOUT\n  assert [ -e \"${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pip\" ]\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"3.5.1\"\n}\n\n@test \"install pip without using ensurepip\" {\n  export PYENV_VERSION=\"3.3.6\"\n  setup_m_venv \"3.3.6\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : true\"\n  stub pyenv-exec \"python -m venv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\";mkdir -p \\${PYENV_ROOT}/versions/3.3.6/envs/venv/bin\"\n  stub pyenv-exec \"python -s -m ensurepip : false\"\n  stub pyenv-exec \"python -s */get-pip.py : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\";touch \\${PYENV_ROOT}/versions/3.3.6/envs/venv/bin/pip\"\n  stub curl true\n\n  run pyenv-virtualenv venv\n\n  assert_success\n  assert_output <<OUT\nPYENV_VERSION=3.3.6 python -m venv ${PYENV_ROOT}/versions/3.3.6/envs/venv\nInstalling pip from https://bootstrap.pypa.io/pip/3.3/get-pip.py...\nPYENV_VERSION=3.3.6/envs/venv python -s ${TMP}/pyenv/cache/get-pip.py\nrehashed\nOUT\n  assert [ -e \"${PYENV_ROOT}/versions/3.3.6/envs/venv/bin/pip\" ]\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"3.3.6\"\n}\n"
  },
  {
    "path": "test/prefix.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n}\n\ncreate_version() {\n  mkdir -p \"${PYENV_ROOT}/versions/$1/bin\"\n  touch \"${PYENV_ROOT}/versions/$1/bin/python\"\n  chmod +x \"${PYENV_ROOT}/versions/$1/bin/python\"\n}\n\nremove_version() {\n  rm -fr \"${PYENV_ROOT}/versions/$1\"\n}\n\ncreate_virtualenv() {\n  create_version \"$1\"\n  create_version \"${2:-$1}\"\n  mkdir -p \"${PYENV_ROOT}/versions/$1/lib/python${2:-$1}\"\n  echo \"${PYENV_ROOT}/versions/${2:-$1}\" > \"${PYENV_ROOT}/versions/$1/lib/python${2:-$1}/orig-prefix.txt\"\n  touch \"${PYENV_ROOT}/versions/$1/bin/activate\"\n}\n\ncreate_virtualenv_jython() {\n  create_version \"$1\"\n  create_version \"${2:-$1}\"\n  mkdir -p \"${PYENV_ROOT}/versions/$1/Lib/\"\n  echo \"${PYENV_ROOT}/versions/${2:-$1}\" > \"${PYENV_ROOT}/versions/$1/Lib/orig-prefix.txt\"\n  touch \"${PYENV_ROOT}/versions/$1/bin/activate\"\n}\n\ncreate_virtualenv_pypy() {\n  create_version \"$1\"\n  create_version \"${2:-$1}\"\n  mkdir -p \"${PYENV_ROOT}/versions/$1/lib-python/${2:-$1}\"\n  echo \"${PYENV_ROOT}/versions/${2:-$1}\" > \"${PYENV_ROOT}/versions/$1/lib-python/${2:-$1}/orig-prefix.txt\"\n  touch \"${PYENV_ROOT}/versions/$1/bin/activate\"\n}\n\nremove_virtualenv() {\n  remove_version \"$1\"\n  remove_version \"${2:-$1}\"\n}\n\ncreate_m_venv() {\n  create_version \"$1\"\n  create_version \"${2:-$1}\"\n  echo \"home = ${PYENV_ROOT}/versions/${2:-$1}/bin\" > \"${PYENV_ROOT}/versions/$1/pyvenv.cfg\"\n  touch \"${PYENV_ROOT}/versions/$1/bin/activate\"\n}\n\nremove_m_venv() {\n  remove_version \"${2:-$1}\"\n}\n\ncreate_conda() {\n  create_version \"$1\"\n  create_version \"${2:-$1}\"\n  touch \"${PYENV_ROOT}/versions/$1/bin/conda\"\n  touch \"${PYENV_ROOT}/versions/$1/bin/activate\"\n  mkdir -p \"${PYENV_ROOT}/versions/${2:-$1}/bin\"\n  touch \"${PYENV_ROOT}/versions/${2:-$1}/bin/conda\"\n  touch \"${PYENV_ROOT}/versions/${2:-$1}/bin/activate\"\n}\n\nremove_conda() {\n  remove_version \"${2:-$1}\"\n}\n\n@test \"display prefix of virtualenv created by virtualenv\" {\n  stub pyenv-version-name \"echo foo\"\n  stub pyenv-prefix \"foo : echo \\\"${PYENV_ROOT}/versions/foo\\\"\"\n  create_virtualenv \"foo\" \"2.7.11\"\n\n  PYENV_VERSION=\"foo\" run pyenv-virtualenv-prefix\n\n  assert_success\n  assert_output <<OUT\n${PYENV_ROOT}/versions/2.7.11\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  remove_virtualenv \"foo\" \"2.7.11\"\n}\n\n@test \"display prefix of virtualenv created by virtualenv (pypy)\" {\n  stub pyenv-version-name \"echo foo\"\n  stub pyenv-prefix \"foo : echo \\\"${PYENV_ROOT}/versions/foo\\\"\"\n  create_virtualenv_pypy \"foo\" \"pypy-4.0.1\"\n\n  PYENV_VERSION=\"foo\" run pyenv-virtualenv-prefix\n\n  assert_success\n  assert_output <<OUT\n${PYENV_ROOT}/versions/pypy-4.0.1\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  remove_virtualenv \"foo\" \"pypy-4.0.1\"\n}\n\n@test \"display prefix of virtualenv created by virtualenv (jython)\" {\n  stub pyenv-version-name \"echo foo\"\n  stub pyenv-prefix \"foo : echo \\\"${PYENV_ROOT}/versions/foo\\\"\"\n  create_virtualenv_jython \"foo\" \"jython-2.7.0\"\n\n  PYENV_VERSION=\"foo\" run pyenv-virtualenv-prefix\n\n  assert_success\n  assert_output <<OUT\n${PYENV_ROOT}/versions/jython-2.7.0\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  remove_virtualenv \"foo\" \"jython-2.7.0\"\n}\n\n@test \"display prefixes of virtualenv created by virtualenv\" {\n  stub pyenv-version-name \"echo foo:bar\"\n  stub pyenv-prefix \"foo : echo \\\"${PYENV_ROOT}/versions/foo\\\"\" \\\n                    \"bar : echo \\\"${PYENV_ROOT}/versions/bar\\\"\"\n  create_virtualenv \"foo\" \"2.7.11\"\n  create_virtualenv \"bar\" \"3.5.1\"\n\n  PYENV_VERSION=\"foo:bar\" run pyenv-virtualenv-prefix\n\n  assert_success\n  assert_output <<OUT\n${PYENV_ROOT}/versions/2.7.11:${PYENV_ROOT}/versions/3.5.1\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  remove_virtualenv \"foo\" \"2.7.11\"\n  remove_virtualenv \"bar\" \"3.5.1\"\n}\n\n@test \"display prefix of virtualenv created by venv\" {\n  stub pyenv-version-name \"echo foo\"\n  stub pyenv-prefix \"foo : echo \\\"${PYENV_ROOT}/versions/foo\\\"\"\n  create_m_venv \"foo\" \"3.3.6\"\n\n  PYENV_VERSION=\"foo\" run pyenv-virtualenv-prefix\n\n  assert_success\n  assert_output <<OUT\n${PYENV_ROOT}/versions/3.3.6\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  remove_m_venv \"foo\" \"3.3.6\"\n}\n\n@test \"display prefixes of virtualenv created by venv\" {\n  stub pyenv-version-name \"echo foo:bar\"\n  stub pyenv-prefix \"foo : echo \\\"${PYENV_ROOT}/versions/foo\\\"\" \\\n                    \"bar : echo \\\"${PYENV_ROOT}/versions/bar\\\"\"\n  create_m_venv \"foo\" \"3.3.6\"\n  create_m_venv \"bar\" \"3.4.4\"\n\n  PYENV_VERSION=\"foo:bar\" run pyenv-virtualenv-prefix\n\n  assert_success\n  assert_output <<OUT\n${PYENV_ROOT}/versions/3.3.6:${PYENV_ROOT}/versions/3.4.4\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  remove_m_venv \"foo\" \"3.3.6\"\n  remove_m_venv \"bar\" \"3.4.4\"\n}\n\n@test \"display prefix of virtualenv created by conda\" {\n  stub pyenv-version-name \"echo miniconda3-3.16.0/envs/foo\"\n  stub pyenv-prefix \"miniconda3-3.16.0/envs/foo : echo \\\"${PYENV_ROOT}/versions/miniconda3-3.16.0/envs/foo\\\"\"\n  create_conda \"miniconda3-3.16.0/envs/foo\" \"miniconda3-3.16.0\"\n\n  PYENV_VERSION=\"miniconda3-3.16.0/envs/foo\" run pyenv-virtualenv-prefix\n\n  assert_success\n  assert_output <<OUT\n${PYENV_ROOT}/versions/miniconda3-3.16.0/envs/foo\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  remove_conda \"miniconda3-3.16.0/envs/foo\" \"miniconda3-3.16.0\"\n}\n\n@test \"should fail if the version is the system\" {\n  stub pyenv-version-name \"echo system\"\n\n  PYENV_VERSION=\"system\" run pyenv-virtualenv-prefix\n\n  assert_failure\n  assert_output <<OUT\npyenv-virtualenv: version \\`system' is not a virtualenv\nOUT\n\n  unstub pyenv-version-name\n}\n\n@test \"should fail if the version is not a virtualenv\" {\n  stub pyenv-version-name \"echo 3.4.4\"\n  stub pyenv-prefix \"3.4.4 : echo \\\"${PYENV_ROOT}/versions/3.4.4\\\"\"\n  create_version \"3.4.4\"\n\n  PYENV_VERSION=\"3.4.4\" run pyenv-virtualenv-prefix\n\n  assert_failure\n  assert_output <<OUT\npyenv-virtualenv: version \\`3.4.4' is not a virtualenv\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  remove_version \"3.4.4\"\n}\n\n@test \"should fail if one of the versions is not a virtualenv\" {\n  stub pyenv-version-name \"echo venv33:3.4.4\"\n  stub pyenv-prefix \"venv33 : echo \\\"${PYENV_ROOT}/versions/venv33\\\"\" \\\n                    \"3.4.4 : echo \\\"${PYENV_ROOT}/versions/3.4.4\\\"\"\n  create_virtualenv \"venv33\" \"3.3.6\"\n  create_version \"3.4.4\"\n\n  PYENV_VERSION=\"venv33:3.4.4\" run pyenv-virtualenv-prefix\n\n  assert_failure\n  assert_output <<OUT\npyenv-virtualenv: version \\`3.4.4' is not a virtualenv\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  remove_virtualenv \"venv33\" \"3.3.6\"\n  remove_version \"3.4.4\"\n}\n"
  },
  {
    "path": "test/python.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n  export PYENV_VERSION=\"2.7.8\"\n  setup_version \"2.7.8\"\n  create_executable \"2.7.8\" \"virtualenv\"\n  stub pyenv-prefix \"echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-prefix \"echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-prefix \"echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-hooks \"virtualenv : echo\"\n  stub pyenv-rehash \" : true\"\n  stub pyenv-version-name \"echo \\${PYENV_VERSION}\"\n  stub curl true\n  stub python-build \"echo python2.7\"\n}\n\nteardown() {\n  unstub curl\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  unstub pyenv-hooks\n  unstub pyenv-rehash\n  unstub python-build\n  teardown_version \"2.7.8\"\n  rm -fr \"$TMP\"/*\n}\n\n@test \"resolve python executable from enabled version\" {\n  remove_executable \"2.7.7\" \"python2.7\"\n  create_executable \"2.7.8\" \"python2.7\"\n  remove_executable \"2.7.9\" \"python2.7\"\n\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"virtualenv --verbose * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : true\"\n  stub pyenv-which \"python2.7 : echo ${PYENV_ROOT}/versions/2.7.8/bin/python2.7\"\n\n  run pyenv-virtualenv --verbose --python=python2.7 venv\n\n  unstub pyenv-exec\n  assert_output <<OUT\nPYENV_VERSION=2.7.8 virtualenv --verbose --python=${PYENV_ROOT}/versions/2.7.8/bin/python2.7 ${PYENV_ROOT}/versions/2.7.8/envs/venv\nOUT\n  assert_success\n\n  unstub pyenv-which\n\n  remove_executable \"2.7.7\" \"python2.7\"\n  remove_executable \"2.7.8\" \"python2.7\"\n  remove_executable \"2.7.9\" \"python2.7\"\n}\n\n@test \"resolve python executable from other versions\" {\n  remove_executable \"2.7.7\" \"python2.7\"\n  remove_executable \"2.7.8\" \"python2.7\"\n  create_executable \"2.7.9\" \"python2.7\"\n\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"virtualenv --verbose * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : true\"\n  stub pyenv-which \"python2.7 : false\"\n  stub pyenv-whence \"python2.7 : echo 2.7.7; echo 2.7.8; echo 2.7.9\"\n  stub pyenv-which \"python2.7 : echo ${PYENV_ROOT}/versions/2.7.9/bin/python2.7\"\n\n  run pyenv-virtualenv --verbose --python=python2.7 venv\n\n  assert_output <<OUT\nPYENV_VERSION=2.7.8 virtualenv --verbose --python=${PYENV_ROOT}/versions/2.7.9/bin/python2.7 ${PYENV_ROOT}/versions/2.7.8/envs/venv\nOUT\n  assert_success\n\n  unstub pyenv-which\n  unstub pyenv-whence\n  unstub pyenv-exec\n\n  remove_executable \"2.7.7\" \"python2.7\"\n  remove_executable \"2.7.8\" \"python2.7\"\n  remove_executable \"2.7.9\" \"python2.7\"\n}\n\n@test \"cannot resolve python executable\" {\n  remove_executable \"2.7.7\" \"python2.7\"\n  remove_executable \"2.7.8\" \"python2.7\"\n  remove_executable \"2.7.9\" \"python2.7\"\n\n  stub pyenv-which \"python2.7 : false\"\n  stub pyenv-whence \"python2.7 : false\"\n  stub pyenv-which \"python2.7 : false\"\n\n  run pyenv-virtualenv --verbose --python=python2.7 venv\n\n  assert_output <<OUT\npyenv-virtualenv: \\`python2.7' is not installed in pyenv.\nRun \\`pyenv install python2.7' to install it.\nOUT\n  assert_failure\n\n  unstub pyenv-which\n  unstub pyenv-whence\n\n  remove_executable \"2.7.7\" \"python2.7\"\n  remove_executable \"2.7.8\" \"python2.7\"\n  remove_executable \"2.7.9\" \"python2.7\"\n}\n\n@test \"invalid python name\" {\n  run pyenv-virtualenv --verbose --python=99.99.99 venv\n\n  assert_output <<OUT\npyenv-virtualenv: \\`99.99.99' is not installed in pyenv.\nIt does not look like a valid Python version. See \\`pyenv install --list' for available versions.\nOUT\n  assert_failure\n}\n"
  },
  {
    "path": "test/pyvenv.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n}\n\nstub_pyenv() {\n  stub pyenv-version-name \"echo \\${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-hooks \"virtualenv : echo\"\n  stub pyenv-rehash \" : echo rehashed\"\n}\n\nunstub_pyenv() {\n  unstub pyenv-version-name\n  unstub pyenv-prefix\n  unstub pyenv-hooks\n  unstub pyenv-rehash\n}\n\n@test \"use venv if virtualenv is not available\" {\n  export PYENV_VERSION=\"3.5.1\"\n  setup_m_venv \"3.5.1\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : true\"\n  stub pyenv-exec \"python -m venv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : true\"\n\n  run pyenv-virtualenv venv\n\n  assert_output <<OUT\nPYENV_VERSION=3.5.1 python -m venv ${PYENV_ROOT}/versions/3.5.1/envs/venv\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"3.5.1\"\n}\n\n@test \"not use venv if virtualenv is available\" {\n  export PYENV_VERSION=\"3.5.1\"\n  setup_m_venv \"3.5.1\"\n  create_executable \"3.5.1\" \"virtualenv\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : true\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : true\"\n\n  run pyenv-virtualenv venv\n\n  assert_output <<OUT\nPYENV_VERSION=3.5.1 virtualenv ${PYENV_ROOT}/versions/3.5.1/envs/venv\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"3.5.1\"\n}\n\n@test \"install virtualenv if venv is not available\" {\n  export PYENV_VERSION=\"3.2.1\"\n  setup_version \"3.2.1\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"pip install virtualenv* : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n\n  run pyenv-virtualenv venv\n\n  assert_output <<OUT\nPYENV_VERSION=3.2.1 pip install virtualenv==13.1.2\nPYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/3.2.1/envs/venv/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_version \"3.2.1\"\n}\n\n@test \"install virtualenv if -p has given\" {\n  export PYENV_VERSION=\"3.5.1\"\n  setup_m_venv \"3.5.1\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : true\"\n  stub pyenv-exec \"pip install virtualenv : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : true\"\n\n  run pyenv-virtualenv -p ${TMP}/python3 venv\n\n  assert_output <<OUT\nPYENV_VERSION=3.5.1 pip install virtualenv\nPYENV_VERSION=3.5.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.5.1/envs/venv\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"3.5.1\"\n}\n\n@test \"install virtualenv if --python has given\" {\n  export PYENV_VERSION=\"3.5.1\"\n  setup_m_venv \"3.5.1\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : true\"\n  stub pyenv-exec \"pip install virtualenv : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : true\"\n\n  run pyenv-virtualenv --python=${TMP}/python3 venv\n\n  assert_output <<OUT\nPYENV_VERSION=3.5.1 pip install virtualenv\nPYENV_VERSION=3.5.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.5.1/envs/venv\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_m_venv \"3.5.1\"\n}\n\n@test \"install virtualenv with unsetting troublesome pip options\" {\n  export PYENV_VERSION=\"3.2.1\"\n  setup_version \"3.2.1\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-prefix \" : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"pip install virtualenv* : echo PIP_REQUIRE_VENV=\\${PIP_REQUIRE_VENV} PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"virtualenv * : echo PIP_REQUIRE_VENV=\\${PIP_REQUIRE_VENV} PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n\n  PIP_REQUIRE_VENV=\"true\" run pyenv-virtualenv venv\n\n  assert_output <<OUT\nPIP_REQUIRE_VENV= PYENV_VERSION=3.2.1 pip install virtualenv==13.1.2\nPIP_REQUIRE_VENV= PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/3.2.1/envs/venv/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  teardown_version \"3.2.1\"\n}\n"
  },
  {
    "path": "test/stubs/stub",
    "content": "#!/usr/bin/env bash\nexport PS4='+($$:${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'\nset -e\n\nstatus=0\nprogram=\"${0##*/}\"\nPROGRAM=\"$(echo \"$program\" | tr a-z- A-Z_)\"\n[ -n \"$TMPDIR\" ] || TMPDIR=\"/tmp\"\n\nSTUB_PLAN=\"${PROGRAM}_STUB_PLAN\"\nSTUB_PLAN=\"${!STUB_PLAN}\"\n\nSTUB_RUN=\"${PROGRAM}_STUB_RUN\"\nSTUB_RUN=\"${!STUB_RUN:-${TMPDIR}/${program}-stub-run}\"\nSTUB_INDEX=\nSTUB_RESULT=\n\nSTUB_END=\"${PROGRAM}_STUB_END\"\nSTUB_END=\"${!STUB_END}\"\n\nSTUB_LOG=\"${PROGRAM}_STUB_LOG\"\nSTUB_LOG=\"${!STUB_LOG:-${TMPDIR}/${program}-stub-log}\"\n\n\nSTUB_LOCKFILE=\"${TMPDIR}/${program}-stub.lock\"\n\nrelease_lock() {\n  rm -f \"$STUB_LOCKFILE\"\n  trap - EXIT\n}\n\nacquire_lock() {\n  local start=$SECONDS\n  local acquire_timeout=10\n  local acquired=\n  while (( SECONDS <= start + $acquire_timeout )); do\n  \n    ( set -o noclobber; echo -n >\"$STUB_LOCKFILE\" ) 2>/dev/null && acquired=1\n\n    if [[ -n $acquired ]]; then\n      trap release_lock EXIT\n      break\n    else\n      # POSIX sleep(1) doesn't provide subsecond precision, but many others do\n      sleep 0.1 2>/dev/null || sleep 1\n    fi\n  done\n  if [[ -z $acquired ]]; then\n    echo \"$0: error: could not acquire stub lock \\`$STUB_LOCKFILE' in ${acquire_timeout} seconds\" >&2\n    exit 2\n  fi\n}\n\nacquire_lock\n\nif [[ -z $STUB_END ]]; then echo \"$program\" \"$@\" >>\"$STUB_LOG\"; fi\n\n[[ -e $STUB_PLAN ]] || exit 1\n\n# Initialize or load the stub run information.\nread_runfile() {\n  if [[ -e $STUB_RUN ]]; then source \"$STUB_RUN\"; fi\n}\nwrite_runfile() {\n  {\n    local i\n    echo \"STUB_INDEX=$STUB_INDEX\"\n    echo \"STUB_RESULT=$STUB_RESULT\"\n    echo \"STUB_RUNCOUNTS=()\"\n    for i in ${!STUB_RUNCOUNTS[@]}; do\n      echo \"STUB_RUNCOUNTS[$i]=${STUB_RUNCOUNTS[$i]}\"\n    done\n  } > \"$STUB_RUN\"\n}\nupdate_runfile_index() {\n  ( STUB_INDEX=$((STUB_INDEX + 1))\n    write_runfile\n  )\n}\nupdate_runfile_result() {\n  (\n    # Another stubs may have run while we were running payload\n    # So we need to merge possible state changes\n    local our_result=\"$STUB_RESULT\"\n    local -a our_runcounts\n    array_copy STUB_RUNCOUNTS our_runcounts\n    \n    read_runfile\n    \n    # merge our match_result and their match_result, with failure taking precedence\n    STUB_RESULT=$(( our_result | STUB_RESULT ))\n    \n    # 3-way merge STUB_RUNCOUNTS (their changes),\n    # our_runcounts (our changes) and initial_runcounts (base)\n    local i\n    for i in $(printf '%s\\n' ${!STUB_RUNCOUNTS[@]} ${!our_runcounts[@]} | sort -u); do\n      STUB_RUNCOUNTS[$i]=$((STUB_RUNCOUNTS[i] + our_runcounts[i] - initial_runcounts[i]))\n    done\n    \n    write_runfile\n  )\n}\n\narray_copy() {\n  #`declare -p' is supposed to produce \"declare -a src=([index]=\"value\" <etc>)\"\n  local data=\"$(declare -p ${1:?})\"\n  local dest=\"${2:?}\"\n  # Bash 5 dumps empty arrays as \"declare -a arr\"\n  if [[ $data != *=* ]]; then\n    data=\"()\";\n  else\n    data=\"${data#*=}\"\n  fi\n  \n  # Bash 3 and MacPorts version of Bash 5 dump arrays in single quotes \"declare -a arr='()'\"\n  #  but arr='(<value>)' createss \"([0]='<value>')\" rather than duplicate the array\n  if [[ ${data:0:1} == \"'\" && ${data:${#data}-1:1} == \"'\" ]]; then\n    data=\"${data:1:${#data}-2}\"\n  fi\n  eval \"$dest=$data\"\n}\n\nSTUB_INDEX=1\nSTUB_RESULT=0\ndeclare -a STUB_RUNCOUNTS\nread_runfile\ndeclare -a initial_runcounts\narray_copy STUB_RUNCOUNTS initial_runcounts\n\n# ${PROGRAM}_STUB_END envvar is set externally to trigger verification mode for `unstub'\n# Execution mode\nif [[ -z $STUB_END ]]; then\n  \n  # Loop over each line in the plan.\n  regular_command_index=0\n  no_order_command_index=0\n  match_result=1\n  while IFS= read -r line; do\n    line_flags=\"${line%% *}\"\n    line=\"${line#${line_flags} }\"\n    line_flag_no_order=\"$(if [[ $line_flags == N ]]; then echo 1; fi)\"\n    line_flag_multiple=\"$(if [[ $line_flags == M ]]; then echo 1; fi)\"\n    line_flag_regular=\"$(if [[ $line_flags == - ]]; then echo 1; fi)\"\n    unset line_flags\n    \n    # Go through the plan until a match is found.\n    # For regular commands, only check the next command by index.\n    # Also keep track of no-order commands for the purpose of run count tracking\n    if [[ -n $line_flag_regular ]]; then\n      regular_command_index=$(($regular_command_index + 1))\n      if [[ $regular_command_index -ne $STUB_INDEX ]]; then\n        continue;\n      fi\n    else\n      no_order_command_index=$(($no_order_command_index + 1))\n    fi\n    \n    # Split the line into an array of arguments to\n    # match and a command to run to produce output.\n    command=\" $line\"\n    if [[ $command == *\" : \"* ]]; then\n      patterns=\"${command%% : *}\"\n      command=\"${command#* : }\"\n    fi\n\n    # Naively split patterns by whitespace for now.\n    # In the future, use a sed script to split while\n    # respecting quoting.\n    set -f\n    patterns=($patterns)\n    set +f\n    arguments=(\"$@\")\n\n    # Match the expected argument patterns to actual\n    # arguments.\n    match_result=0\n    for (( i=0; i<${#patterns[@]}; i++ )); do\n      pattern=\"${patterns[$i]}\"\n      argument=\"${arguments[$i]}\"\n\n      case \"$argument\" in\n        $pattern ) ;;\n        * ) match_result=1 ;;\n      esac\n    done\n\n    # If the arguments matched, evaluate the command\n    # in a subshell. Otherwise, log the failure.\n    if [ $match_result -eq 0 ] ; then\n\n      # If this is a regular command, push the regular command index for the next stub invocation\n      if [[ -n $line_flag_regular ]]; then\n        update_runfile_index\n      else\n        STUB_RUNCOUNTS[$no_order_command_index]=$((STUB_RUNCOUNTS[no_order_command_index]+1))\n      fi\n      \n      # Release the lock while running the payload to allow another `stub'\n      # of the same program to run concurrently (e.g. in a pipeline).\n      release_lock\n      \n      ( eval \"$command\" ) && status=\"$?\" || status=\"$?\"\n\n      break\n    fi\n    \n  done < \"$STUB_PLAN\"\n\n  #If we never matched anything, we failed.\n  if [[ $match_result -eq 1 ]]; then\n    STUB_RESULT=1\n    \n    #This also means that we never released the lock\n    # before running the payload\n  else \n    acquire_lock\n  fi\n  # Write out the match_result information.\n  update_runfile_result\n  release_lock\n \n  exit \"$status\"\n\nfi\n\n# Verification mode (`unstub')\nif [[ -n $STUB_END ]]; then\n\n  # `unstub' is supposed to run after any stubs are finished\n  release_lock\n\n  # If the number of regular commands in the plan is larger than\n  # the final regular_command_index, we failed.\n  if [[ $(grep -Ee '^-' \"$STUB_PLAN\" | wc -l ) -ge $STUB_INDEX ]]; then\n    STUB_RESULT=1\n  fi\n  \n  # If no-order commands weren't executed exactly once\n  # and multiple-times commands at least once, we failed.\n  no_order_command_index=0\n  while IFS= read -r line; do\n    line_flags=\"${line%% *}\"\n    line=\"${line#${line_flags} }\"\n    line_flag_no_order=\"$(if [[ $line_flags == N ]]; then echo 1; fi)\"\n    line_flag_multiple=\"$(if [[ $line_flags == M ]]; then echo 1; fi)\"\n    line_flag_regular=\"$(if [[ $line_flags == - ]]; then echo 1; fi)\"\n    unset line_flags\n\n    if [[ -z $line_flag_regular ]]; then\n      continue\n    fi\n    \n    no_order_command_index=$((no_order_command_index + 1))\n    \n    if [[ ( -n $line_flag_no_order && \\\n          (( STUB_RUNCOUNTS[no_order_command_index] != 1 )) ) \\\n        || \\\n        ( -n $line_flag_multiple && \\\n        (( STUB_RUNCOUNTS[no_order_command_index] < 1 )) ) ]]\n    then\n      STUB_RESULT=1\n    fi\n    \n  done < \"$STUB_PLAN\"\n  \n  if [[ $STUB_RESULT -ne 0 ]]; then\n    {\n      echo \"plan:\"\n      cat \"$STUB_PLAN\" || true\n      echo \"log:\"\n      cat \"$STUB_LOG\" || true\n    } >&2\n  fi\n\n  # Clean up the run file.\n  rm -f \"$STUB_RUN\"\n  rm -f \"$STUB_LOG\"\n\n  # Return the run result.\n  exit \"$STUB_RESULT\"\n\nfi\n"
  },
  {
    "path": "test/test_helper.bash",
    "content": "export TMP=\"$BATS_TEST_DIRNAME/tmp\"\nexport PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'\n\nPATH=/usr/bin:/usr/sbin:/bin:/sbin\nPATH=\"$BATS_TEST_DIRNAME/../bin:$PATH\"\nPATH=\"$TMP/bin:$PATH\"\nexport PATH\n\nteardown() {\n  rm -fr \"$TMP\"/*\n}\n\nstub() {\n  local FLAG_NO_ORDER=\n  local FLAG_MULTIPLE=\n  while (($#)); do\n    case \"$1\" in\n      -N|--no-order)\n        FLAG_NO_ORDER=1\n        shift\n        ;;\n      -M|--multiple)\n        FLAG_MULTIPLE=1\n        shift\n        ;;\n      -*)\n        echo \"stub: unrecognized switch: $arg\" >$2\n        return 1\n        ;;\n      *)\n        break\n        ;;\n    esac\n  done\n  \n  local FLAGS=-\n  if [[ -n $FLAG_MULTIPLE ]]; then\n    FLAGS=M\n  elif [[ -n $FLAG_NO_ORDER ]]; then\n    FLAGS=N\n  fi\n  \n  local program=\"$1\"\n  local prefix=\"$(echo \"$program\" | tr a-z- A-Z_)\"\n  shift\n\n  export \"${prefix}_STUB_PLAN\"=\"${TMP}/${program}-stub-plan\"\n  export \"${prefix}_STUB_RUN\"=\"${TMP}/${program}-stub-run\"\n  export \"${prefix}_STUB_LOG\"=\"${TMP}/${program}-stub-log\"\n  export \"${prefix}_STUB_END\"=\n\n  mkdir -p \"${TMP}/bin\"\n  ln -sf \"${BATS_TEST_DIRNAME}/stubs/stub\" \"${TMP}/bin/${program}\"\n\n  touch \"${TMP}/${program}-stub-plan\"\n  for arg in \"$@\"; do\n    echo \"$FLAGS\" \"$arg\" >> \"${TMP}/${program}-stub-plan\"\n  done\n}\n\nunstub() {\n  local program=\"$1\"\n  local prefix=\"$(echo \"$program\" | tr a-z- A-Z_)\"\n  local path=\"${TMP}/bin/${program}\"\n\n  export \"${prefix}_STUB_END\"=1\n\n  local STATUS=0\n  \"$path\" || STATUS=\"$?\"\n\n  rm -f \"$path\"\n  rm -f \"${TMP}/${program}-stub-plan\" \"${TMP}/${program}-stub-run\"\n  return \"$STATUS\"\n}\n\nassert() {\n  if ! \"$@\"; then\n    flunk \"failed: $@\"\n  fi\n}\n\nflunk() {\n  { if [ \"$#\" -eq 0 ]; then cat -\n    else echo \"$@\"\n    fi\n  } | sed \"s:${TMP}:\\${TMP}:g\" >&2\n  return 1\n}\n\nassert_success() {\n  if [ \"$status\" -ne 0 ]; then\n    { echo \"command failed with exit status $status\"\n      echo \"output: $output\"\n    } | flunk\n  elif [ \"$#\" -gt 0 ]; then\n    assert_output \"$1\"\n  fi\n}\n\nassert_failure() {\n  if [ \"$status\" -eq 0 ]; then\n    flunk \"expected failed exit status\"\n  elif [ \"$#\" -gt 0 ]; then\n    assert_output \"$1\"\n  fi\n}\n\nassert_equal() {\n  if [ \"$1\" != \"$2\" ]; then\n    { echo \"expected:\"\n      echo \"$1\"\n      echo \"actual:\"\n      echo \"$2\"\n    } | flunk\n  fi\n}\n\nassert_equal_wildcards() {\n  if [[ $1 != $2 ]]; then\n    { echo \"expected:\"\n      echo \"$2\"\n      echo \"actual:\"\n      echo \"$1\"\n    } | flunk\n  fi\n}\n\nassert_output() {\n  local expected\n  if [ $# -eq 0 ]; then expected=\"$(cat -)\"\n  else expected=\"$1\"\n  fi\n  assert_equal \"$expected\" \"$output\"\n}\n\nassert_output_wildcards() {\n  local expected\n  if [ $# -eq 0 ]; then expected=\"$(cat -)\"\n  else expected=\"$1\"\n  fi\n  assert_equal_wildcards \"$output\" \"$expected\"\n}\n\nassert_output_contains() {\n  local expected=\"$1\"\n  echo \"$output\" | grep -F \"$expected\" >/dev/null || {\n    { echo \"expected output to contain $expected\"\n      echo \"actual: $output\"\n    } | flunk\n  }\n}\n\nassert_output_contains_not() {\n  local expected=\"$1\"\n  echo \"$output\" | grep -F \"$expected\" >/dev/null && {\n    { echo \"expected output to not contain $expected\"\n      echo \"actual: $output\"\n    } | flunk; return\n  }\n  return 0\n}\n\ncreate_executable() {\n  mkdir -p \"${PYENV_ROOT}/versions/$1/bin\"\n  touch \"${PYENV_ROOT}/versions/$1/bin/$2\"\n  chmod +x \"${PYENV_ROOT}/versions/$1/bin/$2\"\n}\n\nremove_executable() {\n  rm -f \"${PYENV_ROOT}/versions/$1/bin/$2\"\n}\n\nsetup_version() {\n  create_executable \"$1\" \"python\"\n  remove_executable \"$1\" \"activate\"\n  remove_executable \"$1\" \"conda\"\n}\n\nteardown_version() {\n  rm -fr \"${PYENV_ROOT}/versions/$1\"\n}\n\nsetup_virtualenv() {\n  create_executable \"$1\" \"python\"\n  create_executable \"$1\" \"activate\"\n  remove_executable \"$1\" \"conda\"\n}\n\nteardown_virtualenv() {\n  rm -fr \"${PYENV_ROOT}/versions/$1\"\n}\n\nsetup_m_venv() {\n  create_executable \"$1\" \"python\"\n  create_executable \"$1\" \"activate\"\n  remove_executable \"$1\" \"conda\"\n}\n\nteardown_m_venv() {\n  rm -fr \"${PYENV_ROOT}/versions/$1\"\n}\n\nsetup_conda() {\n  create_executable \"$1\" \"python\"\n  create_executable \"$1\" \"activate\"\n  create_executable \"$1\" \"conda\"\n  local conda=\"$1\"\n  shift 1\n  local env\n  for env; do\n    create_executable \"${conda}/envs/${env}\" \"python\"\n    create_executable \"${conda}/envs/${env}\" \"activate\"\n    create_executable \"${conda}/envs/${env}\" \"conda\"\n    mkdir -p \"${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/activate.d\"\n    touch \"${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/activate.d/activate.sh\"\n    mkdir -p \"${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/deactivate.d\"\n    touch \"${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/deactivate.d/deactivate.sh\"\n  done\n}\n\nteardown_conda() {\n  rm -fr \"${PYENV_ROOT}/versions/$1\"\n}\n\n"
  },
  {
    "path": "test/version.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n}\n\n@test \"display virtualenv version\" {\n  setup_virtualenv \"2.7.7\"\n  stub pyenv-prefix \"echo '${PYENV_ROOT}/versions/2.7.7'\"\n  stub pyenv-version-name \"echo 2.7.7\"\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"virtualenv --version : echo \\\"1.11\\\"\"\n\n  run pyenv-virtualenv --version\n\n  assert_success\n  [[ \"$output\" == \"pyenv-virtualenv \"?.?.?\" (virtualenv 1.11)\" ]]\n\n  unstub pyenv-prefix\n  unstub pyenv-exec\n  teardown_virtualenv \"2.7.7\"\n}\n\n@test \"display venv version\" {\n  setup_m_venv \"3.4.1\"\n  stub pyenv-version-name \"echo 3.4.1\"\n  stub pyenv-prefix \"echo '${PYENV_ROOT}/versions/3.4.1'\"\n  stub pyenv-exec \"python -m venv --help : true\"\n\n  run pyenv-virtualenv --version\n\n  assert_success\n  [[ \"$output\" == \"pyenv-virtualenv \"?.?.?\" (python -m venv)\" ]]\n\n  unstub pyenv-prefix\n  teardown_m_venv \"3.4.1\"\n}\n"
  },
  {
    "path": "test/virtualenv.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n}\n\nstub_pyenv() {\n  setup_version \"${PYENV_VERSION}\"\n  create_executable \"${PYENV_VERSION}\" \"virtualenv\"\n  stub pyenv-prefix \"echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-prefix \"echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'\"\n  stub pyenv-hooks \"virtualenv : echo\"\n  stub pyenv-rehash \" : echo rehashed\"\n}\n\nunstub_pyenv() {\n  unstub pyenv-prefix\n  unstub pyenv-hooks\n  unstub pyenv-rehash\n  teardown_version \"${PYENV_VERSION}\"\n}\n\n@test \"create virtualenv from given version\" {\n  export PYENV_VERSION=\"2.7.11\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"; mkdir -p \\\"\\$2/bin\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : false\"\n  stub pyenv-exec \"python -s */get-pip.py : true\"\n  stub curl true\n  create_executable \"${PYENV_VERSION}\" \"python-config\"\n  create_executable \"${PYENV_VERSION}\" \"python2-config\"\n  create_executable \"${PYENV_VERSION}\" \"python2.7-config\"\n\n  run pyenv-virtualenv \"2.7.11\" \"venv\"\n\n  assert_output <<OUT\nPYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv\nInstalling pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...\nrehashed\nOUT\n  assert_success\n  for x in pydoc python-config python2-config python2.7-config; do\n    assert [ -x \"${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/$x\" ]\n  done\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  unstub curl\n}\n\n@test \"create virtualenv from a given prefix\" {\n  stub_pyenv \"2.7.11\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : false\"\n  stub pyenv-exec \"python -s */get-pip.py : true\"\n  stub curl true\n  stub pyenv-latest \"-f 2.7 : echo 2.7.11\"\n\n  run pyenv-virtualenv \"2.7\" \"venv\"\n\n  assert_output <<OUT\nPYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv\nInstalling pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc\" ]\n  assert [ ! -e \"${PYENV_ROOT}/versions/2.7\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  unstub curl\n}\n\n@test \"create virtualenv from current version\" {\n  export PYENV_VERSION=\"2.7.11\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-version-name \"echo \\${PYENV_VERSION}\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : false\"\n  stub pyenv-exec \"python -s */get-pip.py : true\"\n  stub curl true\n\n  run pyenv-virtualenv venv\n\n  assert_output <<OUT\nPYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv\nInstalling pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  unstub curl\n}\n\n@test \"create virtualenv with short options\" {\n  export PYENV_VERSION=\"2.7.11\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-version-name \"echo \\${PYENV_VERSION}\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : false\"\n  stub pyenv-exec \"python -s */get-pip.py : true\"\n  stub curl true\n\n  run pyenv-virtualenv -v -p ${TMP}/python venv\n\n  assert_output <<OUT\nPYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/versions/2.7.11/envs/venv\nInstalling pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  unstub curl\n}\n\n@test \"create virtualenv with long options\" {\n  export PYENV_VERSION=\"2.7.11\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-version-name \"echo \\${PYENV_VERSION}\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : false\"\n  stub pyenv-exec \"python -s */get-pip.py : true\"\n  stub curl true\n\n  run pyenv-virtualenv --verbose --python=${TMP}/python venv\n\n  assert_output <<OUT\nPYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/versions/2.7.11/envs/venv\nInstalling pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  unstub curl\n}\n\n@test \"no whitespace allowed in virtualenv name\" {\n  run pyenv-virtualenv \"2.7.11\" \"foo bar\"\n\n  assert_failure\n  assert_output <<OUT\npyenv-virtualenv: no whitespace allowed in virtualenv name.\nOUT\n}\n\n@test \"no tab allowed in virtualenv name\" {\n  run pyenv-virtualenv \"2.7.11\" \"foo\tbar baz\"\n\n  assert_failure\n  assert_output <<OUT\npyenv-virtualenv: no whitespace allowed in virtualenv name.\nOUT\n}\n\n@test \"system not allowed as virtualenv name\" {\n  run pyenv-virtualenv \"2.7.11\" \"system\"\n\n  assert_failure\n  assert_output <<OUT\npyenv-virtualenv: \\`system' is not allowed as virtualenv name.\nOUT\n}\n\n@test \"no slash allowed in virtualenv name\" {\n  run pyenv-virtualenv \"2.7.11\" \"foo/bar\"\n\n  assert_failure\n  assert_output <<OUT\npyenv-virtualenv: no slash allowed in virtualenv name.\nOUT\n}\n\n@test \"slash allowed if it is the long name of the virtualenv\" {\n  export PYENV_VERSION=\"2.7.11\"\n  stub_pyenv \"${PYENV_VERSION}\"\n  stub pyenv-virtualenv-prefix \" : false\"\n  stub pyenv-exec \"python -m venv --help : false\"\n  stub pyenv-exec \"virtualenv * : echo PYENV_VERSION=\\${PYENV_VERSION} \\\"\\$@\\\"\"\n  stub pyenv-exec \"python -s -m ensurepip : false\"\n  stub pyenv-exec \"python -s */get-pip.py : true\"\n  stub curl true\n\n  run pyenv-virtualenv \"2.7.11\" \"2.7.11/envs/foo\"\n\n  assert_output <<OUT\nPYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/foo\nInstalling pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...\nrehashed\nOUT\n  assert [ -x \"${PYENV_ROOT}/versions/2.7.11/envs/foo/bin/pydoc\" ]\n  assert_success\n\n  unstub_pyenv\n  unstub pyenv-virtualenv-prefix\n  unstub pyenv-exec\n  unstub curl\n}\n"
  },
  {
    "path": "test/virtualenvs.bats",
    "content": "#!/usr/bin/env bats\n\nload test_helper\n\nsetup() {\n  export PYENV_ROOT=\"${TMP}/pyenv\"\n  mkdir -p \"${PYENV_ROOT}/versions/2.7.6\"\n  mkdir -p \"${PYENV_ROOT}/versions/3.3.3\"\n  mkdir -p \"${PYENV_ROOT}/versions/venv27\"\n  mkdir -p \"${PYENV_ROOT}/versions/venv33\"\n}\n\n@test \"list virtual environments only\" {\n  stub pyenv-version-name \": echo system\"\n  stub pyenv-virtualenv-prefix \"2.7.6 : false\"\n  stub pyenv-virtualenv-prefix \"3.3.3 : false\"\n  stub pyenv-virtualenv-prefix \"venv27 : echo \\\"${PYENV_ROOT}/versions/2.7.6\\\"\"\n  stub pyenv-virtualenv-prefix \"venv33 : echo \\\"${PYENV_ROOT}/versions/3.3.3\\\"\"\n\n  run pyenv-virtualenvs\n\n  assert_success\n  assert_output <<OUT\n  venv27 (created from ${PYENV_ROOT}/versions/2.7.6)\n  venv33 (created from ${PYENV_ROOT}/versions/3.3.3)\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n}\n\n@test \"list virtual environments with hit prefix\" {\n  stub pyenv-version-name \": echo venv33\"\n  stub pyenv-virtualenv-prefix \"2.7.6 : false\"\n  stub pyenv-virtualenv-prefix \"3.3.3 : false\"\n  stub pyenv-virtualenv-prefix \"venv27 : echo \\\"/usr\\\"\"\n  stub pyenv-virtualenv-prefix \"venv33 : echo \\\"/usr\\\"\"\n\n  run pyenv-virtualenvs\n\n  assert_success\n  assert_output <<OUT\n  venv27 (created from /usr)\n* venv33 (created from /usr)\nOUT\n\n  unstub pyenv-version-name\n  unstub pyenv-virtualenv-prefix\n}\n\n@test \"list virtual environments with --bare\" {\n  stub pyenv-virtualenv-prefix \"2.7.6 : false\"\n  stub pyenv-virtualenv-prefix \"3.3.3 : false\"\n  stub pyenv-virtualenv-prefix \"venv27 : echo \\\"/usr\\\"\"\n  stub pyenv-virtualenv-prefix \"venv33 : echo \\\"/usr\\\"\"\n\n  run pyenv-virtualenvs --bare\n\n  assert_success\n  assert_output <<OUT\nvenv27\nvenv33\nOUT\n\n  unstub pyenv-virtualenv-prefix\n}\n"
  }
]