Python 3 asyncio selectors fix #344

Merged
akinwale merged 5 commits from python3-selector-fix into master 2018-10-28 19:12:40 +01:00
3 changed files with 22 additions and 2 deletions
Showing only changes of commit 9b303b38c7 - Show all commits

View file

@ -161,7 +161,7 @@ class Python3Recipe(TargetPythonRecipe):
def prebuild_arch(self, arch):
super(Python3Recipe, self).prebuild_arch(arch)
if self.version == '3.6':
Python3Recipe.patches = ['patch_python3.6.patch']
Python3Recipe.patches = ['patch_python3.6.patch', 'selectors.patch']
build_dir = self.get_build_dir(arch.arch)
shprint(sh.ln, '-sf',
realpath(join(build_dir, 'Lib/site-packages/README.txt')),

View file

@ -0,0 +1,15 @@
--- a/Lib/selectors.py 2018-06-27 00:39:50.000000000 +0100
+++ b/Lib/selectors.py 2018-10-28 17:39:46.027757518 +0100
@@ -599,9 +599,9 @@
# Choose the best implementation, roughly:
# epoll|kqueue|devpoll > poll > select.
# select() also can't accept a FD > FD_SETSIZE (usually around 1024)
-if 'KqueueSelector' in globals():
- DefaultSelector = KqueueSelector
-elif 'EpollSelector' in globals():
+#if 'KqueueSelector' in globals():
+# DefaultSelector = KqueueSelector
+if 'EpollSelector' in globals():
DefaultSelector = EpollSelector
elif 'DevpollSelector' in globals():
DefaultSelector = DevpollSelector

View file

@ -1,10 +1,15 @@
import sys
from twisted.internet import asyncioreactor
if 'twisted.internet.reactor' not in sys.modules:
asyncioreactor.install()
eukreign commented 2018-10-28 18:44:36 +01:00 (Migrated from github.com)
Review

This might lead to confusing results if the wrong reactor was installed previously. I think it would better to either 1) just asyncioreactor.install() without putting it inside of a conditional or, alternately, 2) add an else to the existing condition which checks that the reactor installed previously is in fact an asyncioreactor.

This might lead to confusing results if the wrong reactor was installed previously. I think it would better to either 1) just `asyncioreactor.install()` without putting it inside of a conditional or, alternately, 2) add an `else` to the existing condition which checks that the reactor installed previously is in fact an `asyncioreactor`.
import keyring.backend
import platform
import ssl
from jnius import autoclass
# Fixes / patches / overrides
# platform.platform() in libc_ver: IOError: [Errno 21] Is a directory
from jnius import autoclass
lbrynet_utils = autoclass('io.lbry.browser.Utils')
service = autoclass('io.lbry.browser.LbrynetService').serviceInstance
platform.platform = lambda: 'Android %s (API %s)' % (lbrynet_utils.getAndroidRelease(), lbrynet_utils.getAndroidSdk())