diff --git a/CHANGES b/CHANGES index 8fab9da3d..bae146ace 100644 --- a/CHANGES +++ b/CHANGES @@ -32,12 +32,17 @@ Dependencies Incompatible changes -------------------- +* #4467: html theme: Rename ``csss`` block to ``css`` + Deprecated ---------- Features added -------------- +* #4271: sphinx-build supports an option called ``-j auto`` to adjust numbers of + processes automatically. + Bugs fixed ---------- @@ -221,6 +226,7 @@ Bugs fixed * #4412: Updated jQuery version from 3.1.0 to 3.2.1 * #4438: math: math with labels with whitespace cause html error * #2437: make full reference for classes, aliased with "alias of" +* #4434: pure numbers as link targets produce warning Testing -------- diff --git a/doc/man/sphinx-build.rst b/doc/man/sphinx-build.rst index 46f213989..fdd0d36c2 100644 --- a/doc/man/sphinx-build.rst +++ b/doc/man/sphinx-build.rst @@ -143,11 +143,15 @@ Options Distribute the build over *N* processes in parallel, to make building on multiprocessor machines more effective. Note that not all parts and not all - builders of Sphinx can be parallelized. + builders of Sphinx can be parallelized. If ``auto`` argument is given, + Sphinx uses the number of CPUs as *N*. .. versionadded:: 1.2 This option should be considered *experimental*. + .. versionchanged:: 1.7 + Support ``auto`` argument. + .. option:: -c path Don't look for the :file:`conf.py` in the source directory, but use the given diff --git a/sphinx/__main__.py b/sphinx/__main__.py index fbac1c4f7..47a183d08 100644 --- a/sphinx/__main__.py +++ b/sphinx/__main__.py @@ -8,7 +8,9 @@ :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ + import sys -from sphinx import main + +from sphinx.cmd.build import main sys.exit(main(sys.argv[1:])) diff --git a/sphinx/cmdline.py b/sphinx/cmdline.py index e13261dfe..264ee30fe 100644 --- a/sphinx/cmdline.py +++ b/sphinx/cmdline.py @@ -12,6 +12,7 @@ from __future__ import print_function import argparse import os +import multiprocessing import sys import traceback @@ -82,6 +83,23 @@ def handle_exception(app, args, exception, stderr=sys.stderr): file=stderr) +def jobs_argument(value): + # type: (str) -> int + """ + Special type to handle 'auto' flags passed to 'sphinx-build' via -j flag. Can + be expanded to handle other special scaling requests, such as setting job count + to cpu_count. + """ + if value == 'auto': + return multiprocessing.cpu_count() + else: + jobs = int(value) + if jobs <= 0: + raise argparse.ArgumentTypeError('job number should be a positive number') + else: + return jobs + + def get_parser(): # type: () -> argparse.ArgumentParser parser = argparse.ArgumentParser( @@ -128,10 +146,9 @@ files can be built by specifying individual filenames. group.add_argument('-d', metavar='PATH', dest='doctreedir', help='path for the cached environment and doctree ' 'files (default: OUTPUTDIR/.doctrees)') - group.add_argument('-j', metavar='N', default=1, type=int, dest='jobs', + group.add_argument('-j', metavar='N', default=1, type=jobs_argument, dest='jobs', help='build in parallel with N processes where ' - 'possible') - + 'possible (special value "auto" will set N to cpu-count)') group = parser.add_argument_group('build configuration options') group.add_argument('-c', metavar='PATH', dest='confdir', help='path where configuration file (conf.py) is ' diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index 68baa04aa..a26109076 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -607,8 +607,9 @@ class StandardDomain(Domain): if node.tagname == 'target' and 'refid' in node: # indirect hyperlink targets node = document.ids.get(node['refid']) labelid = node['names'][0] - if name.isdigit() or 'refuri' in node or \ - node.tagname.startswith('desc_'): + if (node.tagname == 'footnote' or + 'refuri' in node or + node.tagname.startswith('desc_')): # ignore footnote labels, labels automatically generated from a # link and object descriptions continue diff --git a/sphinx/themes/basic/layout.html b/sphinx/themes/basic/layout.html index dc05e980d..fe8829b77 100644 --- a/sphinx/themes/basic/layout.html +++ b/sphinx/themes/basic/layout.html @@ -123,7 +123,7 @@ {%- block htmltitle %}