From 2cabc80a24e5f1b24e1eea1c39407c3aa60eee9e Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 11 Nov 2019 06:15:16 -0500 Subject: Better auto-spelling of contributors' names --- MANIFEST.in | 1 + doc/conf.py | 20 +++++++++++++------- igor.py | 3 ++- tox.ini | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 7a84cf20..75257c60 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -37,6 +37,7 @@ recursive-include coverage/ctracer *.c *.h recursive-include doc *.py *.pip *.rst *.txt *.png recursive-include doc/_static * prune doc/_build +prune doc/_spell recursive-include requirements *.pip diff --git a/doc/conf.py b/doc/conf.py index ea00b6ce..379e15cc 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -17,6 +17,8 @@ import atexit import os +import re +import sys import tempfile # If extensions (or modules to document with autodoc) are in another directory, @@ -189,14 +191,18 @@ htmlhelp_basename = 'coveragepydoc' # -- Spelling --- -names_file = tempfile.NamedTemporaryFile(mode='w', prefix="coverage_names_", suffix=".txt") -with open("../CONTRIBUTORS.txt") as contributors: - names_file.write("\n".join(contributors.read().split())) - names_file.flush() -atexit.register(os.remove, names_file.name) +if any("spell" in arg for arg in sys.argv): + names_file = tempfile.NamedTemporaryFile(mode='w', prefix="coverage_names_", suffix=".txt") + with open("../CONTRIBUTORS.txt") as contributors: + names = set(re.split(r"[^\w']", contributors.read())) + names = [n for n in names if len(n) >= 2 and n[0].isupper()] + names_file.write("\n".join(names)) + names_file.flush() + atexit.register(os.remove, names_file.name) + + spelling_word_list_filename = ['dict.txt', names_file.name] + spelling_show_suggestions = False -spelling_word_list_filename = ['dict.txt', names_file.name] -spelling_show_suggestions = False extlinks = { # :github:`123` becomes a link to the GitHub issue, with text "issue 123". diff --git a/igor.py b/igor.py index 0c550dfb..3850ce76 100644 --- a/igor.py +++ b/igor.py @@ -249,6 +249,7 @@ def do_check_eol(): '.tox*', '*.egg-info', '_build', + '_spell', ] checked = set() @@ -296,7 +297,7 @@ def do_check_eol(): check_files("coverage", ["*.py"]) check_files("coverage/ctracer", ["*.c", "*.h"]) - check_files("coverage/htmlfiles", ["*.html", "*.css", "*.js"]) + check_files("coverage/htmlfiles", ["*.html", "*.scss", "*.css", "*.js"]) check_files("tests", ["*.py"]) check_files("tests", ["*,cover"], trail_white=False) check_files("tests/js", ["*.js", "*.html"]) diff --git a/tox.ini b/tox.ini index 935c88dd..78eb44ab 100644 --- a/tox.ini +++ b/tox.ini @@ -55,7 +55,7 @@ deps = -r doc/requirements.pip commands = python doc/check_copied_from.py doc/*.rst - doc8 -q --ignore-path doc/_build doc CHANGES.rst README.rst + doc8 -q --ignore-path 'doc/_*' doc CHANGES.rst README.rst sphinx-build -b html -aqE doc doc/_build/html rst2html.py --strict README.rst doc/_build/trash sphinx-build -b html -b linkcheck -aEnq doc doc/_build/html -- cgit v1.2.1