()
| 18 | |
| 19 | |
| 20 | def add_git_version(): |
| 21 | |
| 22 | def get_git_version(): |
| 23 | from subprocess import check_output |
| 24 | try: |
| 25 | return check_output("git describe --tags --long --dirty".split()).decode('utf-8').strip() |
| 26 | except Exception: |
| 27 | return __version__ # noqa |
| 28 | |
| 29 | newlibinfo_content = [l for l in libinfo_content if not l.startswith('__git_version__')] |
| 30 | newlibinfo_content.append('__git_version__ = "{}"'.format(get_git_version())) |
| 31 | with open(libinfo_py, "w") as f: |
| 32 | f.write("".join(newlibinfo_content)) |
| 33 | |
| 34 | |
| 35 | add_git_version() |
no test coverage detected