We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Remove docutils.conf - enable smart quotes for builders
Blocked on:

- [x] https://github.com/sphinx-doc/sphinx/pull/4110
  - [x] Sphinx release
- [x] https://github.com/sphinx-contrib/spelling/pull/2
  - [x] sphinxcontrib-spelling release

--- 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 
3 # This file is dual licensed under the terms of the Apache License, Version
4 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
5 # for complete details.
6 
7 from __future__ import absolute_import, division, print_function
8 
9 import os
10 import platform
11 import subprocess
12 import sys
13 from distutils.command.build import build
14 
15 import pkg_resources
16 
17 from setuptools import find_packages, setup
18 from setuptools.command.install import install
19 from setuptools.command.test import test
20 
21 
22 base_dir = os.path.dirname(__file__)
23 src_dir = os.path.join(base_dir, "src")
24 
25 # When executing the setup.py, we need to be able to import ourselves, this
26 # means that we need to add the src/ directory to the sys.path.
27 sys.path.insert(0, src_dir)
28 
29 about = {}
30 with open(os.path.join(src_dir, "cryptography", "__about__.py")) as f:
31     exec(f.read(), about)
32 
33 
34 VECTORS_DEPENDENCY = "cryptography_vectors=={0}".format(about['__version__'])
35 
36 setup_requirements = []
37 
38 if platform.python_implementation() == "PyPy":
39     if sys.pypy_version_info < (5, 3):
40         raise RuntimeError(
41             "cryptography 1.9 is not compatible with PyPy < 5.3. Please "
42             "upgrade PyPy to use this library."
43         )
44 else:
45     setup_requirements.append("cffi>=1.7")
46 
47 test_requirements = [
48     "pytest>=3.2.1",
49     "pretend",
50     "iso8601",
51     "pytz",
52     "hypothesis>=1.11.4",
53 ]
54 
55 
56 # If there's no vectors locally that probably means we are in a tarball and
57 # need to go and get the matching vectors package from PyPi
58 if not os.path.exists(os.path.join(base_dir, "vectors/setup.py")):
59     test_requirements.append(VECTORS_DEPENDENCY)
60 
61 
62 class PyTest(test):
63     def finalize_options(self):
64         test.finalize_options(self)
65         self.test_args = []
66         self.test_suite = True
67 
68         # This means there's a vectors/ folder with the package in here.
69         # cd into it, install the vectors package and then refresh sys.path
70         if VECTORS_DEPENDENCY not in test_requirements:
71             subprocess.check_call(
72                 [sys.executable, "setup.py", "install"], cwd="vectors"
73             )
74             pkg_resources.get_distribution("cryptography_vectors").activate()
75 
76     def run_tests(self):
77         # Import here because in module scope the eggs are not loaded.
78         import pytest
79         test_args = [os.path.join(base_dir, "tests")]
80         errno = pytest.main(test_args)
81         sys.exit(errno)
82 
83 
84 def keywords_with_side_effects(argv):
85     """
86     Get a dictionary with setup keywords that (can) have side effects.
87 
88     :param argv: A list of strings with command line arguments.
89     :returns: A dictionary with keyword arguments for the ``setup()`` function.
90 
91     This setup.py script uses the setuptools 'setup_requires' feature because
92     this is required by the cffi package to compile extension modules. The
93     purpose of ``keywords_with_side_effects()`` is to avoid triggering the cffi
94     build process as a result of setup.py invocations that don't need the cffi
95     module to be built (setup.py serves the dual purpose of exposing package
96     metadata).
97 
98     All of the options listed by ``python setup.py --help`` that print
99     information should be recognized here. The commands ``clean``,
100     ``egg_info``, ``register``, ``sdist`` and ``upload`` are also recognized.
101     Any combination of these options and commands is also supported.
102 
103     This function was originally based on the `setup.py script`_ of SciPy (see
104     also the discussion in `pip issue #25`_).
105 
106     .. _pip issue #25: https://github.com/pypa/pip/issues/25
107     .. _setup.py script: https://github.com/scipy/scipy/blob/master/setup.py
108     """
109     no_setup_requires_arguments = (
110         '-h', '--help',
111         '-n', '--dry-run',
112         '-q', '--quiet',
113         '-v', '--verbose',
114         '-V', '--version',
115         '--author',
116         '--author-email',
117         '--classifiers',
118         '--contact',
119         '--contact-email',
120         '--description',
121         '--egg-base',
122         '--fullname',
123         '--help-commands',
124         '--keywords',
125         '--licence',
126         '--license',
127         '--long-description',
128         '--maintainer',
129         '--maintainer-email',
130         '--name',
131         '--no-user-cfg',
132         '--obsoletes',
133         '--platforms',
134         '--provides',
135         '--requires',
136         '--url',
137         'clean',
138         'egg_info',
139         'register',
140         'sdist',
141         'upload',
142     )
143 
144     def is_short_option(argument):
145         """Check whether a command line argument is a short option."""
146         return len(argument) >= 2 and argument[0] == '-' and argument[1] != '-'
147 
148     def expand_short_options(argument):
149         """Expand combined short options into canonical short options."""
150         return ('-' + char for char in argument[1:])
151 
152     def argument_without_setup_requirements(argv, i):
153         """Check whether a command line argument needs setup requirements."""
154         if argv[i] in no_setup_requires_arguments:
155             # Simple case: An argument which is either an option or a command
156             # which doesn't need setup requirements.
157             return True
158         elif (is_short_option(argv[i]) and
159               all(option in no_setup_requires_arguments
160                   for option in expand_short_options(argv[i]))):
161             # Not so simple case: Combined short options none of which need
162             # setup requirements.
163             return True
164         elif argv[i - 1:i] == ['--egg-base']:
165             # Tricky case: --egg-info takes an argument which should not make
166             # us use setup_requires (defeating the purpose of this code).
167             return True
168         else:
169             return False
170 
171     if all(argument_without_setup_requirements(argv, i)
172            for i in range(1, len(argv))):
173         return {
174             "cmdclass": {
175                 "build": DummyBuild,
176                 "install": DummyInstall,
177                 "test": DummyPyTest,
178             }
179         }
180     else:
181         cffi_modules = [
182             "src/_cffi_src/build_openssl.py:ffi",
183             "src/_cffi_src/build_constant_time.py:ffi",
184             "src/_cffi_src/build_padding.py:ffi",
185         ]
186 
187         return {
188             "setup_requires": setup_requirements,
189             "cmdclass": {
190                 "test": PyTest,
191             },
192             "cffi_modules": cffi_modules
193         }
194 
195 
196 setup_requires_error = ("Requested setup command that needs 'setup_requires' "
197                         "while command line arguments implied a side effect "
198                         "free command or option.")
199 
200 
201 class DummyBuild(build):
202     """
203     This class makes it very obvious when ``keywords_with_side_effects()`` has
204     incorrectly interpreted the command line arguments to ``setup.py build`` as
205     one of the 'side effect free' commands or options.
206     """
207 
208     def run(self):
209         raise RuntimeError(setup_requires_error)
210 
211 
212 class DummyInstall(install):
213     """
214     This class makes it very obvious when ``keywords_with_side_effects()`` has
215     incorrectly interpreted the command line arguments to ``setup.py install``
216     as one of the 'side effect free' commands or options.
217     """
218 
219     def run(self):
220         raise RuntimeError(setup_requires_error)
221 
222 
223 class DummyPyTest(test):
224     """
225     This class makes it very obvious when ``keywords_with_side_effects()`` has
226     incorrectly interpreted the command line arguments to ``setup.py test`` as
227     one of the 'side effect free' commands or options.
228     """
229 
230     def run_tests(self):
231         raise RuntimeError(setup_requires_error)
232 
233 
234 with open(os.path.join(base_dir, "README.rst")) as f:
235     long_description = f.read()
236 
237 
238 setup(
239     name=about["__title__"],
240     version=about["__version__"],
241 
242     description=about["__summary__"],
243     long_description=long_description,
244     license=about["__license__"],
245     url=about["__uri__"],
246 
247     author=about["__author__"],
248     author_email=about["__email__"],
249 
250     classifiers=[
251         "Intended Audience :: Developers",
252         "License :: OSI Approved :: Apache Software License",
253         "License :: OSI Approved :: BSD License",
254         "Natural Language :: English",
255         "Operating System :: MacOS :: MacOS X",
256         "Operating System :: POSIX",
257         "Operating System :: POSIX :: BSD",
258         "Operating System :: POSIX :: Linux",
259         "Operating System :: Microsoft :: Windows",
260         "Programming Language :: Python",
261         "Programming Language :: Python :: 2",
262         "Programming Language :: Python :: 2.7",
263         "Programming Language :: Python :: 3",
264         "Programming Language :: Python :: 3.4",
265         "Programming Language :: Python :: 3.5",
266         "Programming Language :: Python :: 3.6",
267         "Programming Language :: Python :: Implementation :: CPython",
268         "Programming Language :: Python :: Implementation :: PyPy",
269         "Topic :: Security :: Cryptography",
270     ],
271 
272     package_dir={"": "src"},
273     packages=find_packages(where="src", exclude=["_cffi_src", "_cffi_src.*"]),
274     include_package_data=True,
275 
276     install_requires=[
277         "idna >= 2.1",
278         "asn1crypto >= 0.21.0",
279         "six >= 1.4.1",
280     ],
281     tests_require=test_requirements,
282     extras_require={
283         ":python_version < '3'": ["enum34", "ipaddress"],
284         ":platform_python_implementation != 'PyPy'": ["cffi >= 1.7"],
285 
286         "test": test_requirements,
287         "docstest": [
288             "doc8",
289             "pyenchant >= 1.6.11",
290             "readme_renderer >= 16.0",
291             "sphinx",
292             "sphinx_rtd_theme",
293             "sphinxcontrib-spelling",
294         ],
295         "pep8test": [
296             "flake8",
297             "flake8-import-order",
298             "pep8-naming",
299         ],
300     },
301 
302     # for cffi
303     zip_safe=False,
304     ext_package="cryptography.hazmat.bindings",
305     **keywords_with_side_effects(sys.argv)
306 )
307
```
--- 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
@@ -288,9 +288,9 @@
             "doc8",
             "pyenchant >= 1.6.11",
             "readme_renderer >= 16.0",
-            "sphinx",
+            "sphinx >= 1.6.5",
             "sphinx_rtd_theme",
-            "sphinxcontrib-spelling",
+            "sphinxcontrib-spelling >= 4.0.1",
         ],
         "pep8test": [
             "flake8",

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -288,9 +288,9 @@\n             \"doc8\",\n             \"pyenchant >= 1.6.11\",\n             \"readme_renderer >= 16.0\",\n-            \"sphinx\",\n+            \"sphinx >= 1.6.5\",\n             \"sphinx_rtd_theme\",\n-            \"sphinxcontrib-spelling\",\n+            \"sphinxcontrib-spelling >= 4.0.1\",\n         ],\n         \"pep8test\": [\n             \"flake8\",\n", "issue": "Remove docutils.conf - enable smart quotes for builders\nBlocked on:\r\n\r\n- [x] https://github.com/sphinx-doc/sphinx/pull/4110\r\n  - [x] Sphinx release\r\n- [x] https://github.com/sphinx-contrib/spelling/pull/2\r\n  - [x] sphinxcontrib-spelling release\n", "before_files": [{"content": "#!/usr/bin/env python\n\n# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport os\nimport platform\nimport subprocess\nimport sys\nfrom distutils.command.build import build\n\nimport pkg_resources\n\nfrom setuptools import find_packages, setup\nfrom setuptools.command.install import install\nfrom setuptools.command.test import test\n\n\nbase_dir = os.path.dirname(__file__)\nsrc_dir = os.path.join(base_dir, \"src\")\n\n# When executing the setup.py, we need to be able to import ourselves, this\n# means that we need to add the src/ directory to the sys.path.\nsys.path.insert(0, src_dir)\n\nabout = {}\nwith open(os.path.join(src_dir, \"cryptography\", \"__about__.py\")) as f:\n    exec(f.read(), about)\n\n\nVECTORS_DEPENDENCY = \"cryptography_vectors=={0}\".format(about['__version__'])\n\nsetup_requirements = []\n\nif platform.python_implementation() == \"PyPy\":\n    if sys.pypy_version_info < (5, 3):\n        raise RuntimeError(\n            \"cryptography 1.9 is not compatible with PyPy < 5.3. Please \"\n            \"upgrade PyPy to use this library.\"\n        )\nelse:\n    setup_requirements.append(\"cffi>=1.7\")\n\ntest_requirements = [\n    \"pytest>=3.2.1\",\n    \"pretend\",\n    \"iso8601\",\n    \"pytz\",\n    \"hypothesis>=1.11.4\",\n]\n\n\n# If there's no vectors locally that probably means we are in a tarball and\n# need to go and get the matching vectors package from PyPi\nif not os.path.exists(os.path.join(base_dir, \"vectors/setup.py\")):\n    test_requirements.append(VECTORS_DEPENDENCY)\n\n\nclass PyTest(test):\n    def finalize_options(self):\n        test.finalize_options(self)\n        self.test_args = []\n        self.test_suite = True\n\n        # This means there's a vectors/ folder with the package in here.\n        # cd into it, install the vectors package and then refresh sys.path\n        if VECTORS_DEPENDENCY not in test_requirements:\n            subprocess.check_call(\n                [sys.executable, \"setup.py\", \"install\"], cwd=\"vectors\"\n            )\n            pkg_resources.get_distribution(\"cryptography_vectors\").activate()\n\n    def run_tests(self):\n        # Import here because in module scope the eggs are not loaded.\n        import pytest\n        test_args = [os.path.join(base_dir, \"tests\")]\n        errno = pytest.main(test_args)\n        sys.exit(errno)\n\n\ndef keywords_with_side_effects(argv):\n    \"\"\"\n    Get a dictionary with setup keywords that (can) have side effects.\n\n    :param argv: A list of strings with command line arguments.\n    :returns: A dictionary with keyword arguments for the ``setup()`` function.\n\n    This setup.py script uses the setuptools 'setup_requires' feature because\n    this is required by the cffi package to compile extension modules. The\n    purpose of ``keywords_with_side_effects()`` is to avoid triggering the cffi\n    build process as a result of setup.py invocations that don't need the cffi\n    module to be built (setup.py serves the dual purpose of exposing package\n    metadata).\n\n    All of the options listed by ``python setup.py --help`` that print\n    information should be recognized here. The commands ``clean``,\n    ``egg_info``, ``register``, ``sdist`` and ``upload`` are also recognized.\n    Any combination of these options and commands is also supported.\n\n    This function was originally based on the `setup.py script`_ of SciPy (see\n    also the discussion in `pip issue #25`_).\n\n    .. _pip issue #25: https://github.com/pypa/pip/issues/25\n    .. _setup.py script: https://github.com/scipy/scipy/blob/master/setup.py\n    \"\"\"\n    no_setup_requires_arguments = (\n        '-h', '--help',\n        '-n', '--dry-run',\n        '-q', '--quiet',\n        '-v', '--verbose',\n        '-V', '--version',\n        '--author',\n        '--author-email',\n        '--classifiers',\n        '--contact',\n        '--contact-email',\n        '--description',\n        '--egg-base',\n        '--fullname',\n        '--help-commands',\n        '--keywords',\n        '--licence',\n        '--license',\n        '--long-description',\n        '--maintainer',\n        '--maintainer-email',\n        '--name',\n        '--no-user-cfg',\n        '--obsoletes',\n        '--platforms',\n        '--provides',\n        '--requires',\n        '--url',\n        'clean',\n        'egg_info',\n        'register',\n        'sdist',\n        'upload',\n    )\n\n    def is_short_option(argument):\n        \"\"\"Check whether a command line argument is a short option.\"\"\"\n        return len(argument) >= 2 and argument[0] == '-' and argument[1] != '-'\n\n    def expand_short_options(argument):\n        \"\"\"Expand combined short options into canonical short options.\"\"\"\n        return ('-' + char for char in argument[1:])\n\n    def argument_without_setup_requirements(argv, i):\n        \"\"\"Check whether a command line argument needs setup requirements.\"\"\"\n        if argv[i] in no_setup_requires_arguments:\n            # Simple case: An argument which is either an option or a command\n            # which doesn't need setup requirements.\n            return True\n        elif (is_short_option(argv[i]) and\n              all(option in no_setup_requires_arguments\n                  for option in expand_short_options(argv[i]))):\n            # Not so simple case: Combined short options none of which need\n            # setup requirements.\n            return True\n        elif argv[i - 1:i] == ['--egg-base']:\n            # Tricky case: --egg-info takes an argument which should not make\n            # us use setup_requires (defeating the purpose of this code).\n            return True\n        else:\n            return False\n\n    if all(argument_without_setup_requirements(argv, i)\n           for i in range(1, len(argv))):\n        return {\n            \"cmdclass\": {\n                \"build\": DummyBuild,\n                \"install\": DummyInstall,\n                \"test\": DummyPyTest,\n            }\n        }\n    else:\n        cffi_modules = [\n            \"src/_cffi_src/build_openssl.py:ffi\",\n            \"src/_cffi_src/build_constant_time.py:ffi\",\n            \"src/_cffi_src/build_padding.py:ffi\",\n        ]\n\n        return {\n            \"setup_requires\": setup_requirements,\n            \"cmdclass\": {\n                \"test\": PyTest,\n            },\n            \"cffi_modules\": cffi_modules\n        }\n\n\nsetup_requires_error = (\"Requested setup command that needs 'setup_requires' \"\n                        \"while command line arguments implied a side effect \"\n                        \"free command or option.\")\n\n\nclass DummyBuild(build):\n    \"\"\"\n    This class makes it very obvious when ``keywords_with_side_effects()`` has\n    incorrectly interpreted the command line arguments to ``setup.py build`` as\n    one of the 'side effect free' commands or options.\n    \"\"\"\n\n    def run(self):\n        raise RuntimeError(setup_requires_error)\n\n\nclass DummyInstall(install):\n    \"\"\"\n    This class makes it very obvious when ``keywords_with_side_effects()`` has\n    incorrectly interpreted the command line arguments to ``setup.py install``\n    as one of the 'side effect free' commands or options.\n    \"\"\"\n\n    def run(self):\n        raise RuntimeError(setup_requires_error)\n\n\nclass DummyPyTest(test):\n    \"\"\"\n    This class makes it very obvious when ``keywords_with_side_effects()`` has\n    incorrectly interpreted the command line arguments to ``setup.py test`` as\n    one of the 'side effect free' commands or options.\n    \"\"\"\n\n    def run_tests(self):\n        raise RuntimeError(setup_requires_error)\n\n\nwith open(os.path.join(base_dir, \"README.rst\")) as f:\n    long_description = f.read()\n\n\nsetup(\n    name=about[\"__title__\"],\n    version=about[\"__version__\"],\n\n    description=about[\"__summary__\"],\n    long_description=long_description,\n    license=about[\"__license__\"],\n    url=about[\"__uri__\"],\n\n    author=about[\"__author__\"],\n    author_email=about[\"__email__\"],\n\n    classifiers=[\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"License :: OSI Approved :: BSD License\",\n        \"Natural Language :: English\",\n        \"Operating System :: MacOS :: MacOS X\",\n        \"Operating System :: POSIX\",\n        \"Operating System :: POSIX :: BSD\",\n        \"Operating System :: POSIX :: Linux\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 2\",\n        \"Programming Language :: Python :: 2.7\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.4\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: Implementation :: CPython\",\n        \"Programming Language :: Python :: Implementation :: PyPy\",\n        \"Topic :: Security :: Cryptography\",\n    ],\n\n    package_dir={\"\": \"src\"},\n    packages=find_packages(where=\"src\", exclude=[\"_cffi_src\", \"_cffi_src.*\"]),\n    include_package_data=True,\n\n    install_requires=[\n        \"idna >= 2.1\",\n        \"asn1crypto >= 0.21.0\",\n        \"six >= 1.4.1\",\n    ],\n    tests_require=test_requirements,\n    extras_require={\n        \":python_version < '3'\": [\"enum34\", \"ipaddress\"],\n        \":platform_python_implementation != 'PyPy'\": [\"cffi >= 1.7\"],\n\n        \"test\": test_requirements,\n        \"docstest\": [\n            \"doc8\",\n            \"pyenchant >= 1.6.11\",\n            \"readme_renderer >= 16.0\",\n            \"sphinx\",\n            \"sphinx_rtd_theme\",\n            \"sphinxcontrib-spelling\",\n        ],\n        \"pep8test\": [\n            \"flake8\",\n            \"flake8-import-order\",\n            \"pep8-naming\",\n        ],\n    },\n\n    # for cffi\n    zip_safe=False,\n    ext_package=\"cryptography.hazmat.bindings\",\n    **keywords_with_side_effects(sys.argv)\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\n# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport os\nimport platform\nimport subprocess\nimport sys\nfrom distutils.command.build import build\n\nimport pkg_resources\n\nfrom setuptools import find_packages, setup\nfrom setuptools.command.install import install\nfrom setuptools.command.test import test\n\n\nbase_dir = os.path.dirname(__file__)\nsrc_dir = os.path.join(base_dir, \"src\")\n\n# When executing the setup.py, we need to be able to import ourselves, this\n# means that we need to add the src/ directory to the sys.path.\nsys.path.insert(0, src_dir)\n\nabout = {}\nwith open(os.path.join(src_dir, \"cryptography\", \"__about__.py\")) as f:\n    exec(f.read(), about)\n\n\nVECTORS_DEPENDENCY = \"cryptography_vectors=={0}\".format(about['__version__'])\n\nsetup_requirements = []\n\nif platform.python_implementation() == \"PyPy\":\n    if sys.pypy_version_info < (5, 3):\n        raise RuntimeError(\n            \"cryptography 1.9 is not compatible with PyPy < 5.3. Please \"\n            \"upgrade PyPy to use this library.\"\n        )\nelse:\n    setup_requirements.append(\"cffi>=1.7\")\n\ntest_requirements = [\n    \"pytest>=3.2.1\",\n    \"pretend\",\n    \"iso8601\",\n    \"pytz\",\n    \"hypothesis>=1.11.4\",\n]\n\n\n# If there's no vectors locally that probably means we are in a tarball and\n# need to go and get the matching vectors package from PyPi\nif not os.path.exists(os.path.join(base_dir, \"vectors/setup.py\")):\n    test_requirements.append(VECTORS_DEPENDENCY)\n\n\nclass PyTest(test):\n    def finalize_options(self):\n        test.finalize_options(self)\n        self.test_args = []\n        self.test_suite = True\n\n        # This means there's a vectors/ folder with the package in here.\n        # cd into it, install the vectors package and then refresh sys.path\n        if VECTORS_DEPENDENCY not in test_requirements:\n            subprocess.check_call(\n                [sys.executable, \"setup.py\", \"install\"], cwd=\"vectors\"\n            )\n            pkg_resources.get_distribution(\"cryptography_vectors\").activate()\n\n    def run_tests(self):\n        # Import here because in module scope the eggs are not loaded.\n        import pytest\n        test_args = [os.path.join(base_dir, \"tests\")]\n        errno = pytest.main(test_args)\n        sys.exit(errno)\n\n\ndef keywords_with_side_effects(argv):\n    \"\"\"\n    Get a dictionary with setup keywords that (can) have side effects.\n\n    :param argv: A list of strings with command line arguments.\n    :returns: A dictionary with keyword arguments for the ``setup()`` function.\n\n    This setup.py script uses the setuptools 'setup_requires' feature because\n    this is required by the cffi package to compile extension modules. The\n    purpose of ``keywords_with_side_effects()`` is to avoid triggering the cffi\n    build process as a result of setup.py invocations that don't need the cffi\n    module to be built (setup.py serves the dual purpose of exposing package\n    metadata).\n\n    All of the options listed by ``python setup.py --help`` that print\n    information should be recognized here. The commands ``clean``,\n    ``egg_info``, ``register``, ``sdist`` and ``upload`` are also recognized.\n    Any combination of these options and commands is also supported.\n\n    This function was originally based on the `setup.py script`_ of SciPy (see\n    also the discussion in `pip issue #25`_).\n\n    .. _pip issue #25: https://github.com/pypa/pip/issues/25\n    .. _setup.py script: https://github.com/scipy/scipy/blob/master/setup.py\n    \"\"\"\n    no_setup_requires_arguments = (\n        '-h', '--help',\n        '-n', '--dry-run',\n        '-q', '--quiet',\n        '-v', '--verbose',\n        '-V', '--version',\n        '--author',\n        '--author-email',\n        '--classifiers',\n        '--contact',\n        '--contact-email',\n        '--description',\n        '--egg-base',\n        '--fullname',\n        '--help-commands',\n        '--keywords',\n        '--licence',\n        '--license',\n        '--long-description',\n        '--maintainer',\n        '--maintainer-email',\n        '--name',\n        '--no-user-cfg',\n        '--obsoletes',\n        '--platforms',\n        '--provides',\n        '--requires',\n        '--url',\n        'clean',\n        'egg_info',\n        'register',\n        'sdist',\n        'upload',\n    )\n\n    def is_short_option(argument):\n        \"\"\"Check whether a command line argument is a short option.\"\"\"\n        return len(argument) >= 2 and argument[0] == '-' and argument[1] != '-'\n\n    def expand_short_options(argument):\n        \"\"\"Expand combined short options into canonical short options.\"\"\"\n        return ('-' + char for char in argument[1:])\n\n    def argument_without_setup_requirements(argv, i):\n        \"\"\"Check whether a command line argument needs setup requirements.\"\"\"\n        if argv[i] in no_setup_requires_arguments:\n            # Simple case: An argument which is either an option or a command\n            # which doesn't need setup requirements.\n            return True\n        elif (is_short_option(argv[i]) and\n              all(option in no_setup_requires_arguments\n                  for option in expand_short_options(argv[i]))):\n            # Not so simple case: Combined short options none of which need\n            # setup requirements.\n            return True\n        elif argv[i - 1:i] == ['--egg-base']:\n            # Tricky case: --egg-info takes an argument which should not make\n            # us use setup_requires (defeating the purpose of this code).\n            return True\n        else:\n            return False\n\n    if all(argument_without_setup_requirements(argv, i)\n           for i in range(1, len(argv))):\n        return {\n            \"cmdclass\": {\n                \"build\": DummyBuild,\n                \"install\": DummyInstall,\n                \"test\": DummyPyTest,\n            }\n        }\n    else:\n        cffi_modules = [\n            \"src/_cffi_src/build_openssl.py:ffi\",\n            \"src/_cffi_src/build_constant_time.py:ffi\",\n            \"src/_cffi_src/build_padding.py:ffi\",\n        ]\n\n        return {\n            \"setup_requires\": setup_requirements,\n            \"cmdclass\": {\n                \"test\": PyTest,\n            },\n            \"cffi_modules\": cffi_modules\n        }\n\n\nsetup_requires_error = (\"Requested setup command that needs 'setup_requires' \"\n                        \"while command line arguments implied a side effect \"\n                        \"free command or option.\")\n\n\nclass DummyBuild(build):\n    \"\"\"\n    This class makes it very obvious when ``keywords_with_side_effects()`` has\n    incorrectly interpreted the command line arguments to ``setup.py build`` as\n    one of the 'side effect free' commands or options.\n    \"\"\"\n\n    def run(self):\n        raise RuntimeError(setup_requires_error)\n\n\nclass DummyInstall(install):\n    \"\"\"\n    This class makes it very obvious when ``keywords_with_side_effects()`` has\n    incorrectly interpreted the command line arguments to ``setup.py install``\n    as one of the 'side effect free' commands or options.\n    \"\"\"\n\n    def run(self):\n        raise RuntimeError(setup_requires_error)\n\n\nclass DummyPyTest(test):\n    \"\"\"\n    This class makes it very obvious when ``keywords_with_side_effects()`` has\n    incorrectly interpreted the command line arguments to ``setup.py test`` as\n    one of the 'side effect free' commands or options.\n    \"\"\"\n\n    def run_tests(self):\n        raise RuntimeError(setup_requires_error)\n\n\nwith open(os.path.join(base_dir, \"README.rst\")) as f:\n    long_description = f.read()\n\n\nsetup(\n    name=about[\"__title__\"],\n    version=about[\"__version__\"],\n\n    description=about[\"__summary__\"],\n    long_description=long_description,\n    license=about[\"__license__\"],\n    url=about[\"__uri__\"],\n\n    author=about[\"__author__\"],\n    author_email=about[\"__email__\"],\n\n    classifiers=[\n        \"Intended Audience :: Developers\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"License :: OSI Approved :: BSD License\",\n        \"Natural Language :: English\",\n        \"Operating System :: MacOS :: MacOS X\",\n        \"Operating System :: POSIX\",\n        \"Operating System :: POSIX :: BSD\",\n        \"Operating System :: POSIX :: Linux\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 2\",\n        \"Programming Language :: Python :: 2.7\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.4\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: Implementation :: CPython\",\n        \"Programming Language :: Python :: Implementation :: PyPy\",\n        \"Topic :: Security :: Cryptography\",\n    ],\n\n    package_dir={\"\": \"src\"},\n    packages=find_packages(where=\"src\", exclude=[\"_cffi_src\", \"_cffi_src.*\"]),\n    include_package_data=True,\n\n    install_requires=[\n        \"idna >= 2.1\",\n        \"asn1crypto >= 0.21.0\",\n        \"six >= 1.4.1\",\n    ],\n    tests_require=test_requirements,\n    extras_require={\n        \":python_version < '3'\": [\"enum34\", \"ipaddress\"],\n        \":platform_python_implementation != 'PyPy'\": [\"cffi >= 1.7\"],\n\n        \"test\": test_requirements,\n        \"docstest\": [\n            \"doc8\",\n            \"pyenchant >= 1.6.11\",\n            \"readme_renderer >= 16.0\",\n            \"sphinx >= 1.6.5\",\n            \"sphinx_rtd_theme\",\n            \"sphinxcontrib-spelling >= 4.0.1\",\n        ],\n        \"pep8test\": [\n            \"flake8\",\n            \"flake8-import-order\",\n            \"pep8-naming\",\n        ],\n    },\n\n    # for cffi\n    zip_safe=False,\n    ext_package=\"cryptography.hazmat.bindings\",\n    **keywords_with_side_effects(sys.argv)\n)\n", "path": "setup.py"}]}