pavement.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. from paver.easy import *
  2. from paver import doctools
  3. from paver.setuputils import setup
  4. options(
  5. sphinx=Bunch(builddir=".build"),
  6. )
  7. def sphinx_builddir(options):
  8. return path("docs") / options.sphinx.builddir / "html"
  9. @task
  10. def clean_docs(options):
  11. sphinx_builddir(options).rmtree()
  12. @task
  13. @needs("clean_docs", "paver.doctools.html")
  14. def html(options):
  15. destdir = path("Documentation")
  16. destdir.rmtree()
  17. builtdocs = sphinx_builddir(options)
  18. builtdocs.move(destdir)
  19. @task
  20. @needs("paver.doctools.html")
  21. def qhtml(options):
  22. destdir = path("Documentation")
  23. builtdocs = sphinx_builddir(options)
  24. sh("rsync -az %s/ %s" % (builtdocs, destdir))
  25. @task
  26. @needs("clean_docs", "paver.doctools.html")
  27. def ghdocs(options):
  28. builtdocs = sphinx_builddir(options)
  29. sh("sphinx-to-github", cwd=builtdocs)
  30. sh("git checkout gh-pages && \
  31. cp -r %s/* . && \
  32. git commit . -m 'Rendered documentation for Github Pages.' && \
  33. git push origin gh-pages && \
  34. git checkout master" % builtdocs)
  35. @task
  36. @needs("clean_docs", "paver.doctools.html")
  37. def upload_pypi_docs(options):
  38. builtdocs = path("docs") / options.builddir / "html"
  39. sh("python setup.py upload_sphinx --upload-dir='%s'" % (builtdocs))
  40. @task
  41. @needs("upload_pypi_docs", "ghdocs")
  42. def upload_docs(options):
  43. pass
  44. @task
  45. def autodoc(options):
  46. sh("contrib/release/doc4allmods celery")
  47. @task
  48. def verifyindex(options):
  49. sh("contrib/release/verify-reference-index.sh")
  50. @task
  51. def flakes(options):
  52. sh("find celery -name '*.py' | xargs pyflakes")
  53. @task
  54. def clean_readme(options):
  55. path("README").unlink()
  56. path("README.rst").unlink()
  57. @task
  58. @needs("clean_readme")
  59. def readme(options):
  60. sh("python contrib/release/sphinx-to-rst.py docs/templates/readme.txt \
  61. > README.rst")
  62. sh("ln -sf README.rst README")
  63. @task
  64. def bump(options):
  65. sh("bump -c celery")
  66. @task
  67. @cmdopts([
  68. ("coverage", "c", "Enable coverage"),
  69. ("quick", "q", "Quick test"),
  70. ("verbose", "V", "Make more noise"),
  71. ])
  72. def test(options):
  73. cmd = "CELERY_LOADER=default nosetests"
  74. if getattr(options, "coverage", False):
  75. cmd += " --with-coverage3"
  76. if getattr(options, "quick", False):
  77. cmd = "QUICKTEST=1 SKIP_RLIMITS=1 %s" % cmd
  78. if getattr(options, "verbose", False):
  79. cmd += " --verbosity=2"
  80. sh(cmd)
  81. @task
  82. @cmdopts([
  83. ("noerror", "E", "Ignore errors"),
  84. ])
  85. def pep8(options):
  86. noerror = getattr(options, "noerror", False)
  87. return sh("""find . -name "*.py" | xargs pep8 | perl -nle'\
  88. print; $a=1 if $_}{exit($a)'""", ignore_error=noerror)
  89. @task
  90. def removepyc(options):
  91. sh("find . -name '*.pyc' | xargs rm")
  92. @task
  93. @needs("removepyc")
  94. def gitclean(options):
  95. sh("git clean -xdn")
  96. @task
  97. @needs("removepyc")
  98. def gitcleanforce(options):
  99. sh("git clean -xdf")
  100. @task
  101. @needs("pep8", "autodoc", "verifyindex", "test", "gitclean")
  102. def releaseok(options):
  103. pass
  104. @task
  105. @needs("releaseok", "removepyc", "upload_docs")
  106. def release(options):
  107. pass