passagemath-docbuild 10.8.1a3__tar.gz → 10.8.1rc0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {passagemath_docbuild-10.8.1a3/passagemath_docbuild.egg-info → passagemath_docbuild-10.8.1rc0}/PKG-INFO +1 -1
  2. passagemath_docbuild-10.8.1rc0/VERSION.txt +1 -0
  3. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0/passagemath_docbuild.egg-info}/PKG-INFO +1 -1
  4. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/__main__.py +44 -57
  5. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/build_options.py +6 -6
  6. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/builders.py +341 -238
  7. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/conf.py +36 -35
  8. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/ext/inventory_builder.py +0 -1
  9. passagemath_docbuild-10.8.1a3/VERSION.txt +0 -1
  10. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/MANIFEST.in +0 -0
  11. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/README.rst +0 -0
  12. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/passagemath_docbuild.egg-info/SOURCES.txt +0 -0
  13. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/passagemath_docbuild.egg-info/dependency_links.txt +0 -0
  14. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/passagemath_docbuild.egg-info/requires.txt +0 -0
  15. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/passagemath_docbuild.egg-info/top_level.txt +0 -0
  16. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/pyproject.toml +0 -0
  17. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/pyproject.toml.m4 +0 -0
  18. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/requirements.txt +0 -0
  19. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/__init__.py +0 -0
  20. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/ext/__init__.py +0 -0
  21. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/ext/multidocs.py +0 -0
  22. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/ext/sage_autodoc.py +0 -0
  23. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/sphinxbuild.py +0 -0
  24. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/utils.py +0 -0
  25. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/sage_docbuild/vendor.py +0 -0
  26. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/setup.cfg +0 -0
  27. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/setup.py +0 -0
  28. {passagemath_docbuild-10.8.1a3 → passagemath_docbuild-10.8.1rc0}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: passagemath-docbuild
3
- Version: 10.8.1a3
3
+ Version: 10.8.1rc0
4
4
  Summary: passagemath: Build system of the Sage documentation
5
5
  Author-email: The Sage Developers <sage-support@googlegroups.com>
6
6
  Maintainer: Matthias Köppe, passagemath contributors
@@ -0,0 +1 @@
1
+ 10.8.1.rc0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: passagemath-docbuild
3
- Version: 10.8.1a3
3
+ Version: 10.8.1rc0
4
4
  Summary: passagemath: Build system of the Sage documentation
5
5
  Author-email: The Sage Developers <sage-support@googlegroups.com>
6
6
  Maintainer: Matthias Köppe, passagemath contributors
@@ -34,6 +34,8 @@ Standard options::
34
34
  -j, --mathjax, --jsmath
35
35
  ignored for backwards compatibility
36
36
  --no-plot do not include graphics auto-generated using the '.. plot' markup
37
+ --no-preparsed-examples
38
+ do not show preparsed versions of EXAMPLES blocks
37
39
  --include-tests-blocks
38
40
  include TESTS blocks in the reference manual
39
41
  --no-pdf-links do not include PDF links in DOCUMENT 'website';
@@ -70,22 +72,15 @@ Advanced options::
70
72
  en/reference. If ARG is 'all', list all main documents
71
73
  """
72
74
 
73
- import argparse
74
75
  import logging
76
+ import argparse
75
77
  import os
78
+ import shlex
76
79
  import sys
77
- from pathlib import Path
78
-
79
80
  import sphinx.ext.intersphinx
80
-
81
+ from sage.env import SAGE_DOC_SRC
82
+ from .builders import DocBuilder, ReferenceBuilder, get_builder, get_documents
81
83
  from . import build_options
82
- from .build_options import BuildOptions
83
- from .builders import (
84
- DocBuilder,
85
- get_all_documents,
86
- get_all_reference_documents,
87
- get_builder,
88
- )
89
84
 
90
85
  logger = logging.getLogger(__name__)
91
86
 
@@ -166,7 +161,7 @@ def help_documents():
166
161
  s += "\n"
167
162
  if 'reference' in docs:
168
163
  s += "Other valid document names take the form 'reference/DIR', where\n"
169
- s += "DIR is a subdirectory of src/doc/en/reference/.\n"
164
+ s += "DIR is a subdirectory of SAGE_DOC_SRC/en/reference/.\n"
170
165
  s += "This builds just the specified part of the reference manual.\n"
171
166
  s += "DOCUMENT may also have the form 'file=/path/to/FILE', which builds\n"
172
167
  s += "the documentation for the specified file.\n"
@@ -178,7 +173,7 @@ def get_formats():
178
173
  Return a list of output formats the Sage documentation builder
179
174
  will accept on the command-line.
180
175
  """
181
- tut_b = DocBuilder('en/tutorial', BuildOptions())
176
+ tut_b = DocBuilder('en/tutorial')
182
177
  formats = tut_b._output_formats()
183
178
  formats.remove('html')
184
179
  return ['html', 'pdf'] + formats
@@ -256,6 +251,21 @@ class help_wrapper(argparse.Action):
256
251
  print(help_formats(), end="")
257
252
  if self.dest == 'commands':
258
253
  print(help_commands(values), end="")
254
+ if self.dest == 'all_documents':
255
+ if values == 'reference':
256
+ b = ReferenceBuilder('reference')
257
+ refdir = os.path.join(os.environ['SAGE_DOC_SRC'], 'en', b.name)
258
+ s = b.get_all_documents(refdir)
259
+ # Put the bibliography first, because it needs to be built first:
260
+ s.remove('reference/references')
261
+ s.insert(0, 'reference/references')
262
+ elif values == 'all':
263
+ s = get_documents()
264
+ # Put the reference manual first, because it needs to be built first:
265
+ s.remove('reference')
266
+ s.insert(0, 'reference')
267
+ for d in s:
268
+ print(d)
259
269
  setattr(namespace, 'printed_list', 1)
260
270
  sys.exit(0)
261
271
 
@@ -295,6 +305,9 @@ def setup_parser():
295
305
  standard.add_argument("--no-plot", dest="no_plot",
296
306
  action="store_true",
297
307
  help="do not include graphics auto-generated using the '.. plot' markup")
308
+ standard.add_argument("--no-preparsed-examples", dest="no_preparsed_examples",
309
+ action="store_true",
310
+ help="do not show preparsed versions of EXAMPLES blocks")
298
311
  standard.add_argument("--include-tests-blocks", dest="skip_tests", default=True,
299
312
  action="store_false",
300
313
  help="include TESTS blocks in the reference manual")
@@ -326,11 +339,7 @@ def setup_parser():
326
339
  type=int, default=1, metavar="LEVEL",
327
340
  action="store",
328
341
  help="report progress at LEVEL=0 (quiet), 1 (normal), 2 (info), or 3 (debug); does not affect children")
329
- standard.add_argument("-s", "--source", dest="source_dir", type=Path,
330
- default=None, metavar="DIR", action="store",
331
- help="directory containing the documentation source files")
332
342
  standard.add_argument("-o", "--output", dest="output_dir", default=None,
333
- type=Path,
334
343
  metavar="DIR", action="store",
335
344
  help="if DOCUMENT is a single file ('file=...'), write output to this directory")
336
345
 
@@ -350,6 +359,7 @@ def setup_parser():
350
359
  advanced.add_argument("--all-documents", dest="all_documents",
351
360
  type=str, metavar="ARG",
352
361
  choices=['all', 'reference'],
362
+ action=help_wrapper,
353
363
  help="if ARG is 'reference', list all subdocuments"
354
364
  " of en/reference. If ARG is 'all', list all main"
355
365
  " documents")
@@ -446,35 +456,8 @@ class IntersphinxCache:
446
456
  def main():
447
457
  # Parse the command-line.
448
458
  parser = setup_parser()
449
- args: BuildOptions = parser.parse_args() # type: ignore
450
-
451
- # Check that the docs source directory exists
452
- if args.source_dir is None:
453
- args.source_dir = Path(os.environ.get('SAGE_DOC_SRC', 'src/doc'))
454
- args.source_dir = args.source_dir.absolute()
455
- if not args.source_dir.is_dir():
456
- parser.error(f"Source directory {args.source_dir} does not exist.")
457
-
458
- if args.all_documents:
459
- if args.all_documents == 'reference':
460
- docs = get_all_reference_documents(args.source_dir / 'en')
461
- elif args.all_documents == 'all':
462
- docs = get_all_documents(args.source_dir)
463
- else:
464
- parser.error(f"Unknown argument {args.all_documents} for --all-documents.")
465
- for d in docs:
466
- print(d.as_posix())
467
- sys.exit(0)
468
-
469
- # Check that the docs output directory exists
470
- if args.output_dir is None:
471
- args.output_dir = Path(os.environ.get('SAGE_DOC', 'src/doc'))
472
- args.output_dir = args.output_dir.absolute()
473
- if not args.output_dir.exists():
474
- try:
475
- args.output_dir.mkdir(parents=True)
476
- except Exception as e:
477
- parser.error(f"Failed to create output directory {args.output_dir}: {e}")
459
+ args = parser.parse_args()
460
+ DocBuilder._options = args
478
461
 
479
462
  # Get the name and type (target format) of the document we are
480
463
  # trying to build.
@@ -482,24 +465,30 @@ def main():
482
465
  if not name or not typ:
483
466
  parser.print_help()
484
467
  sys.exit(1)
468
+ elif name == 'all':
469
+ sys.exit(os.system(f'cd {shlex.quote(SAGE_DOC_SRC)} '
470
+ f'&& ${{MAKE:-make}} -j${{SAGE_NUM_THREADS_PARALLEL:-1}} doc-{typ}'))
485
471
 
486
472
  # Set up module-wide logging.
487
473
  setup_logger(args.verbose, args.color)
488
474
 
489
475
  def excepthook(*exc_info):
490
476
  logger.error('Error building the documentation.', exc_info=exc_info)
491
- logger.info('''
492
- Note: incremental documentation builds sometimes cause spurious
493
- error messages. To be certain that these are real errors, run
494
- "make doc-clean doc-uninstall" first and try again.''')
477
+ if build_options.INCREMENTAL_BUILD:
478
+ logger.error('''
479
+ Note: incremental documentation builds sometimes cause spurious
480
+ error messages. To be certain that these are real errors, run
481
+ "make doc-clean doc-uninstall" first and try again.''')
495
482
 
496
483
  sys.excepthook = excepthook
497
484
 
498
- # Set up the environment based on the command-line options
485
+ # Process selected options.
499
486
  if args.check_nested:
500
487
  os.environ['SAGE_CHECK_NESTED'] = 'True'
488
+
501
489
  if args.underscore:
502
490
  os.environ['SAGE_DOC_UNDERSCORE'] = "True"
491
+
503
492
  if args.sphinx_opts:
504
493
  build_options.ALLSPHINXOPTS += args.sphinx_opts.replace(',', ' ') + " "
505
494
  if args.no_pdf_links:
@@ -508,21 +497,21 @@ error messages. To be certain that these are real errors, run
508
497
  build_options.ALLSPHINXOPTS += "-n "
509
498
  if args.no_plot:
510
499
  os.environ['SAGE_SKIP_PLOT_DIRECTIVE'] = 'yes'
500
+ if args.no_preparsed_examples:
501
+ os.environ['SAGE_PREPARSED_DOC'] = 'no'
511
502
  if args.live_doc:
512
503
  os.environ['SAGE_LIVE_DOC'] = 'yes'
513
504
  if args.skip_tests:
514
505
  os.environ['SAGE_SKIP_TESTS_BLOCKS'] = 'True'
515
506
  if args.use_cdns:
516
507
  os.environ['SAGE_USE_CDNS'] = 'yes'
517
- os.environ['SAGE_DOC_SRC'] = str(args.source_dir)
518
- os.environ['SAGE_DOC'] = str(args.output_dir)
519
508
 
520
509
  build_options.ABORT_ON_ERROR = not args.keep_going
521
510
 
522
511
  # Set up Intersphinx cache
523
512
  _ = IntersphinxCache()
524
513
 
525
- builder = get_builder(name, args)
514
+ builder = get_builder(name)
526
515
 
527
516
  if not args.no_prune_empty_dirs:
528
517
  # Delete empty directories. This is needed in particular for empty
@@ -530,13 +519,11 @@ error messages. To be certain that these are real errors, run
530
519
  # directories it leaves behind. See Issue #20010.
531
520
  # Issue #31948: This is not parallelization-safe; use the option
532
521
  # --no-prune-empty-dirs to turn it off
533
- for dirpath, dirnames, filenames in os.walk(args.source_dir, topdown=False):
522
+ for dirpath, dirnames, filenames in os.walk(builder.dir, topdown=False):
534
523
  if not dirnames + filenames:
535
524
  logger.warning('Deleting empty directory {0}'.format(dirpath))
536
525
  os.rmdir(dirpath)
537
526
 
538
- import sage.all # TODO: Remove once all modules can be imported independently # noqa: F401
539
-
540
527
  build = getattr(builder, typ)
541
528
  build()
542
529
 
@@ -4,10 +4,12 @@ Build options
4
4
  This module defines options for building Sage documentation.
5
5
  """
6
6
 
7
- import argparse
8
7
  import os
9
- from pathlib import Path
8
+ import re
10
9
 
10
+ from sage.env import SAGE_DOC_SRC, SAGE_DOC
11
+
12
+ LANGUAGES = [d for d in os.listdir(SAGE_DOC_SRC) if re.match('^[a-z][a-z]$', d)]
11
13
  SPHINXOPTS = ""
12
14
  PAPER = ""
13
15
  OMIT = ["introspect"] # docs/dirs to omit when listing and building 'all'
@@ -24,9 +26,7 @@ WEBSITESPHINXOPTS = ""
24
26
  # Number of threads to use for parallel-building the documentation.
25
27
  NUM_THREADS = int(os.environ.get('SAGE_NUM_THREADS', 1))
26
28
 
29
+ INCREMENTAL_BUILD = os.path.isdir(SAGE_DOC)
30
+
27
31
  # Error out on errors
28
32
  ABORT_ON_ERROR = True
29
-
30
- class BuildOptions(argparse.Namespace):
31
- source_dir: Path
32
- output_dir: Path