Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ doc-inventory-reference: doc-src
$(eval BIBLIO = $(firstword $(DOCS)))
$(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS)))
$(MAKE) doc-inventory--$(subst /,-,$(BIBLIO))
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(OTHER_DOCS), doc-inventory--$(subst /,-,$(doc)))
$(MAKE) $(foreach doc, $(OTHER_DOCS), doc-inventory--$(subst /,-,$(doc)))
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-inventory--reference_top
endif

Expand All @@ -63,7 +63,7 @@ doc-html-reference: doc-html-reference-sub
doc-html-other: doc-html-reference
$(eval DOCS = $(shell sage --docbuild --all-documents all))
@if [ -z "$(DOCS)" ]; then echo "Error: 'sage --docbuild --all-documents' failed"; exit 1; fi
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(wordlist 2, 100, $(DOCS)), doc-html--$(subst /,-,$(doc)))
$(MAKE) $(foreach doc, $(wordlist 2, 100, $(DOCS)), doc-html--$(subst /,-,$(doc)))

doc-html: doc-html-reference doc-html-other

Expand Down
18 changes: 10 additions & 8 deletions src/sage_docbuild/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
option: nitpicky)
--check-nested check picklability of nested classes in DOCUMENT 'reference'
--no-prune-empty-dirs
do not prune empty directories in the documentation sources
do not prune empty directories in the documentation source
--use-cdns assume internet connection and use CDNs; in particular,
use MathJax CDN
-N, --no-colors do not color output; does not affect children
Expand Down Expand Up @@ -325,7 +325,7 @@ def setup_parser():
help="check picklability of nested classes in DOCUMENT 'reference'")
standard.add_argument("--no-prune-empty-dirs", dest="no_prune_empty_dirs",
action="store_true",
help="do not prune empty directories in the documentation sources")
help="do not prune empty directories in the documentation source")
standard.add_argument("--use-cdns", dest="use_cdns", default=False,
action="store_true",
help="assume internet connection and use CDNs; in particular, use MathJax CDN")
Expand Down Expand Up @@ -508,22 +508,24 @@ def excepthook(*exc_info):

build_options.ABORT_ON_ERROR = not args.keep_going

# Set up Intersphinx cache
_ = IntersphinxCache()

builder = get_builder(name)

if not args.no_prune_empty_dirs:
# Delete empty directories. This is needed in particular for empty
# directories due to "git checkout" which never deletes empty
# directories it leaves behind. See Issue #20010.
# Issue #31948: This is not parallelization-safe; use the option
# --no-prune-empty-dirs to turn it off
for dirpath, dirnames, filenames in os.walk(SAGE_DOC_SRC, topdown=False):
for dirpath, dirnames, filenames in os.walk(builder.dir, topdown=False):
if not dirnames + filenames:
logger.warning('Deleting empty directory {0}'.format(dirpath))
os.rmdir(dirpath)

# Set up Intersphinx cache
_ = IntersphinxCache()

builder = getattr(get_builder(name), typ)
builder()
build = getattr(builder, typ)
build()


if __name__ == '__main__':
Expand Down