Browse files

Revert 7f9b38f... [kombu3] No longer supports Python 2.5

  • Loading branch information...
1 parent c738658 commit f42e5597e110add2a4f1e9102f0844fbdc71cc2c @ask ask committed Nov 13, 2012
Showing with 254 additions and 85 deletions.
  1. +3 −0 examples/complete_receive.py
  2. +2 −0 examples/complete_send.py
  3. +2 −0 examples/simple_eventlet_receive.py
  4. +2 −0 examples/simple_eventlet_send.py
  5. +3 −0 examples/simple_receive.py
  6. +2 −0 examples/simple_send.py
  7. +2 −0 examples/simple_task_queue/client.py
  8. +3 −1 examples/simple_task_queue/worker.py
  9. +2 −1 extra/release/bump_version.py
  10. +126 −0 extra/release/flakeplus.py
  11. +1 −1 funtests/transport.py
  12. +1 −0 kombu/clocks.py
  13. +1 −0 kombu/common.py
  14. +4 −3 kombu/connection.py
  15. +1 −1 kombu/messaging.py
  16. +1 −0 kombu/mixins.py
  17. +2 −1 kombu/pidbox.py
  18. +1 −0 kombu/tests/test_common.py
  19. +1 −0 kombu/tests/test_compat.py
  20. +1 −0 kombu/tests/test_connection.py
  21. +1 −0 kombu/tests/test_entities.py
  22. +1 −0 kombu/tests/test_messaging.py
  23. +1 −0 kombu/tests/test_pidbox.py
  24. +1 −1 kombu/tests/test_pools.py
  25. +1 −0 kombu/tests/test_serialization.py
  26. +1 −0 kombu/tests/test_simple.py
  27. +1 −0 kombu/tests/transport/test_base.py
  28. +1 −0 kombu/tests/transport/test_filesystem.py
  29. +1 −0 kombu/tests/transport/test_memory.py
  30. +1 −0 kombu/tests/transport/test_redis.py
  31. +1 −0 kombu/tests/transport/test_sqlalchemy.py
  32. +1 −0 kombu/tests/transport/test_transport.py
  33. +2 −1 kombu/tests/transport/virtual/test_base.py
  34. +1 −0 kombu/tests/transport/virtual/test_exchange.py
  35. +1 −0 kombu/tests/transport/virtual/test_scheduling.py
  36. +1 −0 kombu/tests/utilities/test_encoding.py
  37. +1 −1 kombu/transport/SQS.py
  38. +3 −3 kombu/transport/amqplib.py
  39. +2 −2 kombu/transport/base.py
  40. +1 −1 kombu/transport/mongodb.py
  41. +1 −0 kombu/transport/redis.py
  42. +1 −1 kombu/transport/virtual/__init__.py
  43. +6 −6 kombu/transport/zmq.py
  44. +3 −3 kombu/utils/__init__.py
  45. +2 −2 kombu/utils/encoding.py
  46. +3 −3 kombu/utils/eventio.py
  47. +53 −53 pavement.py
View
3 examples/complete_receive.py
@@ -2,6 +2,9 @@
Example of simple consumer that waits for a single message, acknowledges it
and exits.
"""
+
+from __future__ import with_statement
+
from kombu import Connection, Exchange, Queue, Consumer, eventloop
from pprint import pformat
View
2 examples/complete_send.py
@@ -5,6 +5,8 @@
You can use `complete_receive.py` to receive the message sent.
"""
+from __future__ import with_statement
+
from kombu import Connection, Producer, Exchange, Queue
#: By default messages sent to exchanges are persistent (delivery_mode=2),
View
2 examples/simple_eventlet_receive.py
@@ -6,6 +6,8 @@
message sent.
"""
+from __future__ import with_statement
+
import eventlet
from Queue import Empty
View
2 examples/simple_eventlet_send.py
@@ -6,6 +6,8 @@
message sent.
"""
+from __future__ import with_statement
+
import eventlet
from kombu import Connection
View
3 examples/simple_receive.py
@@ -1,6 +1,9 @@
"""
Example receiving a message using the SimpleQueue interface.
"""
+
+from __future__ import with_statement
+
from kombu import Connection
#: Create connection
View
2 examples/simple_send.py
@@ -6,6 +6,8 @@
message sent.
"""
+from __future__ import with_statement
+
from kombu import Connection
#: Create connection
View
2 examples/simple_task_queue/client.py
@@ -1,3 +1,5 @@
+from __future__ import with_statement
+
from kombu.common import maybe_declare
from kombu.pools import producers
View
4 examples/simple_task_queue/worker.py
@@ -1,3 +1,5 @@
+from __future__ import with_statement
+
from kombu.mixins import ConsumerMixin
from kombu.log import get_logger
from kombu.utils import kwdict, reprcall
@@ -23,7 +25,7 @@ def process_task(self, body, message):
logger.info('Got task: %s', reprcall(fun.__name__, args, kwargs))
try:
fun(*args, **kwdict(kwargs))
- except Exception as exc:
+ except Exception, exc:
logger.error('task raised exception: %r', exc)
message.ack()
View
3 extra/release/bump_version.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
from __future__ import absolute_import
+from __future__ import with_statement
import errno
import os
@@ -22,7 +23,7 @@ def cmd(*args):
def no_enoent():
try:
yield
- except OSError as exc:
+ except OSError, exc:
if exc.errno != errno.ENOENT:
raise
View
126 extra/release/flakeplus.py
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+from __future__ import absolute_import
+from __future__ import with_statement
+
+import os
+import re
+import sys
+
+from collections import defaultdict
+from unipath import Path
+
+RE_COMMENT = r'^\s*\#'
+RE_NOQA = r'.+?\#\s+noqa+'
+RE_MULTILINE_COMMENT_O = r'^\s*(?:\'\'\'|""").+?(?:\'\'\'|""")'
+RE_MULTILINE_COMMENT_S = r'^\s*(?:\'\'\'|""")'
+RE_MULTILINE_COMMENT_E = r'(?:^|.+?)(?:\'\'\'|""")'
+RE_WITH = r'(?:^|\s+)with\s+'
+RE_WITH_IMPORT = r'''from\s+ __future__\s+ import\s+ with_statement'''
+RE_PRINT = r'''(?:^|\s+)print\((?:"|')(?:\W+?)?[A-Z0-9:]{2,}'''
+RE_ABS_IMPORT = r'''from\s+ __future__\s+ import\s+ absolute_import'''
+
+acc = defaultdict(lambda: {"abs": False, "print": False})
+
+
+def compile(regex):
+ return re.compile(regex, re.VERBOSE)
+
+
+class FlakePP(object):
+ re_comment = compile(RE_COMMENT)
+ re_ml_comment_o = compile(RE_MULTILINE_COMMENT_O)
+ re_ml_comment_s = compile(RE_MULTILINE_COMMENT_S)
+ re_ml_comment_e = compile(RE_MULTILINE_COMMENT_E)
+ re_abs_import = compile(RE_ABS_IMPORT)
+ re_print = compile(RE_PRINT)
+ re_with_import = compile(RE_WITH_IMPORT)
+ re_with = compile(RE_WITH)
+ re_noqa = compile(RE_NOQA)
+ map = {"abs": True, "print": False,
+ "with": False, "with-used": False}
+
+ def __init__(self, verbose=False):
+ self.verbose = verbose
+ self.steps = (("abs", self.re_abs_import),
+ ("with", self.re_with_import),
+ ("with-used", self.re_with),
+ ("print", self.re_print))
+
+ def analyze_fh(self, fh):
+ steps = self.steps
+ filename = fh.name
+ acc = dict(self.map)
+ index = 0
+ errors = [0]
+
+ def error(fmt, **kwargs):
+ errors[0] += 1
+ self.announce(fmt, **dict(kwargs, filename=filename))
+
+ for index, line in enumerate(self.strip_comments(fh)):
+ for key, pattern in steps:
+ if pattern.match(line):
+ acc[key] = True
+ if index:
+ if not acc["abs"]:
+ error("%(filename)s: missing abs import")
+ if acc["with-used"] and not acc["with"]:
+ error("%(filename)s: missing with import")
+ if acc["print"]:
+ error("%(filename)s: left over print statement")
+
+ return filename, errors[0], acc
+
+ def analyze_file(self, filename):
+ with open(filename) as fh:
+ return self.analyze_fh(fh)
+
+ def analyze_tree(self, dir):
+ for dirpath, _, filenames in os.walk(dir):
+ for path in (Path(dirpath, f) for f in filenames):
+ if path.endswith(".py"):
+ yield self.analyze_file(path)
+
+ def analyze(self, *paths):
+ for path in map(Path, paths):
+ if path.isdir():
+ for res in self.analyze_tree(path):
+ yield res
+ else:
+ yield self.analyze_file(path)
+
+ def strip_comments(self, fh):
+ re_comment = self.re_comment
+ re_ml_comment_o = self.re_ml_comment_o
+ re_ml_comment_s = self.re_ml_comment_s
+ re_ml_comment_e = self.re_ml_comment_e
+ re_noqa = self.re_noqa
+ in_ml = False
+
+ for line in fh.readlines():
+ if in_ml:
+ if re_ml_comment_e.match(line):
+ in_ml = False
+ else:
+ if re_noqa.match(line) or re_ml_comment_o.match(line):
+ pass
+ elif re_ml_comment_s.match(line):
+ in_ml = True
+ elif re_comment.match(line):
+ pass
+ else:
+ yield line
+
+ def announce(self, fmt, **kwargs):
+ sys.stderr.write((fmt + "\n") % kwargs)
+
+
+def main(argv=sys.argv, exitcode=0):
+ for _, errors, _ in FlakePP(verbose=True).analyze(*argv[1:]):
+ if errors:
+ exitcode = 1
+ return exitcode
+
+
+if __name__ == "__main__":
+ sys.exit(main())
View
2 funtests/transport.py
@@ -79,7 +79,7 @@ def setUp(self):
if self.transport:
try:
self.before_connect()
- except SkipTest as exc:
+ except SkipTest, exc:
self.skip_test_reason = str(exc)
else:
self.do_connect()
View
1 kombu/clocks.py
@@ -9,6 +9,7 @@
"""
from __future__ import absolute_import
+from __future__ import with_statement
import threading
View
1 kombu/common.py
@@ -9,6 +9,7 @@
"""
from __future__ import absolute_import
+from __future__ import with_statement
import os
import socket
View
7 kombu/connection.py
@@ -9,6 +9,7 @@
"""
from __future__ import absolute_import
+from __future__ import with_statement
import errno
import os
@@ -286,7 +287,7 @@ def drain_nowait(self, *args, **kwargs):
except socket.timeout:
self.more_to_read = False
return False
- except socket.error as exc:
+ except socket.error, exc:
if exc.errno in (errno.EAGAIN, errno.EINTR):
self.more_to_read = False
return False
@@ -420,7 +421,7 @@ def _ensured(*args, **kwargs):
for retries in count(0): # for infinity
try:
return fun(*args, **kwargs)
- except self.recoverable_connection_errors as exc:
+ except self.recoverable_connection_errors, exc:
if got_connection:
raise
if max_retries is not None and retries > max_retries:
@@ -443,7 +444,7 @@ def _ensured(*args, **kwargs):
if on_revive:
on_revive(new_channel)
got_connection += 1
- except self.recoverable_channel_errors as exc:
+ except self.recoverable_channel_errors, exc:
if max_retries is not None and retries > max_retries:
raise
self._debug('ensure channel error: %r', exc, exc_info=1)
View
2 kombu/messaging.py
@@ -499,7 +499,7 @@ def _receive_callback(self, message):
if m2p:
message = m2p(message)
decoded = None if on_m else message.decode()
- except Exception as exc:
+ except Exception, exc:
if not self.on_decode_error:
raise
self.on_decode_error(message, exc)
View
1 kombu/mixins.py
@@ -9,6 +9,7 @@
"""
from __future__ import absolute_import
+from __future__ import with_statement
import socket
View
3 kombu/pidbox.py
@@ -9,6 +9,7 @@
"""
from __future__ import absolute_import
+from __future__ import with_statement
import socket
@@ -82,7 +83,7 @@ def dispatch(self, method, arguments=None, reply_to=None, ticket=None,
reply = handle(method, kwdict(arguments))
except SystemExit:
raise
- except Exception as exc:
+ except Exception, exc:
reply = {'error': repr(exc)}
if reply_to:
View
1 kombu/tests/test_common.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
import socket
View
1 kombu/tests/test_compat.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
from mock import patch
View
1 kombu/tests/test_connection.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
import pickle
View
1 kombu/tests/test_entities.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
from kombu import Connection
from kombu.entity import Exchange, Queue
View
1 kombu/tests/test_messaging.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
import anyjson
View
1 kombu/tests/test_pidbox.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
import socket
View
2 kombu/tests/test_pools.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import with_statement
from kombu import Connection
from kombu import pools
View
1 kombu/tests/test_serialization.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
+from __future__ import with_statement
import sys
View
1 kombu/tests/test_simple.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
from Queue import Empty
View
1 kombu/tests/transport/test_base.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
from kombu import Connection, Consumer, Producer, Queue
from kombu.transport.base import Message, StdChannel, Transport
View
1 kombu/tests/transport/test_filesystem.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
import tempfile
View
1 kombu/tests/transport/test_memory.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
import socket
View
1 kombu/tests/transport/test_redis.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
import socket
import types
View
1 kombu/tests/transport/test_sqlalchemy.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
from mock import patch
from nose import SkipTest
View
1 kombu/tests/transport/test_transport.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
from mock import patch
View
3 kombu/tests/transport/virtual/test_base.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
import warnings
@@ -349,7 +350,7 @@ class State(dict):
exc = None
try:
raise KeyError()
- except KeyError as exc_:
+ except KeyError, exc_:
exc = exc_
ru.return_value = [(exc, 1)]
View
1 kombu/tests/transport/virtual/test_exchange.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
from kombu import Connection
from kombu.transport.virtual import exchange
View
1 kombu/tests/transport/virtual/test_scheduling.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
from kombu.transport.virtual.scheduling import FairCycle
View
1 kombu/tests/utilities/test_encoding.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
+from __future__ import with_statement
import sys
View
2 kombu/transport/SQS.py
@@ -274,7 +274,7 @@ def close(self):
if conn:
try:
conn.close()
- except AttributeError as exc: # FIXME ???
+ except AttributeError, exc: # FIXME ???
if "can't set attribute" not in str(exc):
raise
View
6 kombu/transport/amqplib.py
@@ -58,7 +58,7 @@ def _read(self, n, initial=False):
while len(self._read_buffer) < n:
try:
s = self.sock.recv(65536)
- except socket.error as exc:
+ except socket.error, exc:
if not initial and exc.errno in (errno.EAGAIN, errno.EINTR):
continue
raise
@@ -107,7 +107,7 @@ def _read(self, n, initial=False):
while len(result) < n:
try:
s = self.sslobj.read(n - len(result))
- except socket.error as exc:
+ except socket.error, exc:
if not initial and exc.errno in (errno.EAGAIN, errno.EINTR):
continue
raise
@@ -191,7 +191,7 @@ def read_timeout(self, timeout=None):
try:
try:
return self.method_reader.read_method()
- except SSLError as exc:
+ except SSLError, exc:
# http://bugs.python.org/issue10272
if 'timed out' in str(exc):
raise socket.timeout()
View
4 kombu/transport/base.py
@@ -100,14 +100,14 @@ def ack(self):
def ack_log_error(self, logger, errors):
try:
self.ack()
- except errors as exc:
+ except errors, exc:
logger.critical("Couldn't ack %r, reason:%r",
self.delivery_tag, exc, exc_info=True)
def reject_log_error(self, logger, errors):
try:
self.reject()
- except errors as exc:
+ except errors, exc:
logger.critical("Couldn't ack %r, reason: %r",
self.delivery_tag, exc, exc_info=True)
View
2 kombu/transport/mongodb.py
@@ -56,7 +56,7 @@ def _get(self, queue):
msg = self.client.command('findandmodify', 'messages',
query={'queue': queue},
sort={'_id': pymongo.ASCENDING}, remove=True)
- except errors.OperationFailure as exc:
+ except errors.OperationFailure, exc:
if 'No matching object found' in exc.args[0]:
raise Empty()
raise
View
1 kombu/transport/redis.py
@@ -9,6 +9,7 @@
"""
from __future__ import absolute_import
+from __future__ import with_statement
from bisect import bisect
from contextlib import contextmanager
View
2 kombu/transport/virtual/__init__.py
@@ -164,7 +164,7 @@ def restore_unacked(self):
try:
self.channel._restore(message)
- except BaseException as exc:
+ except BaseException, exc:
errors.append((exc, message))
delivered.clear()
return errors
View
12 kombu/transport/zmq.py
@@ -125,9 +125,9 @@ def connect(self, endpoint):
def get(self, queue=None, timeout=None):
try:
return self.sink.recv(flags=zmq.NOBLOCK)
- except zmq.ZMQError as exc:
- if exc.errno == zmq.EAGAIN:
- raise socket.error(errno.EAGAIN, exc.strerror)
+ except zmq.ZMQError, e:
+ if e.errno == zmq.EAGAIN:
+ raise socket.error(errno.EAGAIN, e.strerror)
else:
raise
@@ -174,7 +174,7 @@ def __init__(self, *args, **kwargs):
def _get(self, queue, timeout=None):
try:
return loads(self.client.get(queue, timeout))
- except socket.error as exc:
+ except socket.error, exc:
if exc.errno == errno.EAGAIN and timeout != 0:
raise Empty()
else:
@@ -255,8 +255,8 @@ def drain_events(self, connection, timeout=None):
for channel in connection.channels:
try:
evt = channel.cycle.get(timeout=timeout)
- except socket.error as exc:
- if exc.errno == errno.EAGAIN:
+ except socket.error, e:
+ if e.errno == errno.EAGAIN:
continue
raise
else:
View
6 kombu/utils/__init__.py
@@ -81,7 +81,7 @@ def symbol_by_name(name, aliases={}, imp=None, package=None,
try:
try:
module = imp(module_name, package=package, **kwargs)
- except ValueError as exc:
+ except ValueError, exc:
raise ValueError, ValueError(
"Couldn't import %r: %s" % (name, exc)), sys.exc_info()[2]
return getattr(module, cls_name) if cls_name else module
@@ -218,7 +218,7 @@ def retry_over_time(fun, catch, args=[], kwargs={}, errback=None,
for retries in count():
try:
return fun(*args, **kwargs)
- except catch as exc:
+ except catch, exc:
if max_retries is not None and retries > max_retries:
raise
if callback:
@@ -244,7 +244,7 @@ def emergency_dump_state(state, open_file=open, dump=None):
try:
try:
dump(state, fh, protocol=0)
- except Exception as exc:
+ except Exception, exc:
say('Cannot pickle state: %r. Fallback to pformat.' % (exc, ))
fh.write(pformat(state))
finally:
View
4 kombu/utils/encoding.py
@@ -91,15 +91,15 @@ def _safe_str(s, errors='replace'):
return s
try:
return str(s)
- except Exception as exc:
+ except Exception, exc:
return '<Unrepresentable %r: %r %r>' % (
type(s), exc, '\n'.join(traceback.format_stack()))
encoding = default_encoding()
try:
if isinstance(s, unicode):
return s.encode(encoding, errors)
return unicode(s, encoding, errors)
- except Exception as exc:
+ except Exception, exc:
return '<Unrepresentable %r: %r %r>' % (
type(s), exc, '\n'.join(traceback.format_stack()))
View
6 kombu/utils/eventio.py
@@ -73,7 +73,7 @@ class Poller(object):
def poll(self, timeout):
try:
return self._poll(timeout)
- except Exception as exc:
+ except Exception, exc:
if get_errno(exc) != errno.EINTR:
raise
@@ -86,7 +86,7 @@ def __init__(self):
def register(self, fd, events):
try:
self._epoll.register(fd, events)
- except Exception as exc:
+ except Exception, exc:
if get_errno(exc) != errno.EEXIST:
raise
@@ -97,7 +97,7 @@ def unregister(self, fd):
pass
except ValueError:
pass
- except IOError as exc:
+ except IOError, exc:
if get_errno(exc) != errno.ENOENT:
raise
View
106 pavement.py
@@ -4,15 +4,15 @@
from paver import doctools # noqa
from paver.setuputils import setup # noqa
-PYCOMPILE_CACHES = ['*.pyc', '*$py.class']
+PYCOMPILE_CACHES = ["*.pyc", "*$py.class"]
options(
- sphinx=Bunch(builddir='.build'),
+ sphinx=Bunch(builddir=".build"),
)
def sphinx_builddir(options):
- return path('docs') / options.sphinx.builddir / 'html'
+ return path("docs") / options.sphinx.builddir / "html"
@task
@@ -21,24 +21,24 @@ def clean_docs(options):
@task
-@needs('clean_docs', 'paver.doctools.html')
+@needs("clean_docs", "paver.doctools.html")
def html(options):
- destdir = path('Documentation')
+ destdir = path("Documentation")
destdir.rmtree()
builtdocs = sphinx_builddir(options)
builtdocs.move(destdir)
@task
-@needs('paver.doctools.html')
+@needs("paver.doctools.html")
def qhtml(options):
- destdir = path('Documentation')
+ destdir = path("Documentation")
builtdocs = sphinx_builddir(options)
- sh('rsync -az %s/ %s' % (builtdocs, destdir))
+ sh("rsync -az %s/ %s" % (builtdocs, destdir))
@task
-@needs('clean_docs', 'paver.doctools.html')
+@needs("clean_docs", "paver.doctools.html")
def ghdocs(options):
builtdocs = sphinx_builddir(options)
sh("git checkout gh-pages && \
@@ -49,79 +49,79 @@ def ghdocs(options):
@task
-@needs('clean_docs', 'paver.doctools.html')
+@needs("clean_docs", "paver.doctools.html")
def upload_pypi_docs(options):
- builtdocs = path('docs') / options.builddir / 'html'
+ builtdocs = path("docs") / options.builddir / "html"
sh("python setup.py upload_sphinx --upload-dir='%s'" % (builtdocs))
@task
-@needs('upload_pypi_docs', 'ghdocs')
+@needs("upload_pypi_docs", "ghdocs")
def upload_docs(options):
pass
@task
def autodoc(options):
- sh('extra/release/doc4allmods kombu')
+ sh("extra/release/doc4allmods kombu")
@task
def verifyindex(options):
- sh('extra/release/verify-reference-index.sh')
+ sh("extra/release/verify-reference-index.sh")
@task
def clean_readme(options):
- path('README').unlink()
- path('README.rst').unlink()
+ path("README").unlink()
+ path("README.rst").unlink()
@task
-@needs('clean_readme')
+@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')
+ 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'),
+ ("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, ))
+ 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'),
+ ("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'
+ 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'),
+ ("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')
+ 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});
@@ -131,17 +131,17 @@ def flake8(options):
@task
@cmdopts([
- ('noerror', 'E', 'Ignore errors'),
+ ("noerror", "E", "Ignore errors"),
])
def flakeplus(options):
- noerror = getattr(options, 'noerror', False)
- sh('flakeplus kombu --2.6',
+ noerror = getattr(options, "noerror", False)
+ sh("python extra/release/flakeplus.py kombu",
ignore_error=noerror)
@task
@cmdopts([
- ('noerror', 'E', 'Ignore errors'),
+ ("noerror", "E", "Ignore errors"),
])
def flakes(options):
flake8(options)
@@ -150,39 +150,39 @@ def flakes(options):
@task
@cmdopts([
- ('noerror', 'E', 'Ignore errors'),
+ ("noerror", "E", "Ignore errors"),
])
def pep8(options):
- noerror = getattr(options, 'noerror', False)
+ 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 f -a \\( %s \\) | xargs rm" % (
+ " -o ".join("-name '%s'" % (pat, ) for pat in PYCOMPILE_CACHES), ))
@task
-@needs('removepyc')
+@needs("removepyc")
def gitclean(options):
- sh('git clean -xdn')
+ sh("git clean -xdn")
@task
-@needs('removepyc')
+@needs("removepyc")
def gitcleanforce(options):
- sh('git clean -xdf')
+ sh("git clean -xdf")
@task
-@needs('flakes', 'autodoc', 'verifyindex', 'test', 'gitclean')
+@needs("flakes", "autodoc", "verifyindex", "test", "gitclean")
def releaseok(options):
pass
@task
-@needs('releaseok', 'removepyc', 'upload_docs')
+@needs("releaseok", "removepyc", "upload_docs")
def release(options):
pass

0 comments on commit f42e559

Please sign in to comment.