diff options
| author | jason | 2019-10-25 10:55:55 -0600 |
|---|---|---|
| committer | GitHub | 2019-10-25 10:55:55 -0600 |
| commit | 04702253c51579c883c93bc72e4f94c8f258f434 (patch) | |
| tree | cf19d85fbcb358c410cafb7e1fbbff5592a15ec4 | |
| parent | 9cb7b0e7d44b8dfe5eaf2d7df133a67e072e9481 (diff) | |
| parent | 06c1993646618d750e27aa3b7f9d80c4226e1924 (diff) | |
| download | eventmq-04702253c51579c883c93bc72e4f94c8f258f434.tar.gz eventmq-04702253c51579c883c93bc72e4f94c8f258f434.zip | |
Merge pull request #71 from tpavelchak/feature/add-python-3-7-support0.3.11
Add Python 3.7 support
| -rw-r--r-- | .circleci/config.yml | 6 | ||||
| -rw-r--r-- | bin/logwatcher.py | 2 | ||||
| -rw-r--r-- | eventmq/__init__.py | 2 | ||||
| -rw-r--r-- | eventmq/client/jobs.py | 18 | ||||
| -rw-r--r-- | eventmq/subscriber.py | 3 | ||||
| -rw-r--r-- | setup.py | 4 |
6 files changed, 22 insertions, 13 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 46dab22..7c144ee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml | |||
| @@ -41,3 +41,9 @@ workflows: | |||
| 41 | - test: | 41 | - test: |
| 42 | name: "python 3.5" | 42 | name: "python 3.5" |
| 43 | version: "3.5" | 43 | version: "3.5" |
| 44 | - test: | ||
| 45 | name: "python 3.6" | ||
| 46 | version: "3.5" | ||
| 47 | - test: | ||
| 48 | name: "python 3.7" | ||
| 49 | version: "3.5" | ||
diff --git a/bin/logwatcher.py b/bin/logwatcher.py index dd2860f..1abeb4a 100644 --- a/bin/logwatcher.py +++ b/bin/logwatcher.py | |||
| @@ -13,4 +13,4 @@ while True: | |||
| 13 | 13 | ||
| 14 | if events.get(s) == zmq.POLLIN: | 14 | if events.get(s) == zmq.POLLIN: |
| 15 | msg = s.recv_multipart() | 15 | msg = s.recv_multipart() |
| 16 | print msg # noqa | 16 | print(msg) # noqa |
diff --git a/eventmq/__init__.py b/eventmq/__init__.py index 1515f24..77bbe4a 100644 --- a/eventmq/__init__.py +++ b/eventmq/__init__.py | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | __author__ = 'EventMQ Contributors' | 1 | __author__ = 'EventMQ Contributors' |
| 2 | __version__ = '0.3.10' | 2 | __version__ = '0.3.11' |
| 3 | 3 | ||
| 4 | PROTOCOL_VERSION = 'eMQP/1.0' | 4 | PROTOCOL_VERSION = 'eMQP/1.0' |
| 5 | 5 | ||
diff --git a/eventmq/client/jobs.py b/eventmq/client/jobs.py index 9ec9a07..bd9db58 100644 --- a/eventmq/client/jobs.py +++ b/eventmq/client/jobs.py | |||
| @@ -59,7 +59,7 @@ class Job(object): | |||
| 59 | s.sendmail('me@gmail.com', [recipient,], msg.as_string()) | 59 | s.sendmail('me@gmail.com', [recipient,], msg.as_string()) |
| 60 | s.quit() | 60 | s.quit() |
| 61 | """ | 61 | """ |
| 62 | def __init__(self, broker_addr=None, queue=None, async=True, *args, | 62 | def __init__(self, broker_addr=None, queue=None, async_=True, *args, |
| 63 | **kwargs): | 63 | **kwargs): |
| 64 | """ | 64 | """ |
| 65 | Args: | 65 | Args: |
| @@ -69,20 +69,20 @@ class Job(object): | |||
| 69 | address is given then the value of the environment variable | 69 | address is given then the value of the environment variable |
| 70 | ``EMQ_BROKER_ADDR`` will be used, If that is undefined a | 70 | ``EMQ_BROKER_ADDR`` will be used, If that is undefined a |
| 71 | warning will be emitted and the job will be run synchronously. | 71 | warning will be emitted and the job will be run synchronously. |
| 72 | async (bool): If you want to run all executions of a particular job | 72 | async_ (bool): If you want to run all executions of a particular |
| 73 | synchronously but still decorate it with the job decorator you | 73 | job synchronously but still decorate it with the job decorator |
| 74 | can set this to False. This is useful for unit tests. | 74 | you can set this to False. This is useful for unit tests. |
| 75 | 75 | ||
| 76 | """ | 76 | """ |
| 77 | # conf.BROKER_ADDR isn't used because /etc/eventmq.conf is for the | 77 | # conf.BROKER_ADDR isn't used because /etc/eventmq.conf is for the |
| 78 | # daemons. | 78 | # daemons. |
| 79 | self.broker_addr = broker_addr or os.environ.get(ENV_BROKER_ADDR) | 79 | self.broker_addr = broker_addr or os.environ.get(ENV_BROKER_ADDR) |
| 80 | self.queue = queue | 80 | self.queue = queue |
| 81 | self.async = async | 81 | self.async_ = async_ |
| 82 | 82 | ||
| 83 | def __call__(self, f): | 83 | def __call__(self, f): |
| 84 | def delay(*args, **kwargs): | 84 | def delay(*args, **kwargs): |
| 85 | if self.async and self.broker_addr: | 85 | if self.async_ and self.broker_addr: |
| 86 | socket = Sender() | 86 | socket = Sender() |
| 87 | socket.connect(addr=self.broker_addr) | 87 | socket.connect(addr=self.broker_addr) |
| 88 | 88 | ||
| @@ -91,7 +91,7 @@ class Job(object): | |||
| 91 | 91 | ||
| 92 | return msgid | 92 | return msgid |
| 93 | else: | 93 | else: |
| 94 | if self.async and not self.broker_addr: | 94 | if self.async_ and not self.broker_addr: |
| 95 | logger.warning('No EMQ_BROKER_ADDR defined. Running ' | 95 | logger.warning('No EMQ_BROKER_ADDR defined. Running ' |
| 96 | 'function `{}` synchronously'.format( | 96 | 'function `{}` synchronously'.format( |
| 97 | f.__name__)) | 97 | f.__name__)) |
| @@ -101,13 +101,13 @@ class Job(object): | |||
| 101 | return f | 101 | return f |
| 102 | 102 | ||
| 103 | 103 | ||
| 104 | def job(func, broker_addr=None, queue=None, async=True, *args, | 104 | def job(func, broker_addr=None, queue=None, async_=True, *args, |
| 105 | **kwargs): | 105 | **kwargs): |
| 106 | """ | 106 | """ |
| 107 | Functional decorator helper for creating a deferred eventmq job. See | 107 | Functional decorator helper for creating a deferred eventmq job. See |
| 108 | :class:`Job` for more information. | 108 | :class:`Job` for more information. |
| 109 | """ | 109 | """ |
| 110 | decorator = Job(queue=queue, broker_addr=broker_addr, async=async) | 110 | decorator = Job(queue=queue, broker_addr=broker_addr, async_=async_) |
| 111 | 111 | ||
| 112 | if callable(func): | 112 | if callable(func): |
| 113 | return decorator(func) | 113 | return decorator(func) |
diff --git a/eventmq/subscriber.py b/eventmq/subscriber.py index f585572..ef1aa0b 100644 --- a/eventmq/subscriber.py +++ b/eventmq/subscriber.py | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | """ | 1 | """ |
| 2 | derp subscriber | 2 | derp subscriber |
| 3 | """ | 3 | """ |
| 4 | from past.builtins import xrange | ||
| 4 | import zmq | 5 | import zmq |
| 5 | 6 | ||
| 6 | 7 | ||
| @@ -18,4 +19,4 @@ if __name__ == "__main__": | |||
| 18 | # block until something comes in. normally you'd do something with | 19 | # block until something comes in. normally you'd do something with |
| 19 | # this in another thread or something | 20 | # this in another thread or something |
| 20 | for s in sockets: | 21 | for s in sockets: |
| 21 | print s.recv_multipart() # noqa | 22 | print(s.recv_multipart()) # noqa |
| @@ -19,7 +19,7 @@ setup( | |||
| 19 | description='EventMQ job execution and messaging system based on ZeroMQ', | 19 | description='EventMQ job execution and messaging system based on ZeroMQ', |
| 20 | packages=find_packages(), | 20 | packages=find_packages(), |
| 21 | install_requires=[ | 21 | install_requires=[ |
| 22 | 'pyzmq==15.4.0', | 22 | 'pyzmq==18.1.0', |
| 23 | 'six==1.10.0', | 23 | 'six==1.10.0', |
| 24 | 'monotonic==0.4', | 24 | 'monotonic==0.4', |
| 25 | 'croniter==0.3.10', | 25 | 'croniter==0.3.10', |
| @@ -60,6 +60,8 @@ setup( | |||
| 60 | # that you indicate whether you support Python 2, Python 3 or both. | 60 | # that you indicate whether you support Python 2, Python 3 or both. |
| 61 | 'Programming Language :: Python :: 2.7', | 61 | 'Programming Language :: Python :: 2.7', |
| 62 | 'Programming Language :: Python :: 3.5', | 62 | 'Programming Language :: Python :: 3.5', |
| 63 | 'Programming Language :: Python :: 3.6', | ||
| 64 | 'Programming Language :: Python :: 3.7', | ||
| 63 | ], | 65 | ], |
| 64 | scripts=[ | 66 | scripts=[ |
| 65 | 'bin/emq-cli', | 67 | 'bin/emq-cli', |