Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6d50438
Showing
12 changed files
with
678 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
*.gem | ||
*.swp | ||
*.pyc | ||
*#* | ||
build | ||
dist | ||
setuptools-* | ||
.svn/* | ||
.DS_Store | ||
*.so | ||
.Python | ||
distribute-0.6.8-py2.6.egg | ||
distribute-0.6.8.tar.gz | ||
*.egg-info | ||
nohup.out | ||
.coverage | ||
doc/.sass-cache | ||
docs/_build | ||
bin/ | ||
lib/ | ||
man/ | ||
include/ | ||
html/ | ||
.tox | ||
htmlcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
2012 (c) Benoît Chesneau <benoitc@e-engura.org> | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
include NOTICE | ||
include LICENSE | ||
include README.rst | ||
include THANKS | ||
include UNLICENSE | ||
recursive-include docs * | ||
recursive-include examples * | ||
recursive-include tests * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
gaffer | ||
------ | ||
|
||
2012 (c) Benoît Chesneau <benoitc@e-engura.org> | ||
|
||
gaffer is available in the public domain (see UNLICENSE). gaffer | ||
is also optionally available under the MIT License (see LICENSE), meant | ||
especially for jurisdictions that do not recognize public domain works. | ||
|
||
|
||
|
||
tornado_pyuv | ||
------------ | ||
|
||
Copyright (C) 2011 by Saúl Ibarra Corretgé | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
|
||
pidfile.py | ||
---------- | ||
|
||
2009,2012 (c) Benoît Chesneau <benoitc@e-engura.org> | ||
2009,2012 (c) Paul J. Davis <paul.joseph.davis@gmail.com> | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
|
||
gafferctl.py | ||
------------ | ||
|
||
Based and couchapp and placed in the domain public by Benoît Chesneau. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
uzmq | ||
==== | ||
|
||
libuv interface for ZeroMQ. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <http://unlicense.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# -*- coding: utf-8 - | ||
# | ||
# This file is part of uvzmq. See the NOTICE for more information. | ||
|
||
import os | ||
import sys | ||
|
||
from setuptools import setup, find_packages | ||
|
||
from uzmq import __version__ | ||
|
||
py_version = sys.version_info[:2] | ||
|
||
if py_version < (2, 6): | ||
raise RuntimeError('On Python 2, Gaffer requires Python 2.6 or better') | ||
|
||
|
||
CLASSIFIERS = [ | ||
'Development Status :: 4 - Beta', | ||
'Environment :: Web Environment', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: POSIX', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2', | ||
'Programming Language :: Python :: 2.6', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.0', | ||
'Programming Language :: Python :: 3.1', | ||
'Programming Language :: Python :: 3.2', | ||
'Topic :: System :: Boot', | ||
'Topic :: System :: Monitoring', | ||
'Topic :: System :: Systems Administration', | ||
'Topic :: Software Development :: Libraries'] | ||
|
||
|
||
# read long description | ||
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f: | ||
long_description = f.read() | ||
|
||
DATA_FILES = [ | ||
('uzmq', ["LICENSE", "MANIFEST.in", "NOTICE", "README.rst", | ||
"THANKS", "UNLICENSE"]) | ||
] | ||
|
||
|
||
setup(name='uzmq', | ||
version = __version__, | ||
description = 'libuv interface for ZeroMQ', | ||
long_description = long_description, | ||
classifiers = CLASSIFIERS, | ||
license = 'BSD', | ||
url = 'http://github.com/benoitc/uzmq', | ||
author = 'Benoit Chesneau', | ||
author_email = 'benoitc@e-engura.org', | ||
packages=find_packages(), | ||
install_requires = [ | ||
'pyuv>=0.8.3', | ||
'pyzmq' | ||
], | ||
data_files = DATA_FILES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#----------------------------------------------------------------------------- | ||
# Copyright (c) 2010-2012 Brian Granger, Min Ragan-Kelley | ||
# | ||
# This file is part of pyzmq | ||
# | ||
# Distributed under the terms of the New BSD License. The full license is in | ||
# the file COPYING.BSD, distributed as part of this software. | ||
#----------------------------------------------------------------------------- | ||
|
||
#----------------------------------------------------------------------------- | ||
# Imports | ||
#----------------------------------------------------------------------------- | ||
|
||
import time | ||
import os | ||
import threading | ||
|
||
import pyuv | ||
import zmq | ||
from zmq.tests import BaseZMQTestCase | ||
|
||
from uzmq import ZMQPoll | ||
|
||
|
||
#----------------------------------------------------------------------------- | ||
# Tests | ||
#----------------------------------------------------------------------------- | ||
|
||
class TestPoll(BaseZMQTestCase): | ||
|
||
def test_simple(self): | ||
"""Tornado poller implementation maps events correctly""" | ||
req,rep = self.create_bound_pair(zmq.REQ, zmq.REP) | ||
|
||
loop = pyuv.Loop.default_loop() | ||
poll = ZMQPoll(loop, rep) | ||
|
||
r = [] | ||
def cb(handle, ev, error): | ||
r.append(ev & pyuv.UV_READABLE) | ||
r.append(rep.recv()) | ||
|
||
poll.start(pyuv.UV_READABLE, cb) | ||
req.send(b'req') | ||
t = pyuv.Timer(loop) | ||
|
||
def stop(h): | ||
poll.stop() | ||
|
||
t = pyuv.Timer(loop) | ||
t.start(stop, 0.4, 0.0) | ||
loop.run() | ||
|
||
assert r == [1, b'req'] | ||
|
||
def test_poll_rw(self): | ||
"""Tornado poller implementation maps events correctly""" | ||
req,rep = self.create_bound_pair(zmq.REQ, zmq.REP) | ||
|
||
loop = pyuv.Loop.default_loop() | ||
poll = ZMQPoll(loop, rep) | ||
poll1 = ZMQPoll(loop, req) | ||
|
||
r = [] | ||
def cb(handle, ev, error): | ||
r.append(ev & pyuv.UV_READABLE) | ||
r.append(rep.recv()) | ||
|
||
def cb1(handle, ev, error): | ||
handle.stop() | ||
r.append(ev & pyuv.UV_WRITABLE) | ||
req.send(b'req') | ||
|
||
poll.start(pyuv.UV_READABLE, cb) | ||
poll1.start(pyuv.UV_WRITABLE, cb1) | ||
|
||
t = pyuv.Timer(loop) | ||
|
||
def stop(h): | ||
poll.stop() | ||
poll1.close() | ||
|
||
t = pyuv.Timer(loop) | ||
t.start(stop, 0.4, 0.0) | ||
loop.run() | ||
|
||
assert r == [2, 1, b'req'] | ||
|
||
def test_multiple_write(self): | ||
"""Tornado poller implementation maps events correctly""" | ||
req,rep = self.create_bound_pair(zmq.REQ, zmq.REP) | ||
|
||
loop = pyuv.Loop.default_loop() | ||
poll = ZMQPoll(loop, rep) | ||
poll1 = ZMQPoll(loop, req) | ||
|
||
r = [] | ||
r1 = [] | ||
r2 = [] | ||
def cb(handle, ev, error): | ||
r.append(ev & pyuv.UV_READABLE) | ||
|
||
data = rep.recv() | ||
r.append(data) | ||
rep.send(data) | ||
if len(r1) == 2: | ||
handle.stop() | ||
|
||
|
||
def cb1(handle, ev, error): | ||
if ev & pyuv.UV_WRITABLE: | ||
r1.append(ev & pyuv.UV_WRITABLE) | ||
req.send(b'req') | ||
else: | ||
r2.append(req.recv()) | ||
|
||
if len(r2) == 2: | ||
handle.stop() | ||
|
||
poll.start(pyuv.UV_READABLE, cb) | ||
poll1.start(pyuv.UV_READABLE | pyuv.UV_WRITABLE, cb1) | ||
|
||
loop.run() | ||
|
||
assert r == [1, b'req', 1, b'req'] | ||
assert r1 == [2, 2] | ||
assert r2 == [b'req', b'req'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
from uzmq import ZMQPoll | ||
import pyuv | ||
|
||
req,rep = self.create_bound_pair(zmq.REQ, zmq.REP) | ||
|
||
loop = pyuv.Loop.default_loop() | ||
poll = ZMQPoll(loop, rep) | ||
poll1 = ZMQPoll(loop, req) | ||
|
||
r = [] | ||
r1 = [] | ||
def cb(handle, ev, error): | ||
r.append(ev & pyuv.UV_READABLE) | ||
|
||
data = rep.recv() | ||
r.append(data) | ||
rep.send(data) | ||
|
||
if len(r1) == 2: | ||
handle.stop() | ||
|
||
def cb1(handle, ev, error): | ||
if len(r1) == 2: | ||
handle.stop() | ||
|
||
r1.append(ev & pyuv.UV_WRITABLE) | ||
req.send(b'req') | ||
|
||
poll.start(pyuv.UV_READABLE, cb) | ||
poll1.start(pyuv.UV_WRITABLE, cb1) | ||
|
||
loop.run() | ||
|
||
assert r == [1, b'req', 1, b'req'] | ||
assert r1 == [2, 2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 - | ||
# | ||
# This file is part of uzmq. See the NOTICE for more information. | ||
|
||
version_info = (0, 1, 0) | ||
__version__ = ".".join(map(str, version_info)) | ||
|
||
from uzmq.poll import ZMQPoll | ||
from uzmq.sock import ZMQ |
Oops, something went wrong.