This commit is contained in:
Ask Solem 2014-05-22 14:53:38 +01:00
Родитель 100168871a
Коммит 7c99c2b6ea
7 изменённых файлов: 130 добавлений и 240 удалений

Просмотреть файл

@ -271,7 +271,7 @@ semver: http://semver.org.
Stable releases are published at PyPI
while development releases are only available in the GitHub git repository as tags.
All version tags starts with "v", so version 0.8.0 is the tag v0.8.0.
All version tags starts with “v”, so version 0.8.0 is the tag v0.8.0.
.. _git-branches:
@ -580,13 +580,13 @@ To ensure that your changes conform to PEP8 and to run pyflakes
execute:
::
$ paver flake8
$ make flakecheck
To not return a negative exit code when this command fails use the
``-E`` option, this can be convenient while developing:
To not return a negative exit code when this command fails use
the ``flakes`` target instead:
::
$ paver flake8 -E
$ make flakes§
API reference
~~~~~~~~~~~~~
@ -595,8 +595,8 @@ To make sure that all modules have a corresponding section in the API
reference please execute:
::
$ paver autodoc
$ paver verifyindex
$ make apicheck
$ make indexcheck
If files are missing you can add them by copying an existing reference file.
@ -812,7 +812,7 @@ that require 3rd party libraries must be added.
::
$ pip install -U requirements/pkgutils.txt
$ paver readme
$ make readme
That's all that needs to be done, but remember that if your feature
@ -1013,11 +1013,11 @@ The version number must be updated two places:
After you have changed these files you must render
the ``README`` files. There is a script to convert sphinx syntax
to generic reStructured Text syntax, and the paver task `readme`
to generic reStructured Text syntax, and the make target `readme`
does this for you:
::
$ paver readme
$ make readme
Now commit the changes:
::
@ -1035,10 +1035,9 @@ Releasing
Commands to make a new public stable release::
$ paver releaseok # checks pep8, autodoc index, runs tests and more
$ paver removepyc # Remove .pyc files
$ git clean -xdn # Check that there's no left-over files in the repo
$ python setup.py sdist upload # Upload package to PyPI
$ make distcheck # checks pep8, autodoc index, runs tests and more
$ make dist # NOTE: Runs git clean -xdf and removes files not in the repo.
$ python setup.py sdist bdist_wheel upload # Upload package to PyPI
If this is a new release series then you also need to do the
following:

95
Makefile Normal file
Просмотреть файл

@ -0,0 +1,95 @@
PYTHON=python
SPHINX_DIR="docs/"
SPHINX_BUILDDIR="${SPHINX_DIR}/.build"
README="README.rst"
CONTRIBUTING="CONTRIBUTING.rst"
CONFIGREF_SRC="docs/configuration.rst"
README_SRC="docs/templates/readme.txt"
CONTRIBUTING_SRC="docs/contributing.rst"
SPHINX2RST="extra/release/sphinx-to-rst.py"
WORKER_GRAPH_FULL="docs/images/worker_graph_full.png"
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 celery
indexcheck:
extra/release/verify-reference-index.sh
configcheck:
PYTHONPATH=. $(PYTHON) extra/release/verify_config_reference.py $(CONFIGREF_SRC)
flakecheck:
flake8 celery
flakediag:
-$(MAKE) flakecheck
flakepluscheck:
flakeplus celery --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
contributingclean:
-rm -f CONTRIBUTING.rst
$(CONTRIBUTING):
$(PYTHON) $(SPHINX2RST) $(CONTRIBUTING_SRC) > $@
contributing: contributingclean $(CONTRIBUTING)
test:
nosetests -xv celery.tests
cov:
nosetests -xv celery.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
$(WORKER_GRAPH_FULL):
$(PYTHON) -m celery graph bootsteps | dot -Tpng -o $@
graphclean:
-rm -f $(WORKER_GRAPH_FULL)
graph: graphclean $(WORKER_GRAPH_FULL)
gitclean:
git clean -xdn
gitcleanforce:
git clean -xdf
distcheck: flakecheck apicheck indexcheck configcheck readmecheck test gitclean
authorcheck:
git shortlog -se | cut -f2 | extra/release/attribution.py
dist: readme contributing docsclean gitcleanforce removepyc

Просмотреть файл

@ -82,7 +82,7 @@ getting started tutorials:
http://docs.celeryproject.org/en/latest/getting-started/next-steps.html
Celery is...
============
==========
- **Simple**
@ -120,7 +120,7 @@ Celery is...
schedulers, consumers, producers, autoscalers, broker transports and much more.
It supports...
==============
============
- **Message Transports**

Просмотреть файл

@ -596,14 +596,14 @@ execute:
.. code-block:: bash
$ paver flake8
$ make flakecheck
To not return a negative exit code when this command fails use the
:option:`-E` option, this can be convenient while developing:
To not return a negative exit code when this command fails use
the ``flakes`` target instead:
.. code-block:: bash
$ paver flake8 -E
$ make flakes§
API reference
~~~~~~~~~~~~~
@ -613,8 +613,8 @@ reference please execute:
.. code-block:: bash
$ paver autodoc
$ paver verifyindex
$ make apicheck
$ make indexcheck
If files are missing you can add them by copying an existing reference file.
@ -841,7 +841,7 @@ that require 3rd party libraries must be added.
.. code-block:: bash
$ pip install -U requirements/pkgutils.txt
$ paver readme
$ make readme
That's all that needs to be done, but remember that if your feature
@ -1042,12 +1042,12 @@ The version number must be updated two places:
After you have changed these files you must render
the :file:`README` files. There is a script to convert sphinx syntax
to generic reStructured Text syntax, and the paver task `readme`
to generic reStructured Text syntax, and the make target `readme`
does this for you:
.. code-block:: bash
$ paver readme
$ make readme
Now commit the changes:
@ -1067,10 +1067,9 @@ Releasing
Commands to make a new public stable release::
$ paver releaseok # checks pep8, autodoc index, runs tests and more
$ paver removepyc # Remove .pyc files
$ git clean -xdn # Check that there's no left-over files in the repo
$ python setup.py sdist upload # Upload package to PyPI
$ make distcheck # checks pep8, autodoc index, runs tests and more
$ make dist # NOTE: Runs git clean -xdf and removes files not in the repo.
$ python setup.py sdist bdist_wheel upload # Upload package to PyPI
If this is a new release series then you also need to do the
following:

Просмотреть файл

@ -138,7 +138,7 @@ TO_RST_MAP = {RE_CODE_BLOCK: replace_code_block,
RE_INCLUDE: include_file}
def _process(lines):
def _process(lines, encoding='utf-8'):
lines = list(lines) # non-destructive
for i, line in enumerate(lines):
for regex, alt in TO_RST_MAP.items():
@ -150,18 +150,21 @@ def _process(lines):
else:
lines[i] = regex.sub(alt, line)
lines[i] = deref_all(lines[i])
return resolve_pending_refs(asciify(lines))
if encoding == 'ascii':
lines = asciify(lines)
return resolve_pending_refs(lines)
def sphinx_to_rst(fh):
return ''.join(_process(fh))
def sphinx_to_rst(fh, encoding='utf-8'):
return ''.join(_process(fh, encoding))
if __name__ == '__main__':
global dirname
dirname = os.path.dirname(sys.argv[1])
encoding = 'ascii' if '--ascii' in sys.argv else 'utf-8'
fh = codecs.open(sys.argv[1], encoding='utf-8')
try:
print(sphinx_to_rst(fh))
print(sphinx_to_rst(fh, encoding).encode('utf-8'))
finally:
fh.close()

Просмотреть файл

@ -1,205 +0,0 @@
from __future__ import print_function, unicode_literals
import sys
import traceback
from paver.easy import task, sh, cmdopts, path, needs, options, Bunch
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 {0}/ {1}'.format(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=. {0} extra/release/verify_config_reference.py \
docs/configuration.rst'.format(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 {0};
if (! $ignore) {{ print STDERR; our $FOUND_FLAKE = 1 }}
}}{{exit $FOUND_FLAKE;
'""".format(complexity), ignore_error=noerror)
@task
@cmdopts([
('noerror', 'E', 'Ignore errors'),
])
def flakeplus(options):
noerror = getattr(options, 'noerror', False)
sh('flakeplus celery --2.6', ignore_error=noerror)
@task
@cmdopts([
('noerror', 'E', 'Ignore errors')
])
def flakes(options):
flake8(options)
flakeplus(options)
@task
def clean_readme(options):
path('README').unlink_p()
path('README.rst').unlink_p()
@task
def clean_contributing(options):
path('CONTRIBUTING.rst').unlink_p()
@task
def verify_readme(options):
with open('README.rst') as fp:
try:
fp.read().encode('ascii')
except Exception:
print('README contains non-ascii characters', file=sys.stderr)
print('Original exception below...', file=sys.stderr)
traceback.print_stack(file=sys.stderr)
sh('false')
@task
@needs('clean_readme')
def readme(options):
sh('{0} extra/release/sphinx-to-rst.py docs/templates/readme.txt \
> README.rst'.format(sys.executable))
verify_readme()
@task
@needs('clean_contributing')
def contributing(options):
sh('{0} extra/release/sphinx-to-rst.py docs/contributing.rst \
> CONTRIBUTING.rst'.format(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'),
('verbose', 'V', 'Make more noise'),
])
def test(options):
cmd = 'CELERY_LOADER=default nosetests'
if getattr(options, 'coverage', False):
cmd += ' --with-coverage'
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 \\( {0} \\) | xargs rm'.format(
' -o '.join("-name '{0}'".format(pat) for pat in PYCOMPILE_CACHES)))
sh('find . -type d -name "__pycache__" | xargs rm -r')
@task
def update_graphs(options, dest='docs/images/worker_graph_full.png'):
sh('celery graph bootsteps | dot -Tpng -o {dest}'.format(
dest=dest,
))
@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', 'verify_readme', 'test', 'gitclean')
def releaseok(options):
pass
@task
def verify_authors(options):
sh('git shortlog -se | cut -f2 | extra/release/attribution.py')
@task
def testloc(options):
sh('sloccount celery/tests')
@task
def loc(options):
sh('sloccount celery')

Просмотреть файл

@ -1,6 +1,5 @@
setuptools>=1.3.2
wheel
paver
flake8
flakeplus
tox