We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Latest virtualenv breaks pre-commit
See also #299 

Failure looks like:

```
17:00:19 hookid: sort-simple-yaml
17:00:19 
17:00:19 bash: /nail/home/push/.pre-commit/reposkzFrD//tmp/tmp.cEk6TCoZOS/srv-configs/py_env-default/bin/activate: No such file or directory
```

```
$ pip install virtualenv --upgrade
Downloading/unpacking virtualenv
  Downloading virtualenv-14.0.0-py2.py3-none-any.whl (1.8MB): 1.8MB downloaded
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...
$ python
Python 2.6.7 (r267:88850, Dec  2 2011, 20:27:26) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import virtualenv
>>> virtualenv.path_locations('foo')
('/nail/home/asottile/foo', '/nail/home/asottile/foo/lib/python2.6', '/nail/home/asottile/foo/include/python2.6', '/nail/home/asottile/foo/bin')
>>> 
$ pip install virtualenv==1.11.5
Downloading/unpacking virtualenv==1.11.5
  Downloading virtualenv-1.11.5.tar.gz (1.8MB): 1.8MB downloaded
  Running setup.py (path:/nail/home/asottile/venv/build/virtualenv/setup.py) egg_info for package virtualenv
    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: virtualenv
  Found existing installation: virtualenv 14.0.0
    Uninstalling virtualenv:
      Successfully uninstalled virtualenv
  Running setup.py install for virtualenv
    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
    Installing virtualenv script to /nail/home/asottile/venv/bin
    Installing virtualenv-2.6 script to /nail/home/asottile/venv/bin
Successfully installed virtualenv
Cleaning up...
$ python
Python 2.6.7 (r267:88850, Dec  2 2011, 20:27:26) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import virtualenv
>>> virtualenv.path_locations('foo')
('foo', 'foo/lib/python2.6', 'foo/include/python2.6', 'foo/bin')
>>>
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pre_commit/languages/python.py`
Content:
```
1 from __future__ import unicode_literals
2 
3 import contextlib
4 import distutils.spawn
5 import os
6 import sys
7 
8 import virtualenv
9 
10 from pre_commit.languages import helpers
11 from pre_commit.util import clean_path_on_failure
12 from pre_commit.util import shell_escape
13 
14 
15 ENVIRONMENT_DIR = 'py_env'
16 
17 
18 class PythonEnv(helpers.Environment):
19     @property
20     def env_prefix(self):
21         return ". '{{prefix}}{0}activate' &&".format(
22             virtualenv.path_locations(
23                 helpers.environment_dir(ENVIRONMENT_DIR, self.language_version)
24             )[-1].rstrip(os.sep) + os.sep,
25         )
26 
27 
28 @contextlib.contextmanager
29 def in_env(repo_cmd_runner, language_version):
30     yield PythonEnv(repo_cmd_runner, language_version)
31 
32 
33 def norm_version(version):
34     if os.name == 'nt':  # pragma: no cover (windows)
35         # Try looking up by name
36         if distutils.spawn.find_executable(version):
37             return version
38 
39         # If it is in the form pythonx.x search in the default
40         # place on windows
41         if version.startswith('python'):
42             return r'C:\{0}\python.exe'.format(version.replace('.', ''))
43 
44         # Otherwise assume it is a path
45     return os.path.expanduser(version)
46 
47 
48 def install_environment(
49         repo_cmd_runner,
50         version='default',
51         additional_dependencies=None,
52 ):
53     assert repo_cmd_runner.exists('setup.py')
54     directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
55 
56     # Install a virtualenv
57     with clean_path_on_failure(repo_cmd_runner.path(directory)):
58         venv_cmd = [
59             sys.executable, '-m', 'virtualenv',
60             '{{prefix}}{0}'.format(directory)
61         ]
62         if version != 'default':
63             venv_cmd.extend(['-p', norm_version(version)])
64         repo_cmd_runner.run(venv_cmd)
65         with in_env(repo_cmd_runner, version) as env:
66             env.run("cd '{prefix}' && pip install .", encoding=None)
67             if additional_dependencies:
68                 env.run(
69                     "cd '{prefix}' && pip install " +
70                     ' '.join(
71                         shell_escape(dep) for dep in additional_dependencies
72                     ),
73                     encoding=None,
74                 )
75 
76 
77 def run_hook(repo_cmd_runner, hook, file_args):
78     with in_env(repo_cmd_runner, hook['language_version']) as env:
79         return helpers.run_hook(env, hook, file_args)
80
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pre_commit/languages/python.py b/pre_commit/languages/python.py
--- a/pre_commit/languages/python.py
+++ b/pre_commit/languages/python.py
@@ -5,8 +5,6 @@
 import os
 import sys
 
-import virtualenv
-
 from pre_commit.languages import helpers
 from pre_commit.util import clean_path_on_failure
 from pre_commit.util import shell_escape
@@ -15,13 +13,22 @@
 ENVIRONMENT_DIR = 'py_env'
 
 
+def bin_dir(venv):
+    """On windows there's a different directory for the virtualenv"""
+    if os.name == 'nt':  # pragma: no cover (windows)
+        return os.path.join(venv, 'Scripts')
+    else:
+        return os.path.join(venv, 'bin')
+
+
 class PythonEnv(helpers.Environment):
     @property
     def env_prefix(self):
-        return ". '{{prefix}}{0}activate' &&".format(
-            virtualenv.path_locations(
+        return ". '{{prefix}}{0}{1}activate' &&".format(
+            bin_dir(
                 helpers.environment_dir(ENVIRONMENT_DIR, self.language_version)
-            )[-1].rstrip(os.sep) + os.sep,
+            ),
+            os.sep,
         )

{"golden_diff": "diff --git a/pre_commit/languages/python.py b/pre_commit/languages/python.py\n--- a/pre_commit/languages/python.py\n+++ b/pre_commit/languages/python.py\n@@ -5,8 +5,6 @@\n import os\n import sys\n \n-import virtualenv\n-\n from pre_commit.languages import helpers\n from pre_commit.util import clean_path_on_failure\n from pre_commit.util import shell_escape\n@@ -15,13 +13,22 @@\n ENVIRONMENT_DIR = 'py_env'\n \n \n+def bin_dir(venv):\n+    \"\"\"On windows there's a different directory for the virtualenv\"\"\"\n+    if os.name == 'nt':  # pragma: no cover (windows)\n+        return os.path.join(venv, 'Scripts')\n+    else:\n+        return os.path.join(venv, 'bin')\n+\n+\n class PythonEnv(helpers.Environment):\n     @property\n     def env_prefix(self):\n-        return \". '{{prefix}}{0}activate' &&\".format(\n-            virtualenv.path_locations(\n+        return \". '{{prefix}}{0}{1}activate' &&\".format(\n+            bin_dir(\n                 helpers.environment_dir(ENVIRONMENT_DIR, self.language_version)\n-            )[-1].rstrip(os.sep) + os.sep,\n+            ),\n+            os.sep,\n         )\n", "issue": "Latest virtualenv breaks pre-commit\nSee also #299 \n\nFailure looks like:\n\n```\n17:00:19 hookid: sort-simple-yaml\n17:00:19 \n17:00:19 bash: /nail/home/push/.pre-commit/reposkzFrD//tmp/tmp.cEk6TCoZOS/srv-configs/py_env-default/bin/activate: No such file or directory\n```\n\n```\n$ pip install virtualenv --upgrade\nDownloading/unpacking virtualenv\n  Downloading virtualenv-14.0.0-py2.py3-none-any.whl (1.8MB): 1.8MB downloaded\nInstalling collected packages: virtualenv\nSuccessfully installed virtualenv\nCleaning up...\n$ python\nPython 2.6.7 (r267:88850, Dec  2 2011, 20:27:26) \n[GCC 4.4.3] on linux2\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import virtualenv\n>>> virtualenv.path_locations('foo')\n('/nail/home/asottile/foo', '/nail/home/asottile/foo/lib/python2.6', '/nail/home/asottile/foo/include/python2.6', '/nail/home/asottile/foo/bin')\n>>> \n$ pip install virtualenv==1.11.5\nDownloading/unpacking virtualenv==1.11.5\n  Downloading virtualenv-1.11.5.tar.gz (1.8MB): 1.8MB downloaded\n  Running setup.py (path:/nail/home/asottile/venv/build/virtualenv/setup.py) egg_info for package virtualenv\n    warning: no previously-included files matching '*' found under directory 'docs/_templates'\n    warning: no previously-included files matching '*' found under directory 'docs/_build'\nInstalling collected packages: virtualenv\n  Found existing installation: virtualenv 14.0.0\n    Uninstalling virtualenv:\n      Successfully uninstalled virtualenv\n  Running setup.py install for virtualenv\n    warning: no previously-included files matching '*' found under directory 'docs/_templates'\n    warning: no previously-included files matching '*' found under directory 'docs/_build'\n    Installing virtualenv script to /nail/home/asottile/venv/bin\n    Installing virtualenv-2.6 script to /nail/home/asottile/venv/bin\nSuccessfully installed virtualenv\nCleaning up...\n$ python\nPython 2.6.7 (r267:88850, Dec  2 2011, 20:27:26) \n[GCC 4.4.3] on linux2\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import virtualenv\n>>> virtualenv.path_locations('foo')\n('foo', 'foo/lib/python2.6', 'foo/include/python2.6', 'foo/bin')\n>>>\n```\n\n", "before_files": [{"content": "from __future__ import unicode_literals\n\nimport contextlib\nimport distutils.spawn\nimport os\nimport sys\n\nimport virtualenv\n\nfrom pre_commit.languages import helpers\nfrom pre_commit.util import clean_path_on_failure\nfrom pre_commit.util import shell_escape\n\n\nENVIRONMENT_DIR = 'py_env'\n\n\nclass PythonEnv(helpers.Environment):\n    @property\n    def env_prefix(self):\n        return \". '{{prefix}}{0}activate' &&\".format(\n            virtualenv.path_locations(\n                helpers.environment_dir(ENVIRONMENT_DIR, self.language_version)\n            )[-1].rstrip(os.sep) + os.sep,\n        )\n\n\n@contextlib.contextmanager\ndef in_env(repo_cmd_runner, language_version):\n    yield PythonEnv(repo_cmd_runner, language_version)\n\n\ndef norm_version(version):\n    if os.name == 'nt':  # pragma: no cover (windows)\n        # Try looking up by name\n        if distutils.spawn.find_executable(version):\n            return version\n\n        # If it is in the form pythonx.x search in the default\n        # place on windows\n        if version.startswith('python'):\n            return r'C:\\{0}\\python.exe'.format(version.replace('.', ''))\n\n        # Otherwise assume it is a path\n    return os.path.expanduser(version)\n\n\ndef install_environment(\n        repo_cmd_runner,\n        version='default',\n        additional_dependencies=None,\n):\n    assert repo_cmd_runner.exists('setup.py')\n    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)\n\n    # Install a virtualenv\n    with clean_path_on_failure(repo_cmd_runner.path(directory)):\n        venv_cmd = [\n            sys.executable, '-m', 'virtualenv',\n            '{{prefix}}{0}'.format(directory)\n        ]\n        if version != 'default':\n            venv_cmd.extend(['-p', norm_version(version)])\n        repo_cmd_runner.run(venv_cmd)\n        with in_env(repo_cmd_runner, version) as env:\n            env.run(\"cd '{prefix}' && pip install .\", encoding=None)\n            if additional_dependencies:\n                env.run(\n                    \"cd '{prefix}' && pip install \" +\n                    ' '.join(\n                        shell_escape(dep) for dep in additional_dependencies\n                    ),\n                    encoding=None,\n                )\n\n\ndef run_hook(repo_cmd_runner, hook, file_args):\n    with in_env(repo_cmd_runner, hook['language_version']) as env:\n        return helpers.run_hook(env, hook, file_args)\n", "path": "pre_commit/languages/python.py"}], "after_files": [{"content": "from __future__ import unicode_literals\n\nimport contextlib\nimport distutils.spawn\nimport os\nimport sys\n\nfrom pre_commit.languages import helpers\nfrom pre_commit.util import clean_path_on_failure\nfrom pre_commit.util import shell_escape\n\n\nENVIRONMENT_DIR = 'py_env'\n\n\ndef bin_dir(venv):\n    \"\"\"On windows there's a different directory for the virtualenv\"\"\"\n    if os.name == 'nt':  # pragma: no cover (windows)\n        return os.path.join(venv, 'Scripts')\n    else:\n        return os.path.join(venv, 'bin')\n\n\nclass PythonEnv(helpers.Environment):\n    @property\n    def env_prefix(self):\n        return \". '{{prefix}}{0}{1}activate' &&\".format(\n            bin_dir(\n                helpers.environment_dir(ENVIRONMENT_DIR, self.language_version)\n            ),\n            os.sep,\n        )\n\n\n@contextlib.contextmanager\ndef in_env(repo_cmd_runner, language_version):\n    yield PythonEnv(repo_cmd_runner, language_version)\n\n\ndef norm_version(version):\n    if os.name == 'nt':  # pragma: no cover (windows)\n        # Try looking up by name\n        if distutils.spawn.find_executable(version):\n            return version\n\n        # If it is in the form pythonx.x search in the default\n        # place on windows\n        if version.startswith('python'):\n            return r'C:\\{0}\\python.exe'.format(version.replace('.', ''))\n\n        # Otherwise assume it is a path\n    return os.path.expanduser(version)\n\n\ndef install_environment(\n        repo_cmd_runner,\n        version='default',\n        additional_dependencies=None,\n):\n    assert repo_cmd_runner.exists('setup.py')\n    directory = helpers.environment_dir(ENVIRONMENT_DIR, version)\n\n    # Install a virtualenv\n    with clean_path_on_failure(repo_cmd_runner.path(directory)):\n        venv_cmd = [\n            sys.executable, '-m', 'virtualenv',\n            '{{prefix}}{0}'.format(directory)\n        ]\n        if version != 'default':\n            venv_cmd.extend(['-p', norm_version(version)])\n        repo_cmd_runner.run(venv_cmd)\n        with in_env(repo_cmd_runner, version) as env:\n            env.run(\"cd '{prefix}' && pip install .\", encoding=None)\n            if additional_dependencies:\n                env.run(\n                    \"cd '{prefix}' && pip install \" +\n                    ' '.join(\n                        shell_escape(dep) for dep in additional_dependencies\n                    ),\n                    encoding=None,\n                )\n\n\ndef run_hook(repo_cmd_runner, hook, file_args):\n    with in_env(repo_cmd_runner, hook['language_version']) as env:\n        return helpers.run_hook(env, hook, file_args)\n", "path": "pre_commit/languages/python.py"}]}