Skip to content

Commit

Permalink
gh-37334: Preparation for Sphinx 7
Browse files Browse the repository at this point in the history
    
Based on #37129, we adjust sage for Sphinx 7. Mainly,

- (once again) `sage_autodoc` is updated based on the source file of
Sphinx 7.

Before the arrival of Sphinx 8, hopefully, we should remove
`sage_autodoc`!

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

- #37129

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #37334
Reported by: Kwankyu Lee
Reviewer(s):
  • Loading branch information
Release Manager committed Feb 21, 2024
2 parents e2c3fe9 + 0ec4126 commit 0f35a69
Show file tree
Hide file tree
Showing 5 changed files with 567 additions and 500 deletions.
12 changes: 5 additions & 7 deletions src/sage_docbuild/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,10 @@ def f(self, *args, **kwds):
if build_options.ABORT_ON_ERROR:
raise Exception("Non-exception during docbuild: %s" % (e,), e)

if "/latex" in output_dir:
logger.warning("LaTeX file written to {}".format(output_dir))
else:
logger.warning(
"Build finished. The built documents can be found in {}".
format(output_dir))
if type == 'latex':
logger.warning(f"LaTeX files can be found in {output_dir}.")
elif type != 'inventory':
logger.warning(f"Build finished. The built documents can be found in {output_dir}.")

f.is_output_format = True
return f
Expand Down Expand Up @@ -298,7 +296,7 @@ def pdf(self):

if subprocess.call(make_target % (tex_dir, command, pdf_dir), close_fds=False, shell=True):
raise RuntimeError(error_message % (command, tex_dir))
logger.warning("Build finished. The built documents can be found in %s", pdf_dir)
logger.warning(f"Build finished. The built documents can be found in {pdf_dir}.")

def clean(self, *args):
shutil.rmtree(self._doctrees_dir())
Expand Down
2 changes: 1 addition & 1 deletion src/sage_docbuild/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ def setup(app):

# When building the standard docs, app.srcdir is set to SAGE_DOC_SRC +
# 'LANGUAGE/DOCNAME'.
if app.srcdir.startswith(SAGE_DOC_SRC):
if app.srcdir.is_relative_to(SAGE_DOC_SRC):
app.add_config_value('intersphinx_mapping', {}, False)
app.add_config_value('intersphinx_cache_limit', 5, False)
app.add_config_value('intersphinx_disabled_reftypes', [], False)
Expand Down
4 changes: 1 addition & 3 deletions src/sage_docbuild/ext/inventory_builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Inventory builder
Expand All @@ -23,10 +22,9 @@ class InventoryBuilder(DummyBuilder):
A customized builder which only generates intersphinx "object.inv"
inventory files. The documentation files are not written.
"""

name = "inventory"
format = "inventory"
epilog = "The inventory files are in %(outdir)s."
epilog = "The inventory file is in %(outdir)s."

def get_outdated_docs(self) -> Iterable[str]:
"""
Expand Down

0 comments on commit 0f35a69

Please sign in to comment.