From 50e2d6c1a48c0f3d2669a877ad7e541938c6cf28 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Tue, 27 May 2014 14:33:11 +0100 Subject: [PATCH] Adds Makefile --- Makefile | 76 +++++++++++++++ funtests/transport.py | 2 - kombu/tests/case.py | 4 - pavement.py | 190 -------------------------------------- requirements/pkgutils.txt | 1 - 5 files changed, 76 insertions(+), 197 deletions(-) create mode 100644 Makefile delete mode 100644 pavement.py diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..741d4963 --- /dev/null +++ b/Makefile @@ -0,0 +1,76 @@ +PYTHON=python +SPHINX_DIR="docs/" +SPHINX_BUILDDIR="${SPHINX_DIR}/.build" +README="README.rst" +README_SRC="docs/templates/readme.txt" +CONTRIBUTING_SRC="docs/contributing.rst" +SPHINX2RST="extra/release/sphinx-to-rst.py" + +SPHINX_HTMLDIR = "${SPHINX_BUILDDIR}/html" + +html: + (cd "$(SPHINX_DIR)"; make html) + mv "$(SPHINX_HTMLDIR)" Documentation + +docsclean: + -rm -rf "$(SPHINX_BUILDDIR)" + +htmlclean: + -rm -rf "$(SPHINX)" + +apicheck: + extra/release/doc4allmods kombu + +indexcheck: + extra/release/verify-reference-index.sh + +configcheck: + PYTHONPATH=. $(PYTHON) extra/release/verify_config_reference.py $(CONFIGREF_SRC) + +flakecheck: + flake8 kombu + +flakediag: + -$(MAKE) flakecheck + +flakepluscheck: + flakeplus kombu --2.6 + +flakeplusdiag: + -$(MAKE) flakepluscheck + +flakes: flakediag flakeplusdiag + +readmeclean: + -rm -f $(README) + +readmecheck: + iconv -f ascii -t ascii $(README) >/dev/null + +$(README): + $(PYTHON) $(SPHINX2RST) $(README_SRC) --ascii > $@ + +readme: readmeclean $(README) readmecheck + +test: + nosetests -xv kombu.tests + +cov: + nosetests -xv kombu.tests --with-coverage --cover-html --cover-branch + +removepyc: + -find . -type f -a \( -name "*.pyc" -o -name "*$$py.class" \) | xargs rm + -find . -type d -name "__pycache__" | xargs rm -r + +gitclean: + git clean -xdn + +gitcleanforce: + git clean -xdf + +bump_version: + $(PYTHON) extra/release/bump_version.py kombu/__init__.py README.rst + +distcheck: flakecheck apicheck indexcheck configcheck readmecheck test gitclean + +dist: readme docsclean gitcleanforce removepyc diff --git a/funtests/transport.py b/funtests/transport.py index 6e943742..93e2107c 100644 --- a/funtests/transport.py +++ b/funtests/transport.py @@ -14,7 +14,6 @@ from nose import SkipTest from kombu import Connection from kombu import Exchange, Queue from kombu.five import range -from kombu.tests.case import skip_if_quick if sys.version_info >= (2, 5): from hashlib import sha256 as _digest @@ -163,7 +162,6 @@ class TransportCase(unittest.TestCase): def _digest(self, data): return _digest(data).hexdigest() - @skip_if_quick def test_produce__consume_large_messages( self, bytes=1048576, n=10, charset=string.punctuation + string.letters + string.digits): diff --git a/kombu/tests/case.py b/kombu/tests/case.py index c265cb91..09102c6e 100644 --- a/kombu/tests/case.py +++ b/kombu/tests/case.py @@ -186,7 +186,3 @@ def skip_if_not_module(module, import_errors=(ImportError, )): return fun(*args, **kwargs) return _skip_if_not_module return _wrap_test - - -def skip_if_quick(fun): - return skip_if_environ('QUICKTEST')(fun) diff --git a/pavement.py b/pavement.py deleted file mode 100644 index 017ad7d5..00000000 --- a/pavement.py +++ /dev/null @@ -1,190 +0,0 @@ -import os - -from paver.easy import * # noqa -from paver import doctools # noqa -from paver.setuputils import setup # noqa - -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 -@needs('clean_docs', 'paver.doctools.html') -def ghdocs(options): - builtdocs = sphinx_builddir(options) - 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('extra/release/doc4allmods kombu') - - -@task -def verifyindex(options): - sh('extra/release/verify-reference-index.sh') - - -@task -def clean_readme(options): - path('README').unlink() - path('README.rst').unlink() - - -@task -@needs('clean_readme') -def readme(options): - sh('python extra/release/sphinx-to-rst.py docs/templates/readme.txt \ - > README.rst') - sh('ln -sf README.rst README') - - -@task -@cmdopts([ - ('custom=', 'C', 'custom version'), -]) -def bump(options): - s = ("-- '%s'" % (options.custom, ) if getattr(options, 'custom', None) - else '') - sh('extra/release/bump_version.py \ - kombu/__init__.py README.rst %s' % (s, )) - - -@task -@cmdopts([ - ('coverage', 'c', 'Enable coverage'), - ('quick', 'q', 'Quick test'), - ('verbose', 'V', 'Make more noise'), -]) -def test(options): - cmd = '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 flake8(options): - noerror = getattr(options, 'noerror', False) - complexity = getattr(options, 'complexity', 22) - migrations_path = os.path.join('kombu', 'transport', 'django', - 'migrations', '0.+?\.py') - sh("""flake8 kombu | perl -mstrict -mwarnings -nle' - my $ignore = (m/too complex \((\d+)\)/ && $1 le %s) - || (m{^%s}); - if (! $ignore) { print STDERR; our $FOUND_FLAKE = 1 } - }{exit $FOUND_FLAKE; - '""" % (complexity, migrations_path), ignore_error=noerror) - - -@task -@cmdopts([ - ('noerror', 'E', 'Ignore errors'), -]) -def flakeplus(options): - noerror = getattr(options, 'noerror', False) - sh('flakeplus kombu --2.6', - ignore_error=noerror) - - -@task -@cmdopts([ - ('noerror', 'E', 'Ignore errors'), -]) -def flakes(options): - flake8(options) - flakeplus(options) - - -@task -@cmdopts([ - ('noerror', 'E', 'Ignore errors'), -]) -def pep8(options): - noerror = getattr(options, 'noerror', False) - return sh("""find kombu -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), )) - sh('find . -type d -name "__pycache__" | xargs rm -r') - - -@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', 'test', 'gitclean') -def releaseok(options): - pass - - -@task -@needs('releaseok', 'removepyc', 'upload_docs') -def release(options): - pass diff --git a/requirements/pkgutils.txt b/requirements/pkgutils.txt index 5da811f1..de53de22 100644 --- a/requirements/pkgutils.txt +++ b/requirements/pkgutils.txt @@ -1,3 +1,2 @@ -paver flake8 Sphinx