prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Use setuptools_scm for generating a version number
  [setuptools_scm](https://github.com/pypa/setuptools_scm/) can automatically generate version numbers based on git tags and versioning information. This will allow us to exactly identify which commit a user is reporting an issue with if it is not a released version. It will also remove one step of the release process.
  
  --- 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 # Copyright (c) 2013 Potential Ventures Ltd
  4 # Copyright (c) 2013 SolarFlare Communications Inc
  5 # All rights reserved.
  6 #
  7 # Redistribution and use in source and binary forms, with or without
  8 # modification, are permitted provided that the following conditions are met:
  9 #     * Redistributions of source code must retain the above copyright
  10 #       notice, this list of conditions and the following disclaimer.
  11 #     * Redistributions in binary form must reproduce the above copyright
  12 #       notice, this list of conditions and the following disclaimer in the
  13 #       documentation and/or other materials provided with the distribution.
  14 #     * Neither the name of Potential Ventures Ltd,
  15 #       SolarFlare Communications Inc nor the
  16 #       names of its contributors may be used to endorse or promote products
  17 #       derived from this software without specific prior written permission.
  18 #
  19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22 # DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
  23 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  26 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29 ###############################################################################
  30 
  31 import sys
  32 if sys.version_info[:2] < (3, 5):
  33     msg = [
  34         "This version of cocotb requires at least Python 3.5,",
  35         "you are running Python %d.%d.%d." % (
  36             sys.version_info[0], sys.version_info[1], sys.version_info[2])
  37     ]
  38     if sys.version_info[0] == 2:
  39         msg += [
  40             "If you have Python 3 installed on your machine try ",
  41             "using 'python3 -m pip' instead of 'pip' to install cocotb."
  42         ]
  43     msg += [
  44         "For more information please refer to the documentation at ",
  45         "https://cocotb.readthedocs.io."
  46     ]
  47 
  48     raise SystemExit("\n".join(msg))
  49 
  50 import logging
  51 from setuptools import setup
  52 from setuptools import find_packages
  53 from os import path, walk
  54 from io import StringIO
  55 
  56 # Note: cocotb is not installed properly yet and is missing dependencies and binaries
  57 # We can still import other files next to setup.py, as long as they're in MANIFEST.in
  58 # The below line is necessary for PEP517 support
  59 sys.path.append(path.dirname(__file__))
  60 from cocotb_build_libs import get_ext, build_ext
  61 
  62 
  63 def read_file(fname):
  64     with open(path.join(path.dirname(__file__), fname), encoding='utf8') as f:
  65         return f.read()
  66 
  67 
  68 def package_files(directory):
  69     paths = []
  70     for (fpath, directories, filenames) in walk(directory):
  71         for filename in filenames:
  72             paths.append(path.join('..', fpath, filename))
  73     return paths
  74 
  75 
  76 # this sets the __version__ variable
  77 exec(read_file(path.join('cocotb', '_version.py')))
  78 
  79 # store log from build_libs and display at the end in verbose mode
  80 # see https://github.com/pypa/pip/issues/6634
  81 log_stream = StringIO()
  82 handler = logging.StreamHandler(log_stream)
  83 log = logging.getLogger("cocotb._build_libs")
  84 log.setLevel(logging.INFO)
  85 log.addHandler(handler)
  86 
  87 setup(
  88     name='cocotb',
  89     cmdclass={'build_ext': build_ext},
  90     version=__version__,  # noqa: F821
  91     description='cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python.',
  92     url='https://docs.cocotb.org',
  93     license='BSD',
  94     long_description=read_file('README.md'),
  95     long_description_content_type='text/markdown',
  96     author='Chris Higgs, Stuart Hodgson',
  97     maintainer='cocotb contributors',
  98     maintainer_email='cocotb@lists.librecores.org',
  99     install_requires=[],
  100     python_requires='>=3.5',
  101     packages=find_packages(),
  102     package_data={
  103         'cocotb': (
  104             package_files('cocotb/share/makefiles') +   # noqa: W504
  105             package_files('cocotb/share/include') +     # noqa: W504
  106             package_files('cocotb/share/def') +
  107             package_files('cocotb/share/lib/verilator')
  108         )
  109     },
  110     ext_modules=get_ext(),
  111     entry_points={
  112         'console_scripts': [
  113             'cocotb-config=cocotb.config:main',
  114         ]
  115     },
  116     platforms='any',
  117     classifiers=[
  118         "Programming Language :: Python :: 3",
  119         "Programming Language :: Python :: 3.5",
  120         "Programming Language :: Python :: 3.6",
  121         "Programming Language :: Python :: 3.7",
  122         "Programming Language :: Python :: 3.8",
  123         "Programming Language :: Python :: 3.9",
  124         "License :: OSI Approved :: BSD License",
  125         "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
  126     ],
  127 
  128     # these appear in the sidebar on PyPI
  129     project_urls={
  130         "Bug Tracker": "https://github.com/cocotb/cocotb/issues",
  131         "Source Code": "https://github.com/cocotb/cocotb",
  132         "Documentation": "https://docs.cocotb.org",
  133     },
  134 )
  135 
  136 print(log_stream.getvalue())
  137
  ```
  
  Path: `cocotb/_version.py`
  Content:
  ```
  1 # Package versioning solution originally found here:
  2 # http://stackoverflow.com/q/458550
  3 
  4 # Store the version here so:
  5 # 1) we don't load dependencies by storing it in __init__.py
  6 # 2) we can import it in setup.py for the same reason
  7 # 3) we can import it into your module
  8 __version__ = '1.5.0.dev0'
  9
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/cocotb/_version.py b/cocotb/_version.py
  deleted file mode 100644
  --- a/cocotb/_version.py
  +++ /dev/null
  @@ -1,8 +0,0 @@
  -# Package versioning solution originally found here:
  -# http://stackoverflow.com/q/458550
  -
  -# Store the version here so:
  -# 1) we don't load dependencies by storing it in __init__.py
  -# 2) we can import it in setup.py for the same reason
  -# 3) we can import it into your module
  -__version__ = '1.5.0.dev0'
  diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -73,9 +73,6 @@
       return paths
   
   
  -# this sets the __version__ variable
  -exec(read_file(path.join('cocotb', '_version.py')))
  -
   # store log from build_libs and display at the end in verbose mode
   # see https://github.com/pypa/pip/issues/6634
   log_stream = StringIO()
  @@ -87,7 +84,11 @@
   setup(
       name='cocotb',
       cmdclass={'build_ext': build_ext},
  -    version=__version__,  # noqa: F821
  +    use_scm_version=dict(
  +        write_to='cocotb/_version.py',
  +        write_to_template='__version__ = {version!r}',
  +        version_scheme='release-branch-semver'
  +    ),
       description='cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python.',
       url='https://docs.cocotb.org',
       license='BSD',
  @@ -96,6 +97,7 @@
       author='Chris Higgs, Stuart Hodgson',
       maintainer='cocotb contributors',
       maintainer_email='cocotb@lists.librecores.org',
  +    setup_requires=['setuptools_scm'],
       install_requires=[],
       python_requires='>=3.5',
       packages=find_packages(),
  
verification_info: {"golden_diff": "diff --git a/cocotb/_version.py b/cocotb/_version.py\ndeleted file mode 100644\n--- a/cocotb/_version.py\n+++ /dev/null\n@@ -1,8 +0,0 @@\n-# Package versioning solution originally found here:\n-# http://stackoverflow.com/q/458550\n-\n-# Store the version here so:\n-# 1) we don't load dependencies by storing it in __init__.py\n-# 2) we can import it in setup.py for the same reason\n-# 3) we can import it into your module\n-__version__ = '1.5.0.dev0'\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -73,9 +73,6 @@\n     return paths\n \n \n-# this sets the __version__ variable\n-exec(read_file(path.join('cocotb', '_version.py')))\n-\n # store log from build_libs and display at the end in verbose mode\n # see https://github.com/pypa/pip/issues/6634\n log_stream = StringIO()\n@@ -87,7 +84,11 @@\n setup(\n     name='cocotb',\n     cmdclass={'build_ext': build_ext},\n-    version=__version__,  # noqa: F821\n+    use_scm_version=dict(\n+        write_to='cocotb/_version.py',\n+        write_to_template='__version__ = {version!r}',\n+        version_scheme='release-branch-semver'\n+    ),\n     description='cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python.',\n     url='https://docs.cocotb.org',\n     license='BSD',\n@@ -96,6 +97,7 @@\n     author='Chris Higgs, Stuart Hodgson',\n     maintainer='cocotb contributors',\n     maintainer_email='cocotb@lists.librecores.org',\n+    setup_requires=['setuptools_scm'],\n     install_requires=[],\n     python_requires='>=3.5',\n     packages=find_packages(),\n", "issue": "Use setuptools_scm for generating a version number\n[setuptools_scm](https://github.com/pypa/setuptools_scm/) can automatically generate version numbers based on git tags and versioning information. This will allow us to exactly identify which commit a user is reporting an issue with if it is not a released version. It will also remove one step of the release process.\n", "before_files": [{"content": "#!/usr/bin/env python\n###############################################################################\n# Copyright (c) 2013 Potential Ventures Ltd\n# Copyright (c) 2013 SolarFlare Communications Inc\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#     * Redistributions of source code must retain the above copyright\n#       notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above copyright\n#       notice, this list of conditions and the following disclaimer in the\n#       documentation and/or other materials provided with the distribution.\n#     * Neither the name of Potential Ventures Ltd,\n#       SolarFlare Communications Inc nor the\n#       names of its contributors may be used to endorse or promote products\n#       derived from this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n# DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY\n# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n###############################################################################\n\nimport sys\nif sys.version_info[:2] < (3, 5):\n    msg = [\n        \"This version of cocotb requires at least Python 3.5,\",\n        \"you are running Python %d.%d.%d.\" % (\n            sys.version_info[0], sys.version_info[1], sys.version_info[2])\n    ]\n    if sys.version_info[0] == 2:\n        msg += [\n            \"If you have Python 3 installed on your machine try \",\n            \"using 'python3 -m pip' instead of 'pip' to install cocotb.\"\n        ]\n    msg += [\n        \"For more information please refer to the documentation at \",\n        \"https://cocotb.readthedocs.io.\"\n    ]\n\n    raise SystemExit(\"\\n\".join(msg))\n\nimport logging\nfrom setuptools import setup\nfrom setuptools import find_packages\nfrom os import path, walk\nfrom io import StringIO\n\n# Note: cocotb is not installed properly yet and is missing dependencies and binaries\n# We can still import other files next to setup.py, as long as they're in MANIFEST.in\n# The below line is necessary for PEP517 support\nsys.path.append(path.dirname(__file__))\nfrom cocotb_build_libs import get_ext, build_ext\n\n\ndef read_file(fname):\n    with open(path.join(path.dirname(__file__), fname), encoding='utf8') as f:\n        return f.read()\n\n\ndef package_files(directory):\n    paths = []\n    for (fpath, directories, filenames) in walk(directory):\n        for filename in filenames:\n            paths.append(path.join('..', fpath, filename))\n    return paths\n\n\n# this sets the __version__ variable\nexec(read_file(path.join('cocotb', '_version.py')))\n\n# store log from build_libs and display at the end in verbose mode\n# see https://github.com/pypa/pip/issues/6634\nlog_stream = StringIO()\nhandler = logging.StreamHandler(log_stream)\nlog = logging.getLogger(\"cocotb._build_libs\")\nlog.setLevel(logging.INFO)\nlog.addHandler(handler)\n\nsetup(\n    name='cocotb',\n    cmdclass={'build_ext': build_ext},\n    version=__version__,  # noqa: F821\n    description='cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python.',\n    url='https://docs.cocotb.org',\n    license='BSD',\n    long_description=read_file('README.md'),\n    long_description_content_type='text/markdown',\n    author='Chris Higgs, Stuart Hodgson',\n    maintainer='cocotb contributors',\n    maintainer_email='cocotb@lists.librecores.org',\n    install_requires=[],\n    python_requires='>=3.5',\n    packages=find_packages(),\n    package_data={\n        'cocotb': (\n            package_files('cocotb/share/makefiles') +   # noqa: W504\n            package_files('cocotb/share/include') +     # noqa: W504\n            package_files('cocotb/share/def') +\n            package_files('cocotb/share/lib/verilator')\n        )\n    },\n    ext_modules=get_ext(),\n    entry_points={\n        'console_scripts': [\n            'cocotb-config=cocotb.config:main',\n        ]\n    },\n    platforms='any',\n    classifiers=[\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"License :: OSI Approved :: BSD License\",\n        \"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)\",\n    ],\n\n    # these appear in the sidebar on PyPI\n    project_urls={\n        \"Bug Tracker\": \"https://github.com/cocotb/cocotb/issues\",\n        \"Source Code\": \"https://github.com/cocotb/cocotb\",\n        \"Documentation\": \"https://docs.cocotb.org\",\n    },\n)\n\nprint(log_stream.getvalue())\n", "path": "setup.py"}, {"content": "# Package versioning solution originally found here:\n# http://stackoverflow.com/q/458550\n\n# Store the version here so:\n# 1) we don't load dependencies by storing it in __init__.py\n# 2) we can import it in setup.py for the same reason\n# 3) we can import it into your module\n__version__ = '1.5.0.dev0'\n", "path": "cocotb/_version.py"}], "after_files": [{"content": "#!/usr/bin/env python\n###############################################################################\n# Copyright (c) 2013 Potential Ventures Ltd\n# Copyright (c) 2013 SolarFlare Communications Inc\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#     * Redistributions of source code must retain the above copyright\n#       notice, this list of conditions and the following disclaimer.\n#     * Redistributions in binary form must reproduce the above copyright\n#       notice, this list of conditions and the following disclaimer in the\n#       documentation and/or other materials provided with the distribution.\n#     * Neither the name of Potential Ventures Ltd,\n#       SolarFlare Communications Inc nor the\n#       names of its contributors may be used to endorse or promote products\n#       derived from this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n# DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY\n# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n###############################################################################\n\nimport sys\nif sys.version_info[:2] < (3, 5):\n    msg = [\n        \"This version of cocotb requires at least Python 3.5,\",\n        \"you are running Python %d.%d.%d.\" % (\n            sys.version_info[0], sys.version_info[1], sys.version_info[2])\n    ]\n    if sys.version_info[0] == 2:\n        msg += [\n            \"If you have Python 3 installed on your machine try \",\n            \"using 'python3 -m pip' instead of 'pip' to install cocotb.\"\n        ]\n    msg += [\n        \"For more information please refer to the documentation at \",\n        \"https://cocotb.readthedocs.io.\"\n    ]\n\n    raise SystemExit(\"\\n\".join(msg))\n\nimport logging\nfrom setuptools import setup\nfrom setuptools import find_packages\nfrom os import path, walk\nfrom io import StringIO\n\n# Note: cocotb is not installed properly yet and is missing dependencies and binaries\n# We can still import other files next to setup.py, as long as they're in MANIFEST.in\n# The below line is necessary for PEP517 support\nsys.path.append(path.dirname(__file__))\nfrom cocotb_build_libs import get_ext, build_ext\n\n\ndef read_file(fname):\n    with open(path.join(path.dirname(__file__), fname), encoding='utf8') as f:\n        return f.read()\n\n\ndef package_files(directory):\n    paths = []\n    for (fpath, directories, filenames) in walk(directory):\n        for filename in filenames:\n            paths.append(path.join('..', fpath, filename))\n    return paths\n\n\n# store log from build_libs and display at the end in verbose mode\n# see https://github.com/pypa/pip/issues/6634\nlog_stream = StringIO()\nhandler = logging.StreamHandler(log_stream)\nlog = logging.getLogger(\"cocotb._build_libs\")\nlog.setLevel(logging.INFO)\nlog.addHandler(handler)\n\nsetup(\n    name='cocotb',\n    cmdclass={'build_ext': build_ext},\n    use_scm_version=dict(\n        write_to='cocotb/_version.py',\n        write_to_template='__version__ = {version!r}',\n        version_scheme='release-branch-semver'\n    ),\n    description='cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python.',\n    url='https://docs.cocotb.org',\n    license='BSD',\n    long_description=read_file('README.md'),\n    long_description_content_type='text/markdown',\n    author='Chris Higgs, Stuart Hodgson',\n    maintainer='cocotb contributors',\n    maintainer_email='cocotb@lists.librecores.org',\n    setup_requires=['setuptools_scm'],\n    install_requires=[],\n    python_requires='>=3.5',\n    packages=find_packages(),\n    package_data={\n        'cocotb': (\n            package_files('cocotb/share/makefiles') +   # noqa: W504\n            package_files('cocotb/share/include') +     # noqa: W504\n            package_files('cocotb/share/def') +\n            package_files('cocotb/share/lib/verilator')\n        )\n    },\n    ext_modules=get_ext(),\n    entry_points={\n        'console_scripts': [\n            'cocotb-config=cocotb.config:main',\n        ]\n    },\n    platforms='any',\n    classifiers=[\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.5\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"License :: OSI Approved :: BSD License\",\n        \"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)\",\n    ],\n\n    # these appear in the sidebar on PyPI\n    project_urls={\n        \"Bug Tracker\": \"https://github.com/cocotb/cocotb/issues\",\n        \"Source Code\": \"https://github.com/cocotb/cocotb\",\n        \"Documentation\": \"https://docs.cocotb.org\",\n    },\n)\n\nprint(log_stream.getvalue())\n", "path": "setup.py"}, {"content": null, "path": "cocotb/_version.py"}]}