From 6188dcdcbd6c7cccd17a8cfb1599b4b03e928be8 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Tue, 14 Nov 2023 00:38:37 -0800 Subject: [PATCH] return placeholder version during docs build --- archivebox/config.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/archivebox/config.py b/archivebox/config.py index 9a5e0d35..775be8e4 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -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!')