mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 06:34:16 +00:00
return placeholder version during docs build
This commit is contained in:
parent
d3d05f5f64
commit
6188dcdcbd
1 changed files with 8 additions and 4 deletions
|
@ -380,10 +380,14 @@ def get_version(config):
|
|||
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('"')
|
||||
try:
|
||||
pyproject_config = (config['PACKAGE_DIR'] / 'pyproject.toml').read_text()
|
||||
for line in pyproject_config:
|
||||
if line.startswith('version = '):
|
||||
return line.split(' = ', 1)[-1].strip('"')
|
||||
except FileNotFoundError:
|
||||
# building docs, pyproject.toml is not available
|
||||
return 'dev'
|
||||
|
||||
raise Exception('Failed to detect installed archivebox version!')
|
||||
|
||||
|
|
Loading…
Reference in a new issue