Browse Source

Adds paver task: verifyconfigref: Verifies that all Celery settings are documented

Ask Solem 14 years ago
parent
commit
57581178ff
2 changed files with 41 additions and 4 deletions
  1. 28 0
      contrib/release/verify_config_reference.py
  2. 13 4
      pavement.py

+ 28 - 0
contrib/release/verify_config_reference.py

@@ -0,0 +1,28 @@
+from fileinput import input
+from sys import exit, stderr
+
+from celery.app.defaults import DEFAULTS
+
+ignore = frozenset(["BROKER_INSIST", "CELERYD_POOL_PUTLOCKS"])
+
+
+def find_undocumented_settings(directive=".. setting:: "):
+    all = set(DEFAULTS.keys())
+    documented = set(line.strip()[len(directive):].strip()
+                        for line in input()
+                            if line.strip().startswith(directive))
+    return [setting for setting in all ^ documented
+                if setting not in ignore]
+
+
+if __name__ == "__main__":
+    sep = """\n  * """
+    missing = find_undocumented_settings()
+    if missing:
+        stderr.write("Error: found undocumented settings:%s%s\n" % (
+                        sep, sep.join(sorted(missing))))
+        exit(1)
+    print("OK: Configuration reference complete :-)")
+    exit(0)
+
+

+ 13 - 4
pavement.py

@@ -1,3 +1,4 @@
+import sys
 from paver.easy import *
 from paver import doctools
 from paver.setuputils import setup
@@ -49,7 +50,8 @@ def ghdocs(options):
 @needs("clean_docs", "paver.doctools.html")
 def upload_pypi_docs(options):
     builtdocs = path("docs") / options.builddir / "html"
-    sh("python setup.py upload_sphinx --upload-dir='%s'" % (builtdocs))
+    sh("%s setup.py upload_sphinx --upload-dir='%s'" % (
+        sys.executable, builtdocs))
 
 
 @task
@@ -68,6 +70,12 @@ def verifyindex(options):
     sh("contrib/release/verify-reference-index.sh")
 
 
+@task
+def verifyconfigref(options):
+    sh("PYTHONPATH=. %s contrib/release/verify_config_reference.py \
+            docs/configuration.rst" % (sys.executable, ))
+
+
 @task
 def flakes(options):
     noerror = getattr(options, "noerror", False)
@@ -91,8 +99,8 @@ def clean_readme(options):
 @task
 @needs("clean_readme")
 def readme(options):
-    sh("python contrib/release/sphinx-to-rst.py docs/templates/readme.txt \
-            > README.rst")
+    sh("%s contrib/release/sphinx-to-rst.py docs/templates/readme.txt \
+            > README.rst" % (sys.executable, ))
     sh("ln -sf README.rst README")
 
 
@@ -146,7 +154,8 @@ def gitcleanforce(options):
 
 
 @task
-@needs("pep8", "flakes", "autodoc", "verifyindex", "test", "gitclean")
+@needs("pep8", "flakes", "autodoc", "verifyindex",
+       "verifyconfigref", "test", "gitclean")
 def releaseok(options):
     pass