| 398 | raise Exception('Failed to detect installed archivebox version!') |
| 399 | |
| 400 | def get_commit_hash(config) -> Optional[str]: |
| 401 | try: |
| 402 | git_dir = config['PACKAGE_DIR'] / '../.git' |
| 403 | ref = (git_dir / 'HEAD').read_text().strip().split(' ')[-1] |
| 404 | commit_hash = git_dir.joinpath(ref).read_text().strip() |
| 405 | return commit_hash |
| 406 | except Exception: |
| 407 | pass |
| 408 | |
| 409 | try: |
| 410 | return list((config['PACKAGE_DIR'] / '../.git/refs/heads/').glob('*'))[0].read_text().strip() |
| 411 | except Exception: |
| 412 | pass |
| 413 | |
| 414 | return None |
| 415 | |
| 416 | def get_build_time(config) -> str: |
| 417 | if config['IN_DOCKER']: |