We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Invalid version schema "0.0.0.dev+.gXXX" - may not work with newer versions of setuptools, pip, and PyPI
```C:\Miniconda-x64\envs\test\lib\site-packages\setuptools\dist.py:350: UserWarning: The version specified (u'0.0.0.dev+.g5c641b2cb1') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.```

see also https://ci.appveyor.com/project/obspy/obspy/build/1.0.5140-warnings/job/rxhusf826vk5atia



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `obspy/core/util/version.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 # Author: Douglas Creager <dcreager@dcreager.net>
3 # This file is placed into the public domain.
4 
5 # Calculates the current version number.  If possible, this is the
6 # output of “git describe”, modified to conform to the versioning
7 # scheme that setuptools uses.  If “git describe” returns an error
8 # (most likely because we're in an unpacked copy of a release tarball,
9 # rather than in a git working copy), then we fall back on reading the
10 # contents of the RELEASE-VERSION file.
11 #
12 # To use this script, simply import it your setup.py file, and use the
13 # results of get_git_version() as your package version:
14 #
15 # from version import *
16 #
17 # setup(
18 #     version=get_git_version(),
19 #     .
20 #     .
21 #     .
22 # )
23 #
24 # This will automatically update the RELEASE-VERSION file, if
25 # necessary.  Note that the RELEASE-VERSION file should *not* be
26 # checked into git; please add it to your top-level .gitignore file.
27 #
28 # You'll probably want to distribute the RELEASE-VERSION file in your
29 # sdist tarballs; to do this, just create a MANIFEST.in file that
30 # contains the following line:
31 #
32 #   include RELEASE-VERSION
33 
34 # NO IMPORTS FROM OBSPY OR FUTURE IN THIS FILE! (file gets used at
35 # installation time)
36 import inspect
37 import io
38 import os
39 import re
40 from subprocess import STDOUT, CalledProcessError, check_output
41 
42 
43 __all__ = ("get_git_version")
44 
45 script_dir = os.path.abspath(os.path.dirname(inspect.getfile(
46                                              inspect.currentframe())))
47 OBSPY_ROOT = os.path.abspath(os.path.join(script_dir, os.pardir,
48                                           os.pardir, os.pardir))
49 VERSION_FILE = os.path.join(OBSPY_ROOT, "obspy", "RELEASE-VERSION")
50 
51 
52 def call_git_describe(abbrev=10, dirty=True,
53                       append_remote_tracking_branch=True):
54     try:
55         p = check_output(['git', 'rev-parse', '--show-toplevel'],
56                          cwd=OBSPY_ROOT, stderr=STDOUT)
57         path = p.decode().strip()
58     except (OSError, CalledProcessError):
59         return None
60 
61     if os.path.normpath(path) != OBSPY_ROOT:
62         return None
63 
64     command = ['git', 'describe', '--abbrev=%d' % abbrev, '--always', '--tags']
65     if dirty:
66         command.append("--dirty")
67     try:
68         p = check_output(['git', 'describe', '--dirty', '--abbrev=%d' % abbrev,
69                           '--always', '--tags'],
70                          cwd=OBSPY_ROOT, stderr=STDOUT)
71         line = p.decode().strip()
72     except (OSError, CalledProcessError):
73         return None
74 
75     remote_tracking_branch = None
76     if append_remote_tracking_branch:
77         try:
78             # find out local alias of remote and name of remote tracking branch
79             p = check_output(['git', 'branch', '-vv'],
80                              cwd=OBSPY_ROOT, stderr=STDOUT)
81             remote_info = [line_.rstrip()
82                            for line_ in p.decode().splitlines()]
83             remote_info = [line_ for line_ in remote_info
84                            if line_.startswith('*')][0]
85             remote_info = re.sub(r".*? \[([^ :]*).*?\] .*", r"\1", remote_info)
86             remote, branch = remote_info.split("/")
87             # find out real name of remote
88             p = check_output(['git', 'remote', '-v'],
89                              cwd=OBSPY_ROOT, stderr=STDOUT)
90             stdout = [line_.strip() for line_ in p.decode().splitlines()]
91             remote = [line_ for line_ in stdout
92                       if line_.startswith(remote)][0].split()[1]
93             if remote.startswith("git@github.com:"):
94                 remote = re.sub(r"git@github.com:(.*?)/.*", r"\1", remote)
95             elif remote.startswith("https://github.com/"):
96                 remote = re.sub(r"https://github.com/(.*?)/.*", r"\1", remote)
97             elif remote.startswith("git://github.com"):
98                 remote = re.sub(r"git://github.com/(.*?)/.*", r"\1", remote)
99             else:
100                 remote = None
101             if remote is not None:
102                 remote_tracking_branch = re.sub(r'[^A-Za-z0-9._-]', r'_',
103                                                 '%s-%s' % (remote, branch))
104         except (IndexError, OSError, ValueError, CalledProcessError):
105             pass
106 
107     # (this line prevents official releases)
108     # should work again now, see #482 and obspy/obspy@b437f31
109     if "-" not in line and "." not in line:
110         version = "0.0.0.dev+.g%s" % line
111     else:
112         parts = line.split('-', 1)
113         version = parts[0]
114         try:
115             version += '.post+' + parts[1]
116             if remote_tracking_branch is not None:
117                 version += '.' + remote_tracking_branch
118         # IndexError means we are at a release version tag cleanly,
119         # add nothing additional
120         except IndexError:
121             pass
122     return version
123 
124 
125 def read_release_version():
126     try:
127         with io.open(VERSION_FILE, "rt") as fh:
128             version = fh.readline()
129         return version.strip()
130     except IOError:
131         return None
132 
133 
134 def write_release_version(version):
135     with io.open(VERSION_FILE, "wb") as fh:
136         fh.write(("%s\n" % version).encode('ascii', 'strict'))
137 
138 
139 def get_git_version(abbrev=10, dirty=True, append_remote_tracking_branch=True):
140     # Read in the version that's currently in RELEASE-VERSION.
141     release_version = read_release_version()
142 
143     # First try to get the current version using “git describe”.
144     version = call_git_describe(
145         abbrev, dirty=dirty,
146         append_remote_tracking_branch=append_remote_tracking_branch)
147 
148     # If that doesn't work, fall back on the value that's in
149     # RELEASE-VERSION.
150     if version is None:
151         version = release_version
152 
153     # If we still don't have anything, that's an error.
154     if version is None:
155         return '0.0.0+archive'
156 
157     # pip uses its normalized version number (strict PEP440) instead of our
158     # original version number, so we bow to pip and use the normalized version
159     # number internally, too, to avoid discrepancies.
160     version = _normalize_version(version)
161 
162     # If the current version is different from what's in the
163     # RELEASE-VERSION file, update the file to be current.
164     if version != release_version:
165         write_release_version(version)
166 
167     # Finally, return the current version.
168     return version
169 
170 
171 def _normalize_version(version):
172     """
173     Normalize version number string to adhere with PEP440 strictly.
174     """
175     # we have a clean release version:
176     if re.match(r'^[0-9]+?\.[0-9]+?\.[0-9]+?$', version):
177         return version
178     # we have a release candidate version:
179     elif re.match(r'^[0-9]+?\.[0-9]+?\.[0-9]+?rc[0-9]+?$', version):
180         return version
181     # we have an old-style version (i.e. a git describe string), prepare it for
182     # the rest of clean up, i.e. put the '.post+' as separator for the local
183     # version number part
184     elif re.match(r'^[0-9]+?\.[0-9]+?\.[0-9]+?-[0-9]+?-g[0-9a-z]+?$', version):
185         version = re.sub(r'-', '.post+', version, count=1)
186     # only adapt local version part right
187     version = re.match(r'(.*?\+)(.*)', version)
188     # no upper case letters
189     local_version = version.group(2).lower()
190     # only alphanumeric and "." in local part
191     local_version = re.sub(r'[^A-Za-z0-9.]', r'.', local_version)
192     version = version.group(1) + local_version
193     # make sure there's a "0" after ".post"
194     version = re.sub(r'\.post\+', r'.post0+', version)
195     return version
196 
197 
198 if __name__ == "__main__":
199     print(get_git_version())
200
```
--- 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/obspy/core/util/version.py b/obspy/core/util/version.py
--- a/obspy/core/util/version.py
+++ b/obspy/core/util/version.py
@@ -107,7 +107,7 @@
     # (this line prevents official releases)
     # should work again now, see #482 and obspy/obspy@b437f31
     if "-" not in line and "." not in line:
-        version = "0.0.0.dev+.g%s" % line
+        version = "0.0.0.dev+0.g%s" % line
     else:
         parts = line.split('-', 1)
         version = parts[0]

{"golden_diff": "diff --git a/obspy/core/util/version.py b/obspy/core/util/version.py\n--- a/obspy/core/util/version.py\n+++ b/obspy/core/util/version.py\n@@ -107,7 +107,7 @@\n     # (this line prevents official releases)\n     # should work again now, see #482 and obspy/obspy@b437f31\n     if \"-\" not in line and \".\" not in line:\n-        version = \"0.0.0.dev+.g%s\" % line\n+        version = \"0.0.0.dev+0.g%s\" % line\n     else:\n         parts = line.split('-', 1)\n         version = parts[0]\n", "issue": "Invalid version schema \"0.0.0.dev+.gXXX\" - may not work with newer versions of setuptools, pip, and PyPI\n```C:\\Miniconda-x64\\envs\\test\\lib\\site-packages\\setuptools\\dist.py:350: UserWarning: The version specified (u'0.0.0.dev+.g5c641b2cb1') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.```\r\n\r\nsee also https://ci.appveyor.com/project/obspy/obspy/build/1.0.5140-warnings/job/rxhusf826vk5atia\r\n\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# Author: Douglas Creager <dcreager@dcreager.net>\n# This file is placed into the public domain.\n\n# Calculates the current version number.  If possible, this is the\n# output of \u201cgit describe\u201d, modified to conform to the versioning\n# scheme that setuptools uses.  If \u201cgit describe\u201d returns an error\n# (most likely because we're in an unpacked copy of a release tarball,\n# rather than in a git working copy), then we fall back on reading the\n# contents of the RELEASE-VERSION file.\n#\n# To use this script, simply import it your setup.py file, and use the\n# results of get_git_version() as your package version:\n#\n# from version import *\n#\n# setup(\n#     version=get_git_version(),\n#     .\n#     .\n#     .\n# )\n#\n# This will automatically update the RELEASE-VERSION file, if\n# necessary.  Note that the RELEASE-VERSION file should *not* be\n# checked into git; please add it to your top-level .gitignore file.\n#\n# You'll probably want to distribute the RELEASE-VERSION file in your\n# sdist tarballs; to do this, just create a MANIFEST.in file that\n# contains the following line:\n#\n#   include RELEASE-VERSION\n\n# NO IMPORTS FROM OBSPY OR FUTURE IN THIS FILE! (file gets used at\n# installation time)\nimport inspect\nimport io\nimport os\nimport re\nfrom subprocess import STDOUT, CalledProcessError, check_output\n\n\n__all__ = (\"get_git_version\")\n\nscript_dir = os.path.abspath(os.path.dirname(inspect.getfile(\n                                             inspect.currentframe())))\nOBSPY_ROOT = os.path.abspath(os.path.join(script_dir, os.pardir,\n                                          os.pardir, os.pardir))\nVERSION_FILE = os.path.join(OBSPY_ROOT, \"obspy\", \"RELEASE-VERSION\")\n\n\ndef call_git_describe(abbrev=10, dirty=True,\n                      append_remote_tracking_branch=True):\n    try:\n        p = check_output(['git', 'rev-parse', '--show-toplevel'],\n                         cwd=OBSPY_ROOT, stderr=STDOUT)\n        path = p.decode().strip()\n    except (OSError, CalledProcessError):\n        return None\n\n    if os.path.normpath(path) != OBSPY_ROOT:\n        return None\n\n    command = ['git', 'describe', '--abbrev=%d' % abbrev, '--always', '--tags']\n    if dirty:\n        command.append(\"--dirty\")\n    try:\n        p = check_output(['git', 'describe', '--dirty', '--abbrev=%d' % abbrev,\n                          '--always', '--tags'],\n                         cwd=OBSPY_ROOT, stderr=STDOUT)\n        line = p.decode().strip()\n    except (OSError, CalledProcessError):\n        return None\n\n    remote_tracking_branch = None\n    if append_remote_tracking_branch:\n        try:\n            # find out local alias of remote and name of remote tracking branch\n            p = check_output(['git', 'branch', '-vv'],\n                             cwd=OBSPY_ROOT, stderr=STDOUT)\n            remote_info = [line_.rstrip()\n                           for line_ in p.decode().splitlines()]\n            remote_info = [line_ for line_ in remote_info\n                           if line_.startswith('*')][0]\n            remote_info = re.sub(r\".*? \\[([^ :]*).*?\\] .*\", r\"\\1\", remote_info)\n            remote, branch = remote_info.split(\"/\")\n            # find out real name of remote\n            p = check_output(['git', 'remote', '-v'],\n                             cwd=OBSPY_ROOT, stderr=STDOUT)\n            stdout = [line_.strip() for line_ in p.decode().splitlines()]\n            remote = [line_ for line_ in stdout\n                      if line_.startswith(remote)][0].split()[1]\n            if remote.startswith(\"git@github.com:\"):\n                remote = re.sub(r\"git@github.com:(.*?)/.*\", r\"\\1\", remote)\n            elif remote.startswith(\"https://github.com/\"):\n                remote = re.sub(r\"https://github.com/(.*?)/.*\", r\"\\1\", remote)\n            elif remote.startswith(\"git://github.com\"):\n                remote = re.sub(r\"git://github.com/(.*?)/.*\", r\"\\1\", remote)\n            else:\n                remote = None\n            if remote is not None:\n                remote_tracking_branch = re.sub(r'[^A-Za-z0-9._-]', r'_',\n                                                '%s-%s' % (remote, branch))\n        except (IndexError, OSError, ValueError, CalledProcessError):\n            pass\n\n    # (this line prevents official releases)\n    # should work again now, see #482 and obspy/obspy@b437f31\n    if \"-\" not in line and \".\" not in line:\n        version = \"0.0.0.dev+.g%s\" % line\n    else:\n        parts = line.split('-', 1)\n        version = parts[0]\n        try:\n            version += '.post+' + parts[1]\n            if remote_tracking_branch is not None:\n                version += '.' + remote_tracking_branch\n        # IndexError means we are at a release version tag cleanly,\n        # add nothing additional\n        except IndexError:\n            pass\n    return version\n\n\ndef read_release_version():\n    try:\n        with io.open(VERSION_FILE, \"rt\") as fh:\n            version = fh.readline()\n        return version.strip()\n    except IOError:\n        return None\n\n\ndef write_release_version(version):\n    with io.open(VERSION_FILE, \"wb\") as fh:\n        fh.write((\"%s\\n\" % version).encode('ascii', 'strict'))\n\n\ndef get_git_version(abbrev=10, dirty=True, append_remote_tracking_branch=True):\n    # Read in the version that's currently in RELEASE-VERSION.\n    release_version = read_release_version()\n\n    # First try to get the current version using \u201cgit describe\u201d.\n    version = call_git_describe(\n        abbrev, dirty=dirty,\n        append_remote_tracking_branch=append_remote_tracking_branch)\n\n    # If that doesn't work, fall back on the value that's in\n    # RELEASE-VERSION.\n    if version is None:\n        version = release_version\n\n    # If we still don't have anything, that's an error.\n    if version is None:\n        return '0.0.0+archive'\n\n    # pip uses its normalized version number (strict PEP440) instead of our\n    # original version number, so we bow to pip and use the normalized version\n    # number internally, too, to avoid discrepancies.\n    version = _normalize_version(version)\n\n    # If the current version is different from what's in the\n    # RELEASE-VERSION file, update the file to be current.\n    if version != release_version:\n        write_release_version(version)\n\n    # Finally, return the current version.\n    return version\n\n\ndef _normalize_version(version):\n    \"\"\"\n    Normalize version number string to adhere with PEP440 strictly.\n    \"\"\"\n    # we have a clean release version:\n    if re.match(r'^[0-9]+?\\.[0-9]+?\\.[0-9]+?$', version):\n        return version\n    # we have a release candidate version:\n    elif re.match(r'^[0-9]+?\\.[0-9]+?\\.[0-9]+?rc[0-9]+?$', version):\n        return version\n    # we have an old-style version (i.e. a git describe string), prepare it for\n    # the rest of clean up, i.e. put the '.post+' as separator for the local\n    # version number part\n    elif re.match(r'^[0-9]+?\\.[0-9]+?\\.[0-9]+?-[0-9]+?-g[0-9a-z]+?$', version):\n        version = re.sub(r'-', '.post+', version, count=1)\n    # only adapt local version part right\n    version = re.match(r'(.*?\\+)(.*)', version)\n    # no upper case letters\n    local_version = version.group(2).lower()\n    # only alphanumeric and \".\" in local part\n    local_version = re.sub(r'[^A-Za-z0-9.]', r'.', local_version)\n    version = version.group(1) + local_version\n    # make sure there's a \"0\" after \".post\"\n    version = re.sub(r'\\.post\\+', r'.post0+', version)\n    return version\n\n\nif __name__ == \"__main__\":\n    print(get_git_version())\n", "path": "obspy/core/util/version.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n# Author: Douglas Creager <dcreager@dcreager.net>\n# This file is placed into the public domain.\n\n# Calculates the current version number.  If possible, this is the\n# output of \u201cgit describe\u201d, modified to conform to the versioning\n# scheme that setuptools uses.  If \u201cgit describe\u201d returns an error\n# (most likely because we're in an unpacked copy of a release tarball,\n# rather than in a git working copy), then we fall back on reading the\n# contents of the RELEASE-VERSION file.\n#\n# To use this script, simply import it your setup.py file, and use the\n# results of get_git_version() as your package version:\n#\n# from version import *\n#\n# setup(\n#     version=get_git_version(),\n#     .\n#     .\n#     .\n# )\n#\n# This will automatically update the RELEASE-VERSION file, if\n# necessary.  Note that the RELEASE-VERSION file should *not* be\n# checked into git; please add it to your top-level .gitignore file.\n#\n# You'll probably want to distribute the RELEASE-VERSION file in your\n# sdist tarballs; to do this, just create a MANIFEST.in file that\n# contains the following line:\n#\n#   include RELEASE-VERSION\n\n# NO IMPORTS FROM OBSPY OR FUTURE IN THIS FILE! (file gets used at\n# installation time)\nimport inspect\nimport io\nimport os\nimport re\nfrom subprocess import STDOUT, CalledProcessError, check_output\n\n\n__all__ = (\"get_git_version\")\n\nscript_dir = os.path.abspath(os.path.dirname(inspect.getfile(\n                                             inspect.currentframe())))\nOBSPY_ROOT = os.path.abspath(os.path.join(script_dir, os.pardir,\n                                          os.pardir, os.pardir))\nVERSION_FILE = os.path.join(OBSPY_ROOT, \"obspy\", \"RELEASE-VERSION\")\n\n\ndef call_git_describe(abbrev=10, dirty=True,\n                      append_remote_tracking_branch=True):\n    try:\n        p = check_output(['git', 'rev-parse', '--show-toplevel'],\n                         cwd=OBSPY_ROOT, stderr=STDOUT)\n        path = p.decode().strip()\n    except (OSError, CalledProcessError):\n        return None\n\n    if os.path.normpath(path) != OBSPY_ROOT:\n        return None\n\n    command = ['git', 'describe', '--abbrev=%d' % abbrev, '--always', '--tags']\n    if dirty:\n        command.append(\"--dirty\")\n    try:\n        p = check_output(['git', 'describe', '--dirty', '--abbrev=%d' % abbrev,\n                          '--always', '--tags'],\n                         cwd=OBSPY_ROOT, stderr=STDOUT)\n        line = p.decode().strip()\n    except (OSError, CalledProcessError):\n        return None\n\n    remote_tracking_branch = None\n    if append_remote_tracking_branch:\n        try:\n            # find out local alias of remote and name of remote tracking branch\n            p = check_output(['git', 'branch', '-vv'],\n                             cwd=OBSPY_ROOT, stderr=STDOUT)\n            remote_info = [line_.rstrip()\n                           for line_ in p.decode().splitlines()]\n            remote_info = [line_ for line_ in remote_info\n                           if line_.startswith('*')][0]\n            remote_info = re.sub(r\".*? \\[([^ :]*).*?\\] .*\", r\"\\1\", remote_info)\n            remote, branch = remote_info.split(\"/\")\n            # find out real name of remote\n            p = check_output(['git', 'remote', '-v'],\n                             cwd=OBSPY_ROOT, stderr=STDOUT)\n            stdout = [line_.strip() for line_ in p.decode().splitlines()]\n            remote = [line_ for line_ in stdout\n                      if line_.startswith(remote)][0].split()[1]\n            if remote.startswith(\"git@github.com:\"):\n                remote = re.sub(r\"git@github.com:(.*?)/.*\", r\"\\1\", remote)\n            elif remote.startswith(\"https://github.com/\"):\n                remote = re.sub(r\"https://github.com/(.*?)/.*\", r\"\\1\", remote)\n            elif remote.startswith(\"git://github.com\"):\n                remote = re.sub(r\"git://github.com/(.*?)/.*\", r\"\\1\", remote)\n            else:\n                remote = None\n            if remote is not None:\n                remote_tracking_branch = re.sub(r'[^A-Za-z0-9._-]', r'_',\n                                                '%s-%s' % (remote, branch))\n        except (IndexError, OSError, ValueError, CalledProcessError):\n            pass\n\n    # (this line prevents official releases)\n    # should work again now, see #482 and obspy/obspy@b437f31\n    if \"-\" not in line and \".\" not in line:\n        version = \"0.0.0.dev+0.g%s\" % line\n    else:\n        parts = line.split('-', 1)\n        version = parts[0]\n        try:\n            version += '.post+' + parts[1]\n            if remote_tracking_branch is not None:\n                version += '.' + remote_tracking_branch\n        # IndexError means we are at a release version tag cleanly,\n        # add nothing additional\n        except IndexError:\n            pass\n    return version\n\n\ndef read_release_version():\n    try:\n        with io.open(VERSION_FILE, \"rt\") as fh:\n            version = fh.readline()\n        return version.strip()\n    except IOError:\n        return None\n\n\ndef write_release_version(version):\n    with io.open(VERSION_FILE, \"wb\") as fh:\n        fh.write((\"%s\\n\" % version).encode('ascii', 'strict'))\n\n\ndef get_git_version(abbrev=10, dirty=True, append_remote_tracking_branch=True):\n    # Read in the version that's currently in RELEASE-VERSION.\n    release_version = read_release_version()\n\n    # First try to get the current version using \u201cgit describe\u201d.\n    version = call_git_describe(\n        abbrev, dirty=dirty,\n        append_remote_tracking_branch=append_remote_tracking_branch)\n\n    # If that doesn't work, fall back on the value that's in\n    # RELEASE-VERSION.\n    if version is None:\n        version = release_version\n\n    # If we still don't have anything, that's an error.\n    if version is None:\n        return '0.0.0+archive'\n\n    # pip uses its normalized version number (strict PEP440) instead of our\n    # original version number, so we bow to pip and use the normalized version\n    # number internally, too, to avoid discrepancies.\n    version = _normalize_version(version)\n\n    # If the current version is different from what's in the\n    # RELEASE-VERSION file, update the file to be current.\n    if version != release_version:\n        write_release_version(version)\n\n    # Finally, return the current version.\n    return version\n\n\ndef _normalize_version(version):\n    \"\"\"\n    Normalize version number string to adhere with PEP440 strictly.\n    \"\"\"\n    # we have a clean release version:\n    if re.match(r'^[0-9]+?\\.[0-9]+?\\.[0-9]+?$', version):\n        return version\n    # we have a release candidate version:\n    elif re.match(r'^[0-9]+?\\.[0-9]+?\\.[0-9]+?rc[0-9]+?$', version):\n        return version\n    # we have an old-style version (i.e. a git describe string), prepare it for\n    # the rest of clean up, i.e. put the '.post+' as separator for the local\n    # version number part\n    elif re.match(r'^[0-9]+?\\.[0-9]+?\\.[0-9]+?-[0-9]+?-g[0-9a-z]+?$', version):\n        version = re.sub(r'-', '.post+', version, count=1)\n    # only adapt local version part right\n    version = re.match(r'(.*?\\+)(.*)', version)\n    # no upper case letters\n    local_version = version.group(2).lower()\n    # only alphanumeric and \".\" in local part\n    local_version = re.sub(r'[^A-Za-z0-9.]', r'.', local_version)\n    version = version.group(1) + local_version\n    # make sure there's a \"0\" after \".post\"\n    version = re.sub(r'\\.post\\+', r'.post0+', version)\n    return version\n\n\nif __name__ == \"__main__\":\n    print(get_git_version())\n", "path": "obspy/core/util/version.py"}]}