Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #88: conform to 'new' pyuv API #240

Merged
merged 3 commits into from
Jan 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions neovim/msgpack_rpc/event_loop/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,11 @@ def _connect_child(self, argv):
flags=pyuv.UV_CREATE_PIPE + pyuv.UV_WRITABLE_PIPE)
stderr = pyuv.StdIO(self._error_stream,
flags=pyuv.UV_CREATE_PIPE + pyuv.UV_WRITABLE_PIPE)
self._process = pyuv.Process(self._loop)
self._process.spawn(file=argv[0],
exit_callback=self._on_exit,
args=argv[1:],
flags=pyuv.UV_PROCESS_WINDOWS_HIDE,
stdio=(stdin, stdout, stderr,))
pyuv.Process.spawn(self._loop,
args=argv,
exit_callback=self._on_exit,
flags=pyuv.UV_PROCESS_WINDOWS_HIDE,
stdio=(stdin, stdout, stderr,))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since pyuv isn't a required dependency we can't really specify the version (except for Windows).

We could check if spawn() is a class method:

inspect.ismethod(pyuv.Process.spawn) and pyuv.Process.spawn.__self__ is pyuv.Process

and use that as part of the decision here.

Copy link
Contributor Author

@heliomeiralins heliomeiralins Jan 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so we should require versions newer than 1.0 on Windows.

About Linux, what is your idea? Support both API versions?
I think we should just raise an exception or, ignore pyuv and use asyncio, if pyuv is < 1.0.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we don't need to do it in this PR, but I noticed that here we choose asyncio or pyuv. So as part of that choice, check the API as described in my above comment: if pyuv.Process.spawn is not an instance method, then we known we have pyuv >= 1.x, and we choose EventLoop = UvEventLoop. Else, choose EventLoop = AsyncioEventLoop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I can get back at it monday.

self._error_stream.start_read(self._on_read)

def _start_reading(self):
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
install_requires = [
'msgpack-python>=0.4.0',
]
extras_require = {
'pyuv': ['pyuv>=1.0.0'],
}

if os.name == 'nt':
install_requires.append('pyuv')
install_requires.append('pyuv>=1.0.0')
elif sys.version_info < (3, 4):
# trollius is just a backport of 3.4 asyncio module
install_requires.append('trollius')
Expand All @@ -29,4 +32,5 @@
packages=['neovim', 'neovim.api', 'neovim.msgpack_rpc',
'neovim.msgpack_rpc.event_loop', 'neovim.plugin'],
install_requires=install_requires,
extras_require=extras_require,
zip_safe=False)