mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-16 08:04:26 -04:00
add fallback version detection mode
This commit is contained in:
parent
8bb448c614
commit
d3d05f5f64
2 changed files with 11 additions and 3 deletions
|
@ -377,7 +377,15 @@ ALLOWED_IN_OUTPUT_DIR = {
|
|||
}
|
||||
|
||||
def get_version(config):
|
||||
return importlib.metadata.version(__package__ or 'archivebox')
|
||||
try:
|
||||
return importlib.metadata.version(__package__ or 'archivebox')
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
pyproject_config = (config['PACKAGE_DIR'] / 'pyproject.toml').read_text()
|
||||
for line in pyproject_config:
|
||||
if line.startswith('version = '):
|
||||
return line.split(' = ', 1)[-1].strip('"')
|
||||
|
||||
raise Exception('Failed to detect installed archivebox version!')
|
||||
|
||||
def get_commit_hash(config):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue