1
0
Fork 0

return placeholder version during docs build

This commit is contained in:
Nick Sweeting 2023-11-14 00:38:37 -08:00
parent d3d05f5f64
commit 6188dcdcbd

View file

@ -380,10 +380,14 @@ def get_version(config):
try: try:
return importlib.metadata.version(__package__ or 'archivebox') return importlib.metadata.version(__package__ or 'archivebox')
except importlib.metadata.PackageNotFoundError: except importlib.metadata.PackageNotFoundError:
pyproject_config = (config['PACKAGE_DIR'] / 'pyproject.toml').read_text() try:
for line in pyproject_config: pyproject_config = (config['PACKAGE_DIR'] / 'pyproject.toml').read_text()
if line.startswith('version = '): for line in pyproject_config:
return line.split(' = ', 1)[-1].strip('"') 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!') raise Exception('Failed to detect installed archivebox version!')