123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- import sys
- from paver.easy import *
- from paver import doctools
- from paver.setuputils import setup
- PYCOMPILE_CACHES = ['*.pyc', '*$py.class']
- 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('paver.doctools.html')
- def qhtml(options):
- destdir = path('Documentation')
- builtdocs = sphinx_builddir(options)
- sh('rsync -az %s/ %s' % (builtdocs, destdir))
- @task
- def autodoc(options):
- sh('extra/release/doc4allmods celery')
- @task
- def verifyindex(options):
- sh('extra/release/verify-reference-index.sh')
- @task
- def verifyconfigref(options):
- sh('PYTHONPATH=. %s extra/release/verify_config_reference.py \
- docs/configuration.rst' % (sys.executable, ))
- @task
- @cmdopts([
- ('noerror', 'E', 'Ignore errors'),
- ])
- def flake8(options):
- noerror = getattr(options, 'noerror', False)
- complexity = getattr(options, 'complexity', 22)
- sh("""flake8 celery | perl -mstrict -mwarnings -nle'
- my $ignore = m/too complex \((\d+)\)/ && $1 le %s;
- if (! $ignore) { print STDERR; our $FOUND_FLAKE = 1 }
- }{exit $FOUND_FLAKE;
- '""" % (complexity, ), ignore_error=noerror)
- @task
- @cmdopts([
- ('noerror', 'E', 'Ignore errors'),
- ])
- def flakeplus(options):
- noerror = getattr(options, 'noerror', False)
- sh('flakeplus celery', ignore_error=noerror)
- @task
- @cmdopts([
- ('noerror', 'E', 'Ignore errors')
- ])
- def flakes(options):
- flake8(options)
- flakeplus(options)
- @task
- def clean_readme(options):
- path('README').unlink()
- path('README.rst').unlink()
- @task
- @needs('clean_readme')
- def readme(options):
- sh('%s extra/release/sphinx-to-rst.py docs/templates/readme.txt \
- > README.rst' % (sys.executable, ))
- @task
- def bump(options):
- sh("extra/release/bump_version.py \
- celery/__init__.py docs/includes/introduction.txt \
- --before-commit='paver readme'")
- @task
- @cmdopts([
- ('coverage', 'c', 'Enable coverage'),
- ('quick', 'q', 'Quick test'),
- ('verbose', 'V', 'Make more noise'),
- ])
- def test(options):
- cmd = 'CELERY_LOADER=default nosetests'
- if getattr(options, 'coverage', False):
- cmd += ' --with-coverage3'
- if getattr(options, 'quick', False):
- cmd = 'QUICKTEST=1 SKIP_RLIMITS=1 %s' % cmd
- if getattr(options, 'verbose', False):
- cmd += ' --verbosity=2'
- sh(cmd)
- @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 . -type f -a \\( %s \\) | xargs rm' % (
- ' -o '.join("-name '%s'" % (pat, ) for pat in PYCOMPILE_CACHES), ))
- @task
- @needs('removepyc')
- def gitclean(options):
- sh('git clean -xdn')
- @task
- @needs('removepyc')
- def gitcleanforce(options):
- sh('git clean -xdf')
- @task
- @needs('flakes', 'autodoc', 'verifyindex',
- 'verifyconfigref', 'test', 'gitclean')
- def releaseok(options):
- pass
- @task
- def verify_authors(options):
- sh('git shortlog -se | cut -f2 | extra/release/attribution.py')
- @task
- def coreloc(options):
- sh('xargs sloccount < extra/release/core-modules.txt')
- @task
- def testloc(options):
- sh('sloccount celery/tests')
- @task
- def loc(options):
- sh('sloccount celery')
|