Browse Source

Replaced makefile with a Paver pavement file.

Ask Solem 15 years ago
parent
commit
9f2622562a
2 changed files with 139 additions and 69 deletions
  1. 0 69
      Makefile
  2. 139 0
      pavement.py

+ 0 - 69
Makefile

@@ -1,69 +0,0 @@
-PEP8=pep8
-
-pep8:
-	(find . -name "*.py" | xargs pep8 | perl -nle'\
-		print; $$a=1 if $$_}{exit($$a)')
-
-cycomplex:
-	find celery -type f -name "*.py" | xargs pygenie.py complexity
-
-ghdocs:
-	rm -rf docs/.build
-	contrib/doc2ghpages
-
-upload_github_docs: ghdocs
-
-upload_pypi_docs:
-	python setup.py build_sphinx && python setup.py upload_sphinx
-
-upload_docs: upload_github_docs upload_pypi_docs
-
-autodoc:
-	contrib/doc4allmods celery
-
-verifyindex:
-	contrib/verify-reference-index.sh
-
-flakes:
-	find . -name "*.py" | xargs pyflakes
-
-clean_readme:
-	rm -f README.rst README
-
-readme: clean_readme
-	python contrib/sphinx-to-rst.py docs/templates/readme.txt > README.rst
-	ln -s README.rst README
-
-bump:
-	contrib/bump -c celery
-
-cover:
-	(cd testproj; python manage.py test --coverage)
-
-coverage: cover
-
-quickcover:
-	(cd testproj; env QUICKTEST=1 SKIP_RLIMITS=1 python manage.py test --coverage)
-
-test:
-	(cd testproj; python manage.py test)
-
-quicktest:
-	(cd testproj; SKIP_RLIMITS=1 python manage.py test)
-
-testverbose:
-	(cd testproj; python manage.py test --verbosity=2)
-
-releaseok: pep8 autodoc verifyindex test gitclean
-
-removepyc:
-	find . -name "*.pyc" | xargs rm
-
-release: releaseok ghdocs removepyc
-
-gitclean: removepyc
-	git clean -xdn
-
-gitcleanforce: removepyc
-	git clean -xdf
-

+ 139 - 0
pavement.py

@@ -0,0 +1,139 @@
+from paver.easy import *
+from paver import doctools
+from paver.setuputils import setup
+
+options(
+        sphinx=Bunch(builddir=".build"),
+)
+
+def sphinx_builddir(options):
+    return path("docs") / options.sphinx.builddir / "html"
+
+
+@task
+def clean_docs(options):
+    sphinx_builddir(options).rmtree()
+
+
+@task
+@needs("clean_docs", "paver.doctools.html")
+def html(options):
+    destdir = path("Documentation")
+    destdir.rmtree()
+    builtdocs = sphinx_builddir(options)
+    builtdocs.move(destdir)
+
+
+@task
+@needs("clean_docs", "paver.doctools.html")
+def ghdocs(options):
+    builtdocs = sphinx_builddir(options)
+    sh("sphinx-to-github", cwd=builtdocs)
+    sh("git checkout gh-pages && \
+            cp -r '%s/*' .    && \
+            git commit . -m 'Rendered documentation for Github Pages.' && \
+            git push origin gh-pages && \
+            git checkout master" % builtdocs)
+
+
+@task
+@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))
+
+
+@task
+@needs("upload_pypi_docs", "ghdocs")
+def upload_docs(options):
+    pass
+
+
+@task
+def autodoc(options):
+    sh("contrib/doc4allmods/celery")
+
+
+@task
+def verifyindex(options):
+    sh("contrib/verify-reference-index.sh")
+
+
+@task
+def flakes(options):
+    sh("find celery -name '*.py' | xargs pyflakes")
+
+
+@task
+def clean_readme(options):
+    path("README").unlink()
+    path("README.rst").unlink()
+
+
+@task
+@needs("clean_readme")
+def readme(options):
+    sh("python contrib/sphinx-to-rst.py docs/templates/readme.txt \
+            > README.txt")
+    sh("ln -s README.rst README")
+
+
+@task
+def bump(options):
+    sh("contrib/bump -c celery")
+
+
+@task
+@cmdopts([
+    ("coverage", "c", "Enable coverage"),
+    ("quick", "q", "Quick test"),
+    ("verbose", "V", "Make more noise"),
+])
+def test(options):
+    cmd = "python manage.py test"
+    if getattr(options, "coverage", False):
+        cmd += " --coverage"
+    if getattr(options, "quick", False):
+        cmd = "env QUICKTEST=1 SKIP_RLIMITS=1 %s" % cmd
+    if getattr(options, "verbose", False):
+        cmd += " --verbosity=2"
+    sh(cmd, cwd="testproj")
+
+
+@task
+@cmdopts([
+    ("noerror", "E", "Ignore errors"),
+])
+def pep8(options):
+    noerror = getattr(options, "noerror", False)
+    return sh("""find . -name "*.py" | xargs pep8 | perl -nle'\
+            print; $a=1 if $_}{exit($a)'""", ignore_error=noerror)
+
+
+@task
+def removepyc(options):
+    sh("find . -name '*.pyc' | xargs rm")
+
+
+@task
+@needs("removepyc")
+def gitclean(options):
+    sh("git clean -xdn")
+
+
+@task
+@needs("removepyc")
+def gitcleanforce(options):
+    sh("git clean -xdf")
+
+
+@task
+@needs("pep8", "autodoc", "verifyindex", "test", "gitclean")
+def releaseok(options):
+    pass
+
+
+@task
+@needs("releaseok", "removepyc", "upload_docs")
+def release(options):
+    pass