We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
bootstrap script cannot be executed without setuptools already installed
The `bootstrap.py` script cannot be used to bootstrap from an environment without setuptools.  The script imports `pip` which requires setuptools to be be installed.  This behavior was introduced in #933.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bootstrap.py`
Content:
```
1 """
2 If setuptools is not already installed in the environment, it's not possible
3 to invoke setuptools' own commands. This routine will bootstrap this local
4 environment by creating a minimal egg-info directory and then invoking the
5 egg-info command to flesh out the egg-info directory.
6 """
7 
8 from __future__ import unicode_literals
9 
10 import os
11 import io
12 import re
13 import contextlib
14 import tempfile
15 import shutil
16 import sys
17 import textwrap
18 import subprocess
19 
20 import pip
21 
22 minimal_egg_info = textwrap.dedent("""
23     [distutils.commands]
24     egg_info = setuptools.command.egg_info:egg_info
25 
26     [distutils.setup_keywords]
27     include_package_data = setuptools.dist:assert_bool
28     install_requires = setuptools.dist:check_requirements
29     extras_require = setuptools.dist:check_extras
30     entry_points = setuptools.dist:check_entry_points
31 
32     [egg_info.writers]
33     dependency_links.txt = setuptools.command.egg_info:overwrite_arg
34     entry_points.txt = setuptools.command.egg_info:write_entries
35     requires.txt = setuptools.command.egg_info:write_requirements
36     """)
37 
38 
39 def ensure_egg_info():
40     if os.path.exists('setuptools.egg-info'):
41         return
42     print("adding minimal entry_points")
43     build_egg_info()
44 
45 
46 def build_egg_info():
47     """
48     Build a minimal egg-info, enough to invoke egg_info
49     """
50 
51     os.mkdir('setuptools.egg-info')
52     filename = 'setuptools.egg-info/entry_points.txt'
53     with io.open(filename, 'w', encoding='utf-8') as ep:
54         ep.write(minimal_egg_info)
55 
56 
57 def run_egg_info():
58     cmd = [sys.executable, 'setup.py', 'egg_info']
59     print("Regenerating egg_info")
60     subprocess.check_call(cmd)
61     print("...and again.")
62     subprocess.check_call(cmd)
63 
64 
65 def gen_deps():
66     with io.open('setup.py', encoding='utf-8') as strm:
67         text = strm.read()
68     pattern = r'install_requires=\[(.*?)\]'
69     match = re.search(pattern, text, flags=re.M|re.DOTALL)
70     reqs = eval(match.group(1).replace('\n', ''))
71     with io.open('requirements.txt', 'w', encoding='utf-8') as reqs_file:
72         reqs_file.write('\n'.join(reqs))
73 
74 
75 @contextlib.contextmanager
76 def install_deps():
77     "Just in time make the deps available"
78     gen_deps()
79     tmpdir = tempfile.mkdtemp()
80     args = [
81         'install',
82         '-t', tmpdir,
83         '-r', 'requirements.txt',
84     ]
85     pip.main(args)
86     os.environ['PYTHONPATH'] = tmpdir
87     try:
88         yield tmpdir
89     finally:
90         shutil.rmtree(tmpdir)
91 
92 
93 if __name__ == '__main__':
94     ensure_egg_info()
95     with install_deps():
96         run_egg_info()
97
```
--- 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/bootstrap.py b/bootstrap.py
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -7,6 +7,7 @@
 
 from __future__ import unicode_literals
 
+import argparse
 import os
 import io
 import re
@@ -17,7 +18,6 @@
 import textwrap
 import subprocess
 
-import pip
 
 minimal_egg_info = textwrap.dedent("""
     [distutils.commands]
@@ -75,6 +75,7 @@
 @contextlib.contextmanager
 def install_deps():
     "Just in time make the deps available"
+    import pip
     gen_deps()
     tmpdir = tempfile.mkdtemp()
     args = [
@@ -91,6 +92,15 @@
 
 
 if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description='bootstrap setuptools')
+    parser.add_argument(
+        '--skip-dep-install', action='store_true',
+        help=("Do not attempt to install setuptools dependencies. These "
+              "should be provided in the environment in another manner."))
+    args = parser.parse_args()
     ensure_egg_info()
-    with install_deps():
+    if args.skip_dep_install:
         run_egg_info()
+    else:
+        with install_deps():
+            run_egg_info()

{"golden_diff": "diff --git a/bootstrap.py b/bootstrap.py\n--- a/bootstrap.py\n+++ b/bootstrap.py\n@@ -7,6 +7,7 @@\n \n from __future__ import unicode_literals\n \n+import argparse\n import os\n import io\n import re\n@@ -17,7 +18,6 @@\n import textwrap\n import subprocess\n \n-import pip\n \n minimal_egg_info = textwrap.dedent(\"\"\"\n     [distutils.commands]\n@@ -75,6 +75,7 @@\n @contextlib.contextmanager\n def install_deps():\n     \"Just in time make the deps available\"\n+    import pip\n     gen_deps()\n     tmpdir = tempfile.mkdtemp()\n     args = [\n@@ -91,6 +92,15 @@\n \n \n if __name__ == '__main__':\n+    parser = argparse.ArgumentParser(description='bootstrap setuptools')\n+    parser.add_argument(\n+        '--skip-dep-install', action='store_true',\n+        help=(\"Do not attempt to install setuptools dependencies. These \"\n+              \"should be provided in the environment in another manner.\"))\n+    args = parser.parse_args()\n     ensure_egg_info()\n-    with install_deps():\n+    if args.skip_dep_install:\n         run_egg_info()\n+    else:\n+        with install_deps():\n+            run_egg_info()\n", "issue": "bootstrap script cannot be executed without setuptools already installed\nThe `bootstrap.py` script cannot be used to bootstrap from an environment without setuptools.  The script imports `pip` which requires setuptools to be be installed.  This behavior was introduced in #933.\n", "before_files": [{"content": "\"\"\"\nIf setuptools is not already installed in the environment, it's not possible\nto invoke setuptools' own commands. This routine will bootstrap this local\nenvironment by creating a minimal egg-info directory and then invoking the\negg-info command to flesh out the egg-info directory.\n\"\"\"\n\nfrom __future__ import unicode_literals\n\nimport os\nimport io\nimport re\nimport contextlib\nimport tempfile\nimport shutil\nimport sys\nimport textwrap\nimport subprocess\n\nimport pip\n\nminimal_egg_info = textwrap.dedent(\"\"\"\n    [distutils.commands]\n    egg_info = setuptools.command.egg_info:egg_info\n\n    [distutils.setup_keywords]\n    include_package_data = setuptools.dist:assert_bool\n    install_requires = setuptools.dist:check_requirements\n    extras_require = setuptools.dist:check_extras\n    entry_points = setuptools.dist:check_entry_points\n\n    [egg_info.writers]\n    dependency_links.txt = setuptools.command.egg_info:overwrite_arg\n    entry_points.txt = setuptools.command.egg_info:write_entries\n    requires.txt = setuptools.command.egg_info:write_requirements\n    \"\"\")\n\n\ndef ensure_egg_info():\n    if os.path.exists('setuptools.egg-info'):\n        return\n    print(\"adding minimal entry_points\")\n    build_egg_info()\n\n\ndef build_egg_info():\n    \"\"\"\n    Build a minimal egg-info, enough to invoke egg_info\n    \"\"\"\n\n    os.mkdir('setuptools.egg-info')\n    filename = 'setuptools.egg-info/entry_points.txt'\n    with io.open(filename, 'w', encoding='utf-8') as ep:\n        ep.write(minimal_egg_info)\n\n\ndef run_egg_info():\n    cmd = [sys.executable, 'setup.py', 'egg_info']\n    print(\"Regenerating egg_info\")\n    subprocess.check_call(cmd)\n    print(\"...and again.\")\n    subprocess.check_call(cmd)\n\n\ndef gen_deps():\n    with io.open('setup.py', encoding='utf-8') as strm:\n        text = strm.read()\n    pattern = r'install_requires=\\[(.*?)\\]'\n    match = re.search(pattern, text, flags=re.M|re.DOTALL)\n    reqs = eval(match.group(1).replace('\\n', ''))\n    with io.open('requirements.txt', 'w', encoding='utf-8') as reqs_file:\n        reqs_file.write('\\n'.join(reqs))\n\n\n@contextlib.contextmanager\ndef install_deps():\n    \"Just in time make the deps available\"\n    gen_deps()\n    tmpdir = tempfile.mkdtemp()\n    args = [\n        'install',\n        '-t', tmpdir,\n        '-r', 'requirements.txt',\n    ]\n    pip.main(args)\n    os.environ['PYTHONPATH'] = tmpdir\n    try:\n        yield tmpdir\n    finally:\n        shutil.rmtree(tmpdir)\n\n\nif __name__ == '__main__':\n    ensure_egg_info()\n    with install_deps():\n        run_egg_info()\n", "path": "bootstrap.py"}], "after_files": [{"content": "\"\"\"\nIf setuptools is not already installed in the environment, it's not possible\nto invoke setuptools' own commands. This routine will bootstrap this local\nenvironment by creating a minimal egg-info directory and then invoking the\negg-info command to flesh out the egg-info directory.\n\"\"\"\n\nfrom __future__ import unicode_literals\n\nimport argparse\nimport os\nimport io\nimport re\nimport contextlib\nimport tempfile\nimport shutil\nimport sys\nimport textwrap\nimport subprocess\n\n\nminimal_egg_info = textwrap.dedent(\"\"\"\n    [distutils.commands]\n    egg_info = setuptools.command.egg_info:egg_info\n\n    [distutils.setup_keywords]\n    include_package_data = setuptools.dist:assert_bool\n    install_requires = setuptools.dist:check_requirements\n    extras_require = setuptools.dist:check_extras\n    entry_points = setuptools.dist:check_entry_points\n\n    [egg_info.writers]\n    dependency_links.txt = setuptools.command.egg_info:overwrite_arg\n    entry_points.txt = setuptools.command.egg_info:write_entries\n    requires.txt = setuptools.command.egg_info:write_requirements\n    \"\"\")\n\n\ndef ensure_egg_info():\n    if os.path.exists('setuptools.egg-info'):\n        return\n    print(\"adding minimal entry_points\")\n    build_egg_info()\n\n\ndef build_egg_info():\n    \"\"\"\n    Build a minimal egg-info, enough to invoke egg_info\n    \"\"\"\n\n    os.mkdir('setuptools.egg-info')\n    filename = 'setuptools.egg-info/entry_points.txt'\n    with io.open(filename, 'w', encoding='utf-8') as ep:\n        ep.write(minimal_egg_info)\n\n\ndef run_egg_info():\n    cmd = [sys.executable, 'setup.py', 'egg_info']\n    print(\"Regenerating egg_info\")\n    subprocess.check_call(cmd)\n    print(\"...and again.\")\n    subprocess.check_call(cmd)\n\n\ndef gen_deps():\n    with io.open('setup.py', encoding='utf-8') as strm:\n        text = strm.read()\n    pattern = r'install_requires=\\[(.*?)\\]'\n    match = re.search(pattern, text, flags=re.M|re.DOTALL)\n    reqs = eval(match.group(1).replace('\\n', ''))\n    with io.open('requirements.txt', 'w', encoding='utf-8') as reqs_file:\n        reqs_file.write('\\n'.join(reqs))\n\n\n@contextlib.contextmanager\ndef install_deps():\n    \"Just in time make the deps available\"\n    import pip\n    gen_deps()\n    tmpdir = tempfile.mkdtemp()\n    args = [\n        'install',\n        '-t', tmpdir,\n        '-r', 'requirements.txt',\n    ]\n    pip.main(args)\n    os.environ['PYTHONPATH'] = tmpdir\n    try:\n        yield tmpdir\n    finally:\n        shutil.rmtree(tmpdir)\n\n\nif __name__ == '__main__':\n    parser = argparse.ArgumentParser(description='bootstrap setuptools')\n    parser.add_argument(\n        '--skip-dep-install', action='store_true',\n        help=(\"Do not attempt to install setuptools dependencies. These \"\n              \"should be provided in the environment in another manner.\"))\n    args = parser.parse_args()\n    ensure_egg_info()\n    if args.skip_dep_install:\n        run_egg_info()\n    else:\n        with install_deps():\n            run_egg_info()\n", "path": "bootstrap.py"}]}