()
| 191 | |
| 192 | |
| 193 | def describe_rev() -> str: |
| 194 | if not os.path.isdir(".git") and os.path.isfile("PKG-INFO"): |
| 195 | # We're being build from an unpacked sdist. |
| 196 | with open("PKG-INFO") as fp: |
| 197 | return Parser().parse(fp).get("Version", "Unknown Version") |
| 198 | |
| 199 | git_describe = subprocess.run( |
| 200 | ["git", "describe"], check=True, stdout=subprocess.PIPE, encoding="utf-8" |
| 201 | ) |
| 202 | return git_describe.stdout.strip() |
| 203 | |
| 204 | |
| 205 | def describe_file(path: Path) -> Tuple[str, int]: |