aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Peter Korsgaard <peter@korsgaard.com>2020-10-04 23:49:01 +0200
committerGravatar Peter Korsgaard <peter@korsgaard.com>2020-10-10 22:58:52 +0200
commitfd19ee84cab19d9387f39bf887db68e63186abfd (patch)
treebdabb918d5419e0ab8ac963585f9190c33f7f0f7
parent91db7981bf0594d650374dc987617a5f1a22f122 (diff)
downloadbuildroot-fd19ee84cab19d9387f39bf887db68e63186abfd.tar.gz
buildroot-fd19ee84cab19d9387f39bf887db68e63186abfd.tar.bz2
package/python-socketio: drop asgi/asyncio files for python 2.x to fix pycompile issue
socketio has conditional logic to load asgi/asyncio files when running under Python 3.x: if sys.version_info >= (3, 5): # pragma: no cover from .asyncio_client import AsyncClient from .asyncio_server import AsyncServer from .asyncio_manager import AsyncManager from .asyncio_namespace import AsyncNamespace, AsyncClientNamespace from .asyncio_redis_manager import AsyncRedisManager from .asyncio_aiopika_manager import AsyncAioPikaManager from .asgi import ASGIApp else: # pragma: no cover AsyncClient = None AsyncServer = None AsyncManager = None AsyncNamespace = None AsyncRedisManager = None AsyncAioPikaManager = None pycompile unfortunately errors out on these files when running under Python 2.x: ../scripts/pycompile.py .. error: File "/usr/lib/python2.7/site-packages/socketio/asyncio_server.py", line 84 async def emit(self, event, data=None, to=None, room=None, skip_sid=None, ^ SyntaxError: invalid syntax As a workaround, simply drop the unusable file from TARGET_DIR if building for python 2.x. Fixes: http://autobuild.buildroot.net/results/455f3e09a590f7a6724ab8cd1b86bdf2bba8071a/ Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commit 6beb6dd5c6d6232b2ff6f2ca983c5cb99a4ca9ab) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
-rw-r--r--package/python-socketio/python-socketio.mk10
1 files changed, 10 insertions, 0 deletions
diff --git a/package/python-socketio/python-socketio.mk b/package/python-socketio/python-socketio.mk
index ece4f65b78..73dab26f3c 100644
--- a/package/python-socketio/python-socketio.mk
+++ b/package/python-socketio/python-socketio.mk
@@ -10,4 +10,14 @@ PYTHON_SOCKETIO_SETUP_TYPE = setuptools
PYTHON_SOCKETIO_LICENSE = MIT
PYTHON_SOCKETIO_LICENSE_FILES = LICENSE
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+# only needed/valid for python 3.x
+define PYTHON_SOCKETIO_RM_PY3_FILES
+ rm -f $(TARGET_DIR)/usr/lib/python*/site-packages/socketio/asgi.py \
+ $(TARGET_DIR)/usr/lib/python*/site-packages/socketio/asyncio_*.py
+endef
+
+PYTHON_SOCKETIO_POST_INSTALL_TARGET_HOOKS += PYTHON_SOCKETIO_RM_PY3_FILES
+endif
+
$(eval $(python-package))