pavement.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. @cmdopts([
  52. ("noerror", "E", "Ignore errors"),
  53. ])
  54. def flakes(options):
  55. noerror = getattr(options, "noerror", False)
  56. sh("""find celery -name '*.py' | xargs pyflakes | perl -mstrict -nle'
  57. my $flake = $_;open(my $f, "contrib/release/flakesignore.txt");
  58. my $ignored = 0;
  59. PATTERN: foreach my $p (<$f>) { chomp($p);
  60. if ($p && $flake =~ /$p/m) {
  61. $ignored = 1; last PATTERN; } } close($f);
  62. if (! $ignored) { print $flake; our $FOUND_FLAKE = 1; }
  63. }{exit $FOUND_FLAKE;
  64. '""", ignore_error=noerror)
  65. @task
  66. def clean_readme(options):
  67. path("README").unlink()
  68. path("README.rst").unlink()
  69. @task
  70. @needs("clean_readme")
  71. def readme(options):
  72. sh("python contrib/release/sphinx-to-rst.py docs/templates/readme.txt \
  73. > README.rst")
  74. sh("ln -sf README.rst README")
  75. @task
  76. def bump(options):
  77. sh("bump -c celery")
  78. @task
  79. @cmdopts([
  80. ("coverage", "c", "Enable coverage"),
  81. ("quick", "q", "Quick test"),
  82. ("verbose", "V", "Make more noise"),
  83. ])
  84. def test(options):
  85. cmd = "CELERY_LOADER=default nosetests"
  86. if getattr(options, "coverage", False):
  87. cmd += " --with-coverage3"
  88. if getattr(options, "quick", False):
  89. cmd = "QUICKTEST=1 SKIP_RLIMITS=1 %s" % cmd
  90. if getattr(options, "verbose", False):
  91. cmd += " --verbosity=2"
  92. sh(cmd)
  93. @task
  94. @cmdopts([
  95. ("noerror", "E", "Ignore errors"),
  96. ])
  97. def pep8(options):
  98. noerror = getattr(options, "noerror", False)
  99. return sh("""find . -name "*.py" | xargs pep8 | perl -nle'\
  100. print; $a=1 if $_}{exit($a)'""", ignore_error=noerror)
  101. @task
  102. def removepyc(options):
  103. sh("find . -name '*.pyc' | xargs rm")
  104. @task
  105. @needs("removepyc")
  106. def gitclean(options):
  107. sh("git clean -xdn")
  108. @task
  109. @needs("removepyc")
  110. def gitcleanforce(options):
  111. sh("git clean -xdf")
  112. @task
  113. @needs("pep8", "flakes", "autodoc", "verifyindex", "test", "gitclean")
  114. def releaseok(options):
  115. pass
  116. @task
  117. @needs("releaseok", "removepyc", "upload_docs")
  118. def release(options):
  119. pass