Get CPython version from git tag for cache namespace.
(cpython_prefix: str)
| 220 | |
| 221 | |
| 222 | def _get_cpython_version(cpython_prefix: str) -> str: |
| 223 | """Get CPython version from git tag for cache namespace.""" |
| 224 | try: |
| 225 | result = subprocess.run( |
| 226 | ["git", "describe", "--tags", "--abbrev=0"], |
| 227 | cwd=cpython_prefix, |
| 228 | capture_output=True, |
| 229 | text=True, |
| 230 | ) |
| 231 | if result.returncode == 0: |
| 232 | return result.stdout.strip() |
| 233 | except Exception: |
| 234 | pass |
| 235 | return "unknown" |
| 236 | |
| 237 | |
| 238 | def _get_cache_path() -> str: |
no test coverage detected