Skip to content

Commit

Permalink
suppress warning about config caching
Browse files Browse the repository at this point in the history
canonical#203
introduced a function into the `html_context` configuration.
In parallel, a Sphinx update added a warning message for such
cases (see sphinx-doc/sphinx#12300).

This commit suppresses the new warning for now.
We might be able to find a better solution later.

Signed-off-by: Ruth Fuchss <ruth.fuchss@canonical.com>
  • Loading branch information
ru-fu committed Apr 18, 2024
1 parent a922afd commit 8d0e98f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@
for tag in custom_tags:
tags.add(tag)

# html_context['get_contribs'] is a function and cannot be
# cached (see https://github.com/sphinx-doc/sphinx/issues/12300)
suppress_warnings = ["config.cache"]

############################################################
### Styling
############################################################
Expand Down Expand Up @@ -176,11 +180,11 @@
def get_contributors_for_file(github_url, github_folder, pagename, page_source_suffix, display_contributors_since=None):
filename = f"{pagename}{page_source_suffix}"
paths=html_context['github_folder'][1:] + filename
repo = Repo(".")
repo = Repo(".")
since = display_contributors_since if display_contributors_since and display_contributors_since.strip() else None

commits = repo.iter_commits(paths=paths, since=since)

contributors_dict = {}
for commit in commits:
contributor = commit.author.name
Expand All @@ -189,7 +193,7 @@ def get_contributors_for_file(github_url, github_folder, pagename, page_source_s
'date': commit.committed_date,
'sha': commit.hexsha
}
# The github_page contains the link to the contributor's latest commit.
# The github_page contains the link to the contributor's latest commit.
contributors_list = [{'name': name, 'github_page': f"{github_url}/commit/{data['sha']}"} for name, data in contributors_dict.items()]
sorted_contributors_list = sorted(contributors_list, key=lambda x: x['name'])
return sorted_contributors_list
Expand Down

0 comments on commit 8d0e98f

Please sign in to comment.