()
| 17 | |
| 18 | |
| 19 | def get_git_revision(): |
| 20 | try: |
| 21 | commit_id = ( |
| 22 | subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]) |
| 23 | .decode() |
| 24 | .strip() |
| 25 | ) |
| 26 | commit_date = ( |
| 27 | subprocess.check_output( |
| 28 | ["git", "log", "-1", "--format=%cd", "--date=short"] |
| 29 | ) |
| 30 | .decode() |
| 31 | .strip() |
| 32 | ) |
| 33 | return f"{commit_id} ({commit_date})" |
| 34 | except Exception: |
| 35 | return "Unknown" |
| 36 | |
| 37 | |
| 38 | # If extensions (or modules to document with autodoc) are in another directory, |