We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Running `pip install -e .` in the project root installs (no longer supported) IPython 2.3
Not sure if there's a straightforward fix for this until there's a version of IPython 3 on PyPI.  I spent a while playing with the setuptools `dependency_links` option to get this to install from github, to no avail.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 # coding: utf-8
3 
4 # Copyright (c) Juptyer Development Team.
5 # Distributed under the terms of the Modified BSD License.
6 
7 #-----------------------------------------------------------------------------
8 # Minimal Python version sanity check (from IPython)
9 #-----------------------------------------------------------------------------
10 
11 from __future__ import print_function
12 
13 import os
14 import sys
15 
16 v = sys.version_info
17 if v[:2] < (3,3):
18     error = "ERROR: Jupyter Hub requires Python version 3.3 or above."
19     print(error, file=sys.stderr)
20     sys.exit(1)
21 
22 
23 if os.name in ('nt', 'dos'):
24     error = "ERROR: Windows is not supported"
25     print(error, file=sys.stderr)
26 
27 # At least we're on the python version we need, move on.
28 
29 import os
30 
31 from glob import glob
32 
33 from distutils.core import setup
34 from subprocess import check_call
35 
36 pjoin = os.path.join
37 
38 here = os.path.abspath(os.path.dirname(__file__))
39 share_jupyter = pjoin(here, 'share', 'jupyter')
40 static = pjoin(share_jupyter, 'static')
41 
42 #---------------------------------------------------------------------------
43 # Build basic package data, etc.
44 #---------------------------------------------------------------------------
45 
46 def get_data_files():
47     """Get data files in share/jupyter"""
48     
49     data_files = []
50     ntrim = len(here) + 1
51     
52     for (d, dirs, filenames) in os.walk(share_jupyter):
53         data_files.append((
54             d[ntrim:],
55             [ pjoin(d, f) for f in filenames ]
56         ))
57     return data_files
58 
59 
60 ns = {}
61 with open(pjoin(here, 'jupyterhub', 'version.py')) as f:
62     exec(f.read(), {}, ns)
63 
64 
65 packages = []
66 for d, _, _ in os.walk('jupyterhub'):
67     if os.path.exists(pjoin(d, '__init__.py')):
68         packages.append(d.replace(os.path.sep, '.'))
69 
70 setup_args = dict(
71     name                = 'jupyterhub',
72     scripts             = glob(pjoin('scripts', '*')),
73     packages            = packages,
74                         # dummy, so that install_data doesn't get skipped
75                         # this will be overridden when bower is run anyway
76     data_files          = get_data_files() or ['dummy'],
77     version             = ns['__version__'],
78     description         = """JupyterHub: A multi-user server for Jupyter notebooks""",
79     long_description    = "",
80     author              = "Jupyter Development Team",
81     author_email        = "ipython-dev@scipy.org",
82     url                 = "http://jupyter.org",
83     license             = "BSD",
84     platforms           = "Linux, Mac OS X",
85     keywords            = ['Interactive', 'Interpreter', 'Shell', 'Web'],
86     classifiers         = [
87         'Intended Audience :: Developers',
88         'Intended Audience :: System Administrators',
89         'Intended Audience :: Science/Research',
90         'License :: OSI Approved :: BSD License',
91         'Programming Language :: Python',
92         'Programming Language :: Python :: 3',
93     ],
94 )
95 
96 #---------------------------------------------------------------------------
97 # custom distutils commands
98 #---------------------------------------------------------------------------
99 
100 # imports here, so they are after setuptools import if there was one
101 from distutils.cmd import Command
102 from distutils.command.install import install
103 
104 class BaseCommand(Command):
105     """Dumb empty command because Command needs subclasses to override too much"""
106     user_options = []
107     
108     def initialize_options(self):
109         pass
110     
111     def finalize_options(self):
112         pass
113     
114     def get_inputs(self):
115         return []
116     
117     def get_outputs(self):
118         return []
119 
120 
121 class Bower(BaseCommand):
122     description = "fetch static client-side components with bower"
123     
124     user_options = []
125     
126     def run(self):
127         try:
128             check_call(['bower', 'install', '--allow-root'])
129         except OSError as e:
130             print("Failed to run bower: %s" % e, file=sys.stderr)
131             print("You can install bower with `npm install -g bower`", file=sys.stderr)
132             raise
133         # update data-files in case this created new files
134         self.distribution.data_files = get_data_files()
135 
136 class CSS(BaseCommand):
137     description = "compile CSS from LESS"
138     
139     user_options = []
140     
141     def initialize_options(self):
142         pass
143     
144     def finalize_options(self):
145         pass
146     
147     def run(self):
148         style_less = pjoin(static, 'less', 'style.less')
149         style_css = pjoin(static, 'css', 'style.min.css')
150         sourcemap = style_css + '.map'
151         try:
152             check_call([
153                 'lessc', '-x', '--verbose',
154                 '--source-map-basepath={}'.format(static),
155                 '--source-map={}'.format(sourcemap),
156                 '--source-map-rootpath=../',
157                 style_less, style_css,
158             ])
159         except OSError as e:
160             print("Failed to run lessc: %s" % e, file=sys.stderr)
161             print("You can install less with `npm install -g less`", file=sys.stderr)
162             raise
163         # update data-files in case this created new files
164         self.distribution.data_files = get_data_files()
165 
166 # ensure bower is run as part of install
167 install.sub_commands.insert(0, ('js', None))
168 install.sub_commands.insert(1, ('css', None))
169 
170 setup_args['cmdclass'] = {
171     'js': Bower,
172     'css': CSS,
173 }
174 
175 
176 # setuptools requirements
177 
178 if 'setuptools' in sys.modules:
179     setup_args['zip_safe'] = False
180     from setuptools.command.develop import develop
181     class develop_js_css(develop):
182         def run(self):
183             if not self.uninstall:
184                 self.distribution.run_command('js')
185                 self.distribution.run_command('css')
186             develop.run(self)
187     setup_args['cmdclass']['develop'] = develop_js_css
188     setup_args['install_requires'] = install_requires = []
189 
190     with open('requirements.txt') as f:
191         for line in f.readlines():
192             req = line.strip()
193             if req.startswith('-e'):
194                 req = line.split('#egg=', 1)[1]
195             install_requires.append(req)
196 
197 #---------------------------------------------------------------------------
198 # setup
199 #---------------------------------------------------------------------------
200 
201 def main():
202     setup(**setup_args)
203 
204 if __name__ == '__main__':
205     main()
206
```
--- 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/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -190,8 +190,8 @@
     with open('requirements.txt') as f:
         for line in f.readlines():
             req = line.strip()
-            if req.startswith('-e'):
-                req = line.split('#egg=', 1)[1]
+            if not req or req.startswith(('-e', '#')):
+                continue
             install_requires.append(req)
 
 #---------------------------------------------------------------------------

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -190,8 +190,8 @@\n     with open('requirements.txt') as f:\n         for line in f.readlines():\n             req = line.strip()\n-            if req.startswith('-e'):\n-                req = line.split('#egg=', 1)[1]\n+            if not req or req.startswith(('-e', '#')):\n+                continue\n             install_requires.append(req)\n \n #---------------------------------------------------------------------------\n", "issue": "Running `pip install -e .` in the project root installs (no longer supported) IPython 2.3\nNot sure if there's a straightforward fix for this until there's a version of IPython 3 on PyPI.  I spent a while playing with the setuptools `dependency_links` option to get this to install from github, to no avail.\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# coding: utf-8\n\n# Copyright (c) Juptyer Development Team.\n# Distributed under the terms of the Modified BSD License.\n\n#-----------------------------------------------------------------------------\n# Minimal Python version sanity check (from IPython)\n#-----------------------------------------------------------------------------\n\nfrom __future__ import print_function\n\nimport os\nimport sys\n\nv = sys.version_info\nif v[:2] < (3,3):\n    error = \"ERROR: Jupyter Hub requires Python version 3.3 or above.\"\n    print(error, file=sys.stderr)\n    sys.exit(1)\n\n\nif os.name in ('nt', 'dos'):\n    error = \"ERROR: Windows is not supported\"\n    print(error, file=sys.stderr)\n\n# At least we're on the python version we need, move on.\n\nimport os\n\nfrom glob import glob\n\nfrom distutils.core import setup\nfrom subprocess import check_call\n\npjoin = os.path.join\n\nhere = os.path.abspath(os.path.dirname(__file__))\nshare_jupyter = pjoin(here, 'share', 'jupyter')\nstatic = pjoin(share_jupyter, 'static')\n\n#---------------------------------------------------------------------------\n# Build basic package data, etc.\n#---------------------------------------------------------------------------\n\ndef get_data_files():\n    \"\"\"Get data files in share/jupyter\"\"\"\n    \n    data_files = []\n    ntrim = len(here) + 1\n    \n    for (d, dirs, filenames) in os.walk(share_jupyter):\n        data_files.append((\n            d[ntrim:],\n            [ pjoin(d, f) for f in filenames ]\n        ))\n    return data_files\n\n\nns = {}\nwith open(pjoin(here, 'jupyterhub', 'version.py')) as f:\n    exec(f.read(), {}, ns)\n\n\npackages = []\nfor d, _, _ in os.walk('jupyterhub'):\n    if os.path.exists(pjoin(d, '__init__.py')):\n        packages.append(d.replace(os.path.sep, '.'))\n\nsetup_args = dict(\n    name                = 'jupyterhub',\n    scripts             = glob(pjoin('scripts', '*')),\n    packages            = packages,\n                        # dummy, so that install_data doesn't get skipped\n                        # this will be overridden when bower is run anyway\n    data_files          = get_data_files() or ['dummy'],\n    version             = ns['__version__'],\n    description         = \"\"\"JupyterHub: A multi-user server for Jupyter notebooks\"\"\",\n    long_description    = \"\",\n    author              = \"Jupyter Development Team\",\n    author_email        = \"ipython-dev@scipy.org\",\n    url                 = \"http://jupyter.org\",\n    license             = \"BSD\",\n    platforms           = \"Linux, Mac OS X\",\n    keywords            = ['Interactive', 'Interpreter', 'Shell', 'Web'],\n    classifiers         = [\n        'Intended Audience :: Developers',\n        'Intended Audience :: System Administrators',\n        'Intended Audience :: Science/Research',\n        'License :: OSI Approved :: BSD License',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 3',\n    ],\n)\n\n#---------------------------------------------------------------------------\n# custom distutils commands\n#---------------------------------------------------------------------------\n\n# imports here, so they are after setuptools import if there was one\nfrom distutils.cmd import Command\nfrom distutils.command.install import install\n\nclass BaseCommand(Command):\n    \"\"\"Dumb empty command because Command needs subclasses to override too much\"\"\"\n    user_options = []\n    \n    def initialize_options(self):\n        pass\n    \n    def finalize_options(self):\n        pass\n    \n    def get_inputs(self):\n        return []\n    \n    def get_outputs(self):\n        return []\n\n\nclass Bower(BaseCommand):\n    description = \"fetch static client-side components with bower\"\n    \n    user_options = []\n    \n    def run(self):\n        try:\n            check_call(['bower', 'install', '--allow-root'])\n        except OSError as e:\n            print(\"Failed to run bower: %s\" % e, file=sys.stderr)\n            print(\"You can install bower with `npm install -g bower`\", file=sys.stderr)\n            raise\n        # update data-files in case this created new files\n        self.distribution.data_files = get_data_files()\n\nclass CSS(BaseCommand):\n    description = \"compile CSS from LESS\"\n    \n    user_options = []\n    \n    def initialize_options(self):\n        pass\n    \n    def finalize_options(self):\n        pass\n    \n    def run(self):\n        style_less = pjoin(static, 'less', 'style.less')\n        style_css = pjoin(static, 'css', 'style.min.css')\n        sourcemap = style_css + '.map'\n        try:\n            check_call([\n                'lessc', '-x', '--verbose',\n                '--source-map-basepath={}'.format(static),\n                '--source-map={}'.format(sourcemap),\n                '--source-map-rootpath=../',\n                style_less, style_css,\n            ])\n        except OSError as e:\n            print(\"Failed to run lessc: %s\" % e, file=sys.stderr)\n            print(\"You can install less with `npm install -g less`\", file=sys.stderr)\n            raise\n        # update data-files in case this created new files\n        self.distribution.data_files = get_data_files()\n\n# ensure bower is run as part of install\ninstall.sub_commands.insert(0, ('js', None))\ninstall.sub_commands.insert(1, ('css', None))\n\nsetup_args['cmdclass'] = {\n    'js': Bower,\n    'css': CSS,\n}\n\n\n# setuptools requirements\n\nif 'setuptools' in sys.modules:\n    setup_args['zip_safe'] = False\n    from setuptools.command.develop import develop\n    class develop_js_css(develop):\n        def run(self):\n            if not self.uninstall:\n                self.distribution.run_command('js')\n                self.distribution.run_command('css')\n            develop.run(self)\n    setup_args['cmdclass']['develop'] = develop_js_css\n    setup_args['install_requires'] = install_requires = []\n\n    with open('requirements.txt') as f:\n        for line in f.readlines():\n            req = line.strip()\n            if req.startswith('-e'):\n                req = line.split('#egg=', 1)[1]\n            install_requires.append(req)\n\n#---------------------------------------------------------------------------\n# setup\n#---------------------------------------------------------------------------\n\ndef main():\n    setup(**setup_args)\n\nif __name__ == '__main__':\n    main()\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# coding: utf-8\n\n# Copyright (c) Juptyer Development Team.\n# Distributed under the terms of the Modified BSD License.\n\n#-----------------------------------------------------------------------------\n# Minimal Python version sanity check (from IPython)\n#-----------------------------------------------------------------------------\n\nfrom __future__ import print_function\n\nimport os\nimport sys\n\nv = sys.version_info\nif v[:2] < (3,3):\n    error = \"ERROR: Jupyter Hub requires Python version 3.3 or above.\"\n    print(error, file=sys.stderr)\n    sys.exit(1)\n\n\nif os.name in ('nt', 'dos'):\n    error = \"ERROR: Windows is not supported\"\n    print(error, file=sys.stderr)\n\n# At least we're on the python version we need, move on.\n\nimport os\n\nfrom glob import glob\n\nfrom distutils.core import setup\nfrom subprocess import check_call\n\npjoin = os.path.join\n\nhere = os.path.abspath(os.path.dirname(__file__))\nshare_jupyter = pjoin(here, 'share', 'jupyter')\nstatic = pjoin(share_jupyter, 'static')\n\n#---------------------------------------------------------------------------\n# Build basic package data, etc.\n#---------------------------------------------------------------------------\n\ndef get_data_files():\n    \"\"\"Get data files in share/jupyter\"\"\"\n    \n    data_files = []\n    ntrim = len(here) + 1\n    \n    for (d, dirs, filenames) in os.walk(share_jupyter):\n        data_files.append((\n            d[ntrim:],\n            [ pjoin(d, f) for f in filenames ]\n        ))\n    return data_files\n\n\nns = {}\nwith open(pjoin(here, 'jupyterhub', 'version.py')) as f:\n    exec(f.read(), {}, ns)\n\n\npackages = []\nfor d, _, _ in os.walk('jupyterhub'):\n    if os.path.exists(pjoin(d, '__init__.py')):\n        packages.append(d.replace(os.path.sep, '.'))\n\nsetup_args = dict(\n    name                = 'jupyterhub',\n    scripts             = glob(pjoin('scripts', '*')),\n    packages            = packages,\n                        # dummy, so that install_data doesn't get skipped\n                        # this will be overridden when bower is run anyway\n    data_files          = get_data_files() or ['dummy'],\n    version             = ns['__version__'],\n    description         = \"\"\"JupyterHub: A multi-user server for Jupyter notebooks\"\"\",\n    long_description    = \"\",\n    author              = \"Jupyter Development Team\",\n    author_email        = \"ipython-dev@scipy.org\",\n    url                 = \"http://jupyter.org\",\n    license             = \"BSD\",\n    platforms           = \"Linux, Mac OS X\",\n    keywords            = ['Interactive', 'Interpreter', 'Shell', 'Web'],\n    classifiers         = [\n        'Intended Audience :: Developers',\n        'Intended Audience :: System Administrators',\n        'Intended Audience :: Science/Research',\n        'License :: OSI Approved :: BSD License',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 3',\n    ],\n)\n\n#---------------------------------------------------------------------------\n# custom distutils commands\n#---------------------------------------------------------------------------\n\n# imports here, so they are after setuptools import if there was one\nfrom distutils.cmd import Command\nfrom distutils.command.install import install\n\nclass BaseCommand(Command):\n    \"\"\"Dumb empty command because Command needs subclasses to override too much\"\"\"\n    user_options = []\n    \n    def initialize_options(self):\n        pass\n    \n    def finalize_options(self):\n        pass\n    \n    def get_inputs(self):\n        return []\n    \n    def get_outputs(self):\n        return []\n\n\nclass Bower(BaseCommand):\n    description = \"fetch static client-side components with bower\"\n    \n    user_options = []\n    \n    def run(self):\n        try:\n            check_call(['bower', 'install', '--allow-root'])\n        except OSError as e:\n            print(\"Failed to run bower: %s\" % e, file=sys.stderr)\n            print(\"You can install bower with `npm install -g bower`\", file=sys.stderr)\n            raise\n        # update data-files in case this created new files\n        self.distribution.data_files = get_data_files()\n\nclass CSS(BaseCommand):\n    description = \"compile CSS from LESS\"\n    \n    user_options = []\n    \n    def initialize_options(self):\n        pass\n    \n    def finalize_options(self):\n        pass\n    \n    def run(self):\n        style_less = pjoin(static, 'less', 'style.less')\n        style_css = pjoin(static, 'css', 'style.min.css')\n        sourcemap = style_css + '.map'\n        try:\n            check_call([\n                'lessc', '-x', '--verbose',\n                '--source-map-basepath={}'.format(static),\n                '--source-map={}'.format(sourcemap),\n                '--source-map-rootpath=../',\n                style_less, style_css,\n            ])\n        except OSError as e:\n            print(\"Failed to run lessc: %s\" % e, file=sys.stderr)\n            print(\"You can install less with `npm install -g less`\", file=sys.stderr)\n            raise\n        # update data-files in case this created new files\n        self.distribution.data_files = get_data_files()\n\n# ensure bower is run as part of install\ninstall.sub_commands.insert(0, ('js', None))\ninstall.sub_commands.insert(1, ('css', None))\n\nsetup_args['cmdclass'] = {\n    'js': Bower,\n    'css': CSS,\n}\n\n\n# setuptools requirements\n\nif 'setuptools' in sys.modules:\n    setup_args['zip_safe'] = False\n    from setuptools.command.develop import develop\n    class develop_js_css(develop):\n        def run(self):\n            if not self.uninstall:\n                self.distribution.run_command('js')\n                self.distribution.run_command('css')\n            develop.run(self)\n    setup_args['cmdclass']['develop'] = develop_js_css\n    setup_args['install_requires'] = install_requires = []\n\n    with open('requirements.txt') as f:\n        for line in f.readlines():\n            req = line.strip()\n            if not req or req.startswith(('-e', '#')):\n                continue\n            install_requires.append(req)\n\n#---------------------------------------------------------------------------\n# setup\n#---------------------------------------------------------------------------\n\ndef main():\n    setup(**setup_args)\n\nif __name__ == '__main__':\n    main()\n", "path": "setup.py"}]}