diff --git a/doc/extensions/last_updated.py b/doc/extensions/last_updated.py index a459ced4c..c4373490d 100644 --- a/doc/extensions/last_updated.py +++ b/doc/extensions/last_updated.py @@ -65,13 +65,13 @@ def _not_git_repo(dir): def _get_last_updated_from_git(file_path, git_repo, doc_root): rel_path = os.path.relpath(file_path, doc_root) + time_format = "%Y-%m-%d" for git_repo_path in git_repo: new_path = os.path.join(git_repo_path, rel_path) if os.path.isfile(new_path): try: - time_format = "%Y-%m-%d" output=subprocess.check_output( f'git --no-pager log -1 --date=format:"{time_format}" --pretty="format:%cd" {new_path}', shell=True, cwd=git_repo_path) @@ -80,8 +80,11 @@ def _get_last_updated_from_git(file_path, git_repo, doc_root): # folder on the list continue else: + try: last_updated = datetime.strptime(output.decode('utf-8'), time_format).date() return last_updated + except: + continue else: continue