pavement.py 2.8 KB

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