Skip to content

Commit a50dc92

Browse files
committed
Simplify docbuild
1 parent ab24dac commit a50dc92

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/doc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ doc-inventory-reference: doc-src
4242
$(eval BIBLIO = $(firstword $(DOCS)))
4343
$(eval OTHER_DOCS = $(wordlist 2, 100, $(DOCS)))
4444
$(MAKE) doc-inventory--$(subst /,-,$(BIBLIO))
45-
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" $(foreach doc, $(OTHER_DOCS), doc-inventory--$(subst /,-,$(doc)))
45+
$(MAKE) $(foreach doc, $(OTHER_DOCS), doc-inventory--$(subst /,-,$(doc)))
4646
$(MAKE) SAGE_DOCBUILD_OPTS="$(SAGE_DOCBUILD_OPTS) --no-prune-empty-dirs" doc-inventory--reference_top
4747
endif
4848

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

6868
doc-html: doc-html-reference doc-html-other
6969

src/sage_docbuild/__main__.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
option: nitpicky)
4747
--check-nested check picklability of nested classes in DOCUMENT 'reference'
4848
--no-prune-empty-dirs
49-
do not prune empty directories in the documentation sources
49+
do not prune empty directories in the documentation source
5050
--use-cdns assume internet connection and use CDNs; in particular,
5151
use MathJax CDN
5252
-N, --no-colors do not color output; does not affect children
@@ -325,7 +325,7 @@ def setup_parser():
325325
help="check picklability of nested classes in DOCUMENT 'reference'")
326326
standard.add_argument("--no-prune-empty-dirs", dest="no_prune_empty_dirs",
327327
action="store_true",
328-
help="do not prune empty directories in the documentation sources")
328+
help="do not prune empty directories in the documentation source")
329329
standard.add_argument("--use-cdns", dest="use_cdns", default=False,
330330
action="store_true",
331331
help="assume internet connection and use CDNs; in particular, use MathJax CDN")
@@ -508,22 +508,24 @@ def excepthook(*exc_info):
508508

509509
build_options.ABORT_ON_ERROR = not args.keep_going
510510

511+
# Set up Intersphinx cache
512+
_ = IntersphinxCache()
513+
514+
builder = get_builder(name)
515+
511516
if not args.no_prune_empty_dirs:
512517
# Delete empty directories. This is needed in particular for empty
513518
# directories due to "git checkout" which never deletes empty
514519
# directories it leaves behind. See Issue #20010.
515520
# Issue #31948: This is not parallelization-safe; use the option
516521
# --no-prune-empty-dirs to turn it off
517-
for dirpath, dirnames, filenames in os.walk(SAGE_DOC_SRC, topdown=False):
522+
for dirpath, dirnames, filenames in os.walk(builder.dir, topdown=False):
518523
if not dirnames + filenames:
519524
logger.warning('Deleting empty directory {0}'.format(dirpath))
520525
os.rmdir(dirpath)
521526

522-
# Set up Intersphinx cache
523-
_ = IntersphinxCache()
524-
525-
builder = getattr(get_builder(name), typ)
526-
builder()
527+
build = getattr(builder, typ)
528+
build()
527529

528530

529531
if __name__ == '__main__':

0 commit comments

Comments
 (0)