We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Generate version data from tags and commits
Today we have a hard-coded value in `turbinia/__init__.py`, but it would be nice to generate the version number from the current TAG for releases and from the git commit id when there is no TAG (ie. when running from master or a different branch).

--- 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 2017 Google Inc.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 """This is the setup file for the project."""
18 
19 # yapf: disable
20 
21 from __future__ import unicode_literals
22 
23 import sys
24 
25 from setuptools import find_packages
26 from setuptools import setup
27 
28 
29 # make sure turbinia is in path
30 sys.path.insert(0, '.')
31 
32 import turbinia  # pylint: disable=wrong-import-position
33 
34 turbinia_description = (
35     'Turbinia is an open-source framework for deploying, managing, and running'
36     'forensic workloads on cloud platforms. It is intended to automate running '
37     'of common forensic processing tools (i.e. Plaso, TSK, strings, etc) to '
38     'help with processing evidence in the Cloud, scaling the processing of '
39     'large amounts of evidence, and decreasing response time by parallelizing'
40     'processing where possible.')
41 
42 requirements = []
43 with open('requirements.txt','r') as f:
44   requirements = f.read().splitlines()
45 setup(
46     name='turbinia',
47     version=turbinia.__version__,
48     description='Automation and Scaling of Digital Forensics Tools',
49     long_description=turbinia_description,
50     license='Apache License, Version 2.0',
51     url='http://turbinia.plumbing/',
52     maintainer='Turbinia development team',
53     maintainer_email='turbinia-dev@googlegroups.com',
54     classifiers=[
55         'Development Status :: 4 - Beta',
56         'Environment :: Console',
57         'Operating System :: OS Independent',
58         'Programming Language :: Python',
59     ],
60     packages=find_packages(),
61     include_package_data=True,
62     zip_safe=False,
63     entry_points={'console_scripts': ['turbiniactl=turbinia.turbiniactl:main']},
64     install_requires=requirements,
65     extras_require={
66         'dev': ['mock', 'nose', 'yapf', 'celery~=4.1', 'coverage'],
67         'local': ['celery~=4.1', 'kombu~=4.1', 'redis~=3.0'],
68         'worker': ['docker-explorer>=20191104', 'plaso>=20200430', 'pyhindsight>=20200607']
69     }
70 )
71
```

Path: `turbinia/__init__.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 # Copyright 2015 Google Inc.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 """Main Turbinia application."""
16 
17 __version__ = '20190819'
18 
19 import logging
20 log = logging.getLogger('turbinia')
21 
22 
23 def log_and_report(message, trace):
24   """Log an error and if enabled, send to GCP Error Reporting API.
25 
26   Args:
27     message(str): The user defined message to log.
28     trace(str): The error traceback message to log.
29   """
30   from turbinia import config
31 
32   log.error(message)
33   log.error(trace)
34   # If GCP Error Reporting is enabled.
35   config.LoadConfig()
36   if config.STACKDRIVER_TRACEBACK:
37     # Only load google_cloud if needed
38     from turbinia.lib import google_cloud
39     client = google_cloud.setup_stackdriver_traceback(config.TURBINIA_PROJECT)
40     client.report_exception()
41 
42 
43 class TurbiniaException(Exception):
44   """Turbinia Exception class."""
45   pass
46
```
--- 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
@@ -44,7 +44,6 @@
   requirements = f.read().splitlines()
 setup(
     name='turbinia',
-    version=turbinia.__version__,
     description='Automation and Scaling of Digital Forensics Tools',
     long_description=turbinia_description,
     license='Apache License, Version 2.0',
@@ -66,5 +65,7 @@
         'dev': ['mock', 'nose', 'yapf', 'celery~=4.1', 'coverage'],
         'local': ['celery~=4.1', 'kombu~=4.1', 'redis~=3.0'],
         'worker': ['docker-explorer>=20191104', 'plaso>=20200430', 'pyhindsight>=20200607']
-    }
+    },
+    use_scm_version=True,
+    setup_requires=['setuptools_scm']
 )
diff --git a/turbinia/__init__.py b/turbinia/__init__.py
--- a/turbinia/__init__.py
+++ b/turbinia/__init__.py
@@ -14,11 +14,15 @@
 # limitations under the License.
 """Main Turbinia application."""
 
-__version__ = '20190819'
-
 import logging
 log = logging.getLogger('turbinia')
 
+from pkg_resources import get_distribution, DistributionNotFound
+try:
+  __version__ = get_distribution(__name__).version
+except DistributionNotFound:
+  __version__ = "unknown"
+
 
 def log_and_report(message, trace):
   """Log an error and if enabled, send to GCP Error Reporting API.

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -44,7 +44,6 @@\n   requirements = f.read().splitlines()\n setup(\n     name='turbinia',\n-    version=turbinia.__version__,\n     description='Automation and Scaling of Digital Forensics Tools',\n     long_description=turbinia_description,\n     license='Apache License, Version 2.0',\n@@ -66,5 +65,7 @@\n         'dev': ['mock', 'nose', 'yapf', 'celery~=4.1', 'coverage'],\n         'local': ['celery~=4.1', 'kombu~=4.1', 'redis~=3.0'],\n         'worker': ['docker-explorer>=20191104', 'plaso>=20200430', 'pyhindsight>=20200607']\n-    }\n+    },\n+    use_scm_version=True,\n+    setup_requires=['setuptools_scm']\n )\ndiff --git a/turbinia/__init__.py b/turbinia/__init__.py\n--- a/turbinia/__init__.py\n+++ b/turbinia/__init__.py\n@@ -14,11 +14,15 @@\n # limitations under the License.\n \"\"\"Main Turbinia application.\"\"\"\n \n-__version__ = '20190819'\n-\n import logging\n log = logging.getLogger('turbinia')\n \n+from pkg_resources import get_distribution, DistributionNotFound\n+try:\n+  __version__ = get_distribution(__name__).version\n+except DistributionNotFound:\n+  __version__ = \"unknown\"\n+\n \n def log_and_report(message, trace):\n   \"\"\"Log an error and if enabled, send to GCP Error Reporting API.\n", "issue": "Generate version data from tags and commits\nToday we have a hard-coded value in `turbinia/__init__.py`, but it would be nice to generate the version number from the current TAG for releases and from the git commit id when there is no TAG (ie. when running from master or a different branch).\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"This is the setup file for the project.\"\"\"\n\n# yapf: disable\n\nfrom __future__ import unicode_literals\n\nimport sys\n\nfrom setuptools import find_packages\nfrom setuptools import setup\n\n\n# make sure turbinia is in path\nsys.path.insert(0, '.')\n\nimport turbinia  # pylint: disable=wrong-import-position\n\nturbinia_description = (\n    'Turbinia is an open-source framework for deploying, managing, and running'\n    'forensic workloads on cloud platforms. It is intended to automate running '\n    'of common forensic processing tools (i.e. Plaso, TSK, strings, etc) to '\n    'help with processing evidence in the Cloud, scaling the processing of '\n    'large amounts of evidence, and decreasing response time by parallelizing'\n    'processing where possible.')\n\nrequirements = []\nwith open('requirements.txt','r') as f:\n  requirements = f.read().splitlines()\nsetup(\n    name='turbinia',\n    version=turbinia.__version__,\n    description='Automation and Scaling of Digital Forensics Tools',\n    long_description=turbinia_description,\n    license='Apache License, Version 2.0',\n    url='http://turbinia.plumbing/',\n    maintainer='Turbinia development team',\n    maintainer_email='turbinia-dev@googlegroups.com',\n    classifiers=[\n        'Development Status :: 4 - Beta',\n        'Environment :: Console',\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n    ],\n    packages=find_packages(),\n    include_package_data=True,\n    zip_safe=False,\n    entry_points={'console_scripts': ['turbiniactl=turbinia.turbiniactl:main']},\n    install_requires=requirements,\n    extras_require={\n        'dev': ['mock', 'nose', 'yapf', 'celery~=4.1', 'coverage'],\n        'local': ['celery~=4.1', 'kombu~=4.1', 'redis~=3.0'],\n        'worker': ['docker-explorer>=20191104', 'plaso>=20200430', 'pyhindsight>=20200607']\n    }\n)\n", "path": "setup.py"}, {"content": "# -*- coding: utf-8 -*-\n# Copyright 2015 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Main Turbinia application.\"\"\"\n\n__version__ = '20190819'\n\nimport logging\nlog = logging.getLogger('turbinia')\n\n\ndef log_and_report(message, trace):\n  \"\"\"Log an error and if enabled, send to GCP Error Reporting API.\n\n  Args:\n    message(str): The user defined message to log.\n    trace(str): The error traceback message to log.\n  \"\"\"\n  from turbinia import config\n\n  log.error(message)\n  log.error(trace)\n  # If GCP Error Reporting is enabled.\n  config.LoadConfig()\n  if config.STACKDRIVER_TRACEBACK:\n    # Only load google_cloud if needed\n    from turbinia.lib import google_cloud\n    client = google_cloud.setup_stackdriver_traceback(config.TURBINIA_PROJECT)\n    client.report_exception()\n\n\nclass TurbiniaException(Exception):\n  \"\"\"Turbinia Exception class.\"\"\"\n  pass\n", "path": "turbinia/__init__.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"This is the setup file for the project.\"\"\"\n\n# yapf: disable\n\nfrom __future__ import unicode_literals\n\nimport sys\n\nfrom setuptools import find_packages\nfrom setuptools import setup\n\n\n# make sure turbinia is in path\nsys.path.insert(0, '.')\n\nimport turbinia  # pylint: disable=wrong-import-position\n\nturbinia_description = (\n    'Turbinia is an open-source framework for deploying, managing, and running'\n    'forensic workloads on cloud platforms. It is intended to automate running '\n    'of common forensic processing tools (i.e. Plaso, TSK, strings, etc) to '\n    'help with processing evidence in the Cloud, scaling the processing of '\n    'large amounts of evidence, and decreasing response time by parallelizing'\n    'processing where possible.')\n\nrequirements = []\nwith open('requirements.txt','r') as f:\n  requirements = f.read().splitlines()\nsetup(\n    name='turbinia',\n    description='Automation and Scaling of Digital Forensics Tools',\n    long_description=turbinia_description,\n    license='Apache License, Version 2.0',\n    url='http://turbinia.plumbing/',\n    maintainer='Turbinia development team',\n    maintainer_email='turbinia-dev@googlegroups.com',\n    classifiers=[\n        'Development Status :: 4 - Beta',\n        'Environment :: Console',\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n    ],\n    packages=find_packages(),\n    include_package_data=True,\n    zip_safe=False,\n    entry_points={'console_scripts': ['turbiniactl=turbinia.turbiniactl:main']},\n    install_requires=requirements,\n    extras_require={\n        'dev': ['mock', 'nose', 'yapf', 'celery~=4.1', 'coverage'],\n        'local': ['celery~=4.1', 'kombu~=4.1', 'redis~=3.0'],\n        'worker': ['docker-explorer>=20191104', 'plaso>=20200430', 'pyhindsight>=20200607']\n    },\n    use_scm_version=True,\n    setup_requires=['setuptools_scm']\n)\n", "path": "setup.py"}, {"content": "# -*- coding: utf-8 -*-\n# Copyright 2015 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Main Turbinia application.\"\"\"\n\nimport logging\nlog = logging.getLogger('turbinia')\n\nfrom pkg_resources import get_distribution, DistributionNotFound\ntry:\n  __version__ = get_distribution(__name__).version\nexcept DistributionNotFound:\n  __version__ = \"unknown\"\n\n\ndef log_and_report(message, trace):\n  \"\"\"Log an error and if enabled, send to GCP Error Reporting API.\n\n  Args:\n    message(str): The user defined message to log.\n    trace(str): The error traceback message to log.\n  \"\"\"\n  from turbinia import config\n\n  log.error(message)\n  log.error(trace)\n  # If GCP Error Reporting is enabled.\n  config.LoadConfig()\n  if config.STACKDRIVER_TRACEBACK:\n    # Only load google_cloud if needed\n    from turbinia.lib import google_cloud\n    client = google_cloud.setup_stackdriver_traceback(config.TURBINIA_PROJECT)\n    client.report_exception()\n\n\nclass TurbiniaException(Exception):\n  \"\"\"Turbinia Exception class.\"\"\"\n  pass\n", "path": "turbinia/__init__.py"}]}