From 7aaba6f9f571f13ab3d91afb4afb5c3edf6d4f5b Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Thu, 22 Aug 2019 06:55:15 +0200 Subject: [PATCH] Catch any exception when trying to call "git" Some projects (like Neutron) do import eventlet in docs/source/conf.py . eventlet patches the subprocess module and due to that, the submodule.CalledProcessError exception is not caught. So building the documentation from an sdist tarball with having git installed (this combination is common in package build envs like RDO) fails with: subprocess.CalledProcessError: Command '['git', 'log', '-n1', \ '--format=%ad', [...snipped...] Change-Id: Ibff93605996855f01ba2bbe793285674b5c71d2e --- openstackdocstheme/page_context.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openstackdocstheme/page_context.py b/openstackdocstheme/page_context.py index 945bbff6..75092967 100644 --- a/openstackdocstheme/page_context.py +++ b/openstackdocstheme/page_context.py @@ -35,7 +35,11 @@ def _get_last_updated_file(src_file): '--', src_file, ] ).decode('utf-8').strip() - except (subprocess.CalledProcessError, OSError) as err: + # NOTE: we catch any exception here (instead of + # subprocess.CalledProcessError and OSError) because some projects (eg. + # neutron) do import eventlet in docs/source/conf.py which will patch + # the subprocess module and with that, the exception is not catched + except Exception as err: LOG.info( '[openstackdocstheme] Could not get modification time of %s: %s', src_file, err)