We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Recursive directory lookup can take long
This [line](https://github.com/facebookresearch/habitat-api/blob/master/setup.py#L38) looks for requirements.txt under all directories, this can be especially costly if you have data directories. 

One way to get around this is to only look at specific set of directories and ignore data directories.

--- 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 python3
2 
3 # Copyright (c) Facebook, Inc. and its affiliates.
4 # This source code is licensed under the MIT license found in the
5 # LICENSE file in the root directory of this source tree.
6 
7 import glob
8 import os.path
9 import sys
10 
11 import setuptools
12 from setuptools.command.develop import develop as DefaultDevelopCommand
13 from setuptools.command.install import install as DefaultInstallCommand
14 
15 sys.path.insert(0, os.path.join(os.path.dirname(__file__), "habitat"))
16 from version import VERSION  # isort:skip noqa
17 
18 
19 with open("README.md", encoding="utf8") as f:
20     readme = f.read()
21 
22 with open("LICENSE") as f:
23     license = f.read()
24 
25 with open("requirements.txt") as f:
26     reqs = f.read()
27 
28 DISTNAME = "habitat"
29 DESCRIPTION = "habitat: a suite for embodied agent tasks and benchmarks"
30 LONG_DESCRIPTION = readme
31 AUTHOR = "Facebook AI Research"
32 LICENSE = license
33 REQUIREMENTS = reqs.strip().split("\n")
34 BASELINE_PATH = ["habitat_baselines", "habitat_baselines.*"]
35 DEFAULT_EXCLUSION = ["test", "examples"]
36 FULL_REQUIREMENTS = set()
37 # collect requirements.txt file in all subdirectories
38 for file_name in glob.glob("**/requirements.txt", recursive=True):
39     with open(file_name) as f:
40         reqs = f.read()
41         FULL_REQUIREMENTS.update(reqs.strip().split("\n"))
42 
43 
44 class OptionedCommand:
45     r"""Generic Command class that takes extra user options and modifies
46     arguments in setuptools.setup() accordingly.
47     Though OptionedCommand inherits directly from object, it assumes
48     inheritance from DefaultDevelopCommand or DefaultInstallCommand, as it
49     overrides methods from those two classes.
50     """
51 
52     user_options = [("all", None, "include habitat_baselines in installation")]
53 
54     def initialize_options(self):
55         super().initialize_options()
56         self.all = None
57 
58     def run(self):
59         if not self.all:  # install core only
60             DEFAULT_EXCLUSION.extend(BASELINE_PATH)
61             self.distribution.packages = setuptools.find_packages(
62                 exclude=DEFAULT_EXCLUSION
63             )
64             # self.distribution accesses arguments of setup() in main()
65         else:  # install all except test and examples
66             self.distribution.install_requires = FULL_REQUIREMENTS
67         super().run()
68 
69 
70 class InstallCommand(OptionedCommand, DefaultInstallCommand):
71     user_options = (
72         getattr(DefaultInstallCommand, "user_options", [])
73         + OptionedCommand.user_options
74     )
75 
76 
77 class DevelopCommand(OptionedCommand, DefaultDevelopCommand):
78     user_options = (
79         getattr(DefaultDevelopCommand, "user_options", [])
80         + OptionedCommand.user_options
81     )
82 
83 
84 if __name__ == "__main__":
85     setuptools.setup(
86         name=DISTNAME,
87         install_requires=REQUIREMENTS,
88         packages=setuptools.find_packages(exclude=DEFAULT_EXCLUSION),
89         version=VERSION,
90         description=DESCRIPTION,
91         long_description=LONG_DESCRIPTION,
92         author=AUTHOR,
93         license=LICENSE,
94         setup_requires=["pytest-runner"],
95         tests_require=["pytest"],
96         include_package_data=True,
97         cmdclass={"install": InstallCommand, "develop": DevelopCommand},
98     )
99
```
--- 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
@@ -35,7 +35,9 @@
 DEFAULT_EXCLUSION = ["test", "examples"]
 FULL_REQUIREMENTS = set()
 # collect requirements.txt file in all subdirectories
-for file_name in glob.glob("**/requirements.txt", recursive=True):
+for file_name in ["requirements.txt"] + glob.glob(
+    "habitat_baselines/**/requirements.txt", recursive=True
+):
     with open(file_name) as f:
         reqs = f.read()
         FULL_REQUIREMENTS.update(reqs.strip().split("\n"))

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -35,7 +35,9 @@\n DEFAULT_EXCLUSION = [\"test\", \"examples\"]\n FULL_REQUIREMENTS = set()\n # collect requirements.txt file in all subdirectories\n-for file_name in glob.glob(\"**/requirements.txt\", recursive=True):\n+for file_name in [\"requirements.txt\"] + glob.glob(\n+    \"habitat_baselines/**/requirements.txt\", recursive=True\n+):\n     with open(file_name) as f:\n         reqs = f.read()\n         FULL_REQUIREMENTS.update(reqs.strip().split(\"\\n\"))\n", "issue": "Recursive directory lookup can take long\nThis [line](https://github.com/facebookresearch/habitat-api/blob/master/setup.py#L38) looks for requirements.txt under all directories, this can be especially costly if you have data directories. \r\n\r\nOne way to get around this is to only look at specific set of directories and ignore data directories.\n", "before_files": [{"content": "#!/usr/bin/env python3\n\n# Copyright (c) Facebook, Inc. and its affiliates.\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\n\nimport glob\nimport os.path\nimport sys\n\nimport setuptools\nfrom setuptools.command.develop import develop as DefaultDevelopCommand\nfrom setuptools.command.install import install as DefaultInstallCommand\n\nsys.path.insert(0, os.path.join(os.path.dirname(__file__), \"habitat\"))\nfrom version import VERSION  # isort:skip noqa\n\n\nwith open(\"README.md\", encoding=\"utf8\") as f:\n    readme = f.read()\n\nwith open(\"LICENSE\") as f:\n    license = f.read()\n\nwith open(\"requirements.txt\") as f:\n    reqs = f.read()\n\nDISTNAME = \"habitat\"\nDESCRIPTION = \"habitat: a suite for embodied agent tasks and benchmarks\"\nLONG_DESCRIPTION = readme\nAUTHOR = \"Facebook AI Research\"\nLICENSE = license\nREQUIREMENTS = reqs.strip().split(\"\\n\")\nBASELINE_PATH = [\"habitat_baselines\", \"habitat_baselines.*\"]\nDEFAULT_EXCLUSION = [\"test\", \"examples\"]\nFULL_REQUIREMENTS = set()\n# collect requirements.txt file in all subdirectories\nfor file_name in glob.glob(\"**/requirements.txt\", recursive=True):\n    with open(file_name) as f:\n        reqs = f.read()\n        FULL_REQUIREMENTS.update(reqs.strip().split(\"\\n\"))\n\n\nclass OptionedCommand:\n    r\"\"\"Generic Command class that takes extra user options and modifies\n    arguments in setuptools.setup() accordingly.\n    Though OptionedCommand inherits directly from object, it assumes\n    inheritance from DefaultDevelopCommand or DefaultInstallCommand, as it\n    overrides methods from those two classes.\n    \"\"\"\n\n    user_options = [(\"all\", None, \"include habitat_baselines in installation\")]\n\n    def initialize_options(self):\n        super().initialize_options()\n        self.all = None\n\n    def run(self):\n        if not self.all:  # install core only\n            DEFAULT_EXCLUSION.extend(BASELINE_PATH)\n            self.distribution.packages = setuptools.find_packages(\n                exclude=DEFAULT_EXCLUSION\n            )\n            # self.distribution accesses arguments of setup() in main()\n        else:  # install all except test and examples\n            self.distribution.install_requires = FULL_REQUIREMENTS\n        super().run()\n\n\nclass InstallCommand(OptionedCommand, DefaultInstallCommand):\n    user_options = (\n        getattr(DefaultInstallCommand, \"user_options\", [])\n        + OptionedCommand.user_options\n    )\n\n\nclass DevelopCommand(OptionedCommand, DefaultDevelopCommand):\n    user_options = (\n        getattr(DefaultDevelopCommand, \"user_options\", [])\n        + OptionedCommand.user_options\n    )\n\n\nif __name__ == \"__main__\":\n    setuptools.setup(\n        name=DISTNAME,\n        install_requires=REQUIREMENTS,\n        packages=setuptools.find_packages(exclude=DEFAULT_EXCLUSION),\n        version=VERSION,\n        description=DESCRIPTION,\n        long_description=LONG_DESCRIPTION,\n        author=AUTHOR,\n        license=LICENSE,\n        setup_requires=[\"pytest-runner\"],\n        tests_require=[\"pytest\"],\n        include_package_data=True,\n        cmdclass={\"install\": InstallCommand, \"develop\": DevelopCommand},\n    )\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\n# Copyright (c) Facebook, Inc. and its affiliates.\n# This source code is licensed under the MIT license found in the\n# LICENSE file in the root directory of this source tree.\n\nimport glob\nimport os.path\nimport sys\n\nimport setuptools\nfrom setuptools.command.develop import develop as DefaultDevelopCommand\nfrom setuptools.command.install import install as DefaultInstallCommand\n\nsys.path.insert(0, os.path.join(os.path.dirname(__file__), \"habitat\"))\nfrom version import VERSION  # isort:skip noqa\n\n\nwith open(\"README.md\", encoding=\"utf8\") as f:\n    readme = f.read()\n\nwith open(\"LICENSE\") as f:\n    license = f.read()\n\nwith open(\"requirements.txt\") as f:\n    reqs = f.read()\n\nDISTNAME = \"habitat\"\nDESCRIPTION = \"habitat: a suite for embodied agent tasks and benchmarks\"\nLONG_DESCRIPTION = readme\nAUTHOR = \"Facebook AI Research\"\nLICENSE = license\nREQUIREMENTS = reqs.strip().split(\"\\n\")\nBASELINE_PATH = [\"habitat_baselines\", \"habitat_baselines.*\"]\nDEFAULT_EXCLUSION = [\"test\", \"examples\"]\nFULL_REQUIREMENTS = set()\n# collect requirements.txt file in all subdirectories\nfor file_name in [\"requirements.txt\"] + glob.glob(\n    \"habitat_baselines/**/requirements.txt\", recursive=True\n):\n    with open(file_name) as f:\n        reqs = f.read()\n        FULL_REQUIREMENTS.update(reqs.strip().split(\"\\n\"))\n\n\nclass OptionedCommand:\n    r\"\"\"Generic Command class that takes extra user options and modifies\n    arguments in setuptools.setup() accordingly.\n    Though OptionedCommand inherits directly from object, it assumes\n    inheritance from DefaultDevelopCommand or DefaultInstallCommand, as it\n    overrides methods from those two classes.\n    \"\"\"\n\n    user_options = [(\"all\", None, \"include habitat_baselines in installation\")]\n\n    def initialize_options(self):\n        super().initialize_options()\n        self.all = None\n\n    def run(self):\n        if not self.all:  # install core only\n            DEFAULT_EXCLUSION.extend(BASELINE_PATH)\n            self.distribution.packages = setuptools.find_packages(\n                exclude=DEFAULT_EXCLUSION\n            )\n            # self.distribution accesses arguments of setup() in main()\n        else:  # install all except test and examples\n            self.distribution.install_requires = FULL_REQUIREMENTS\n        super().run()\n\n\nclass InstallCommand(OptionedCommand, DefaultInstallCommand):\n    user_options = (\n        getattr(DefaultInstallCommand, \"user_options\", [])\n        + OptionedCommand.user_options\n    )\n\n\nclass DevelopCommand(OptionedCommand, DefaultDevelopCommand):\n    user_options = (\n        getattr(DefaultDevelopCommand, \"user_options\", [])\n        + OptionedCommand.user_options\n    )\n\n\nif __name__ == \"__main__\":\n    setuptools.setup(\n        name=DISTNAME,\n        install_requires=REQUIREMENTS,\n        packages=setuptools.find_packages(exclude=DEFAULT_EXCLUSION),\n        version=VERSION,\n        description=DESCRIPTION,\n        long_description=LONG_DESCRIPTION,\n        author=AUTHOR,\n        license=LICENSE,\n        setup_requires=[\"pytest-runner\"],\n        tests_require=[\"pytest\"],\n        include_package_data=True,\n        cmdclass={\"install\": InstallCommand, \"develop\": DevelopCommand},\n    )\n", "path": "setup.py"}]}