All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio files for python 2.x to fix pycompile issue
@ 2020-10-04 21:49 Peter Korsgaard
  2020-10-04 21:49 ` [Buildroot] [PATCH 2/2] python-engineio: drop asyncio " Peter Korsgaard
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Peter Korsgaard @ 2020-10-04 21:49 UTC (permalink / raw)
  To: buildroot

Fixes:
http://autobuild.buildroot.net/results/455f3e09a590f7a6724ab8cd1b86bdf2bba8071a/

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.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 package/python-socketio/python-socketio.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

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))
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/2] python-engineio: drop asyncio files for python 2.x to fix pycompile issue
  2020-10-04 21:49 [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio files for python 2.x to fix pycompile issue Peter Korsgaard
@ 2020-10-04 21:49 ` Peter Korsgaard
  2020-10-10 20:59   ` Peter Korsgaard
  2020-10-08 20:07 ` [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio " Thomas Petazzoni
  2020-10-10 20:59 ` Peter Korsgaard
  2 siblings, 1 reply; 5+ messages in thread
From: Peter Korsgaard @ 2020-10-04 21:49 UTC (permalink / raw)
  To: buildroot

Fixes:
http://autobuild.buildroot.net/results/72c/72cfdffeb4d0fb7c3032b52f0a26a4758eea6762/

engineio has conditional logic to load asyncio files when running under
Python 3.x:

if sys.version_info >= (3, 5):  # pragma: no cover
    from .asyncio_server import AsyncServer
    from .asyncio_client import AsyncClient
    from .async_drivers.asgi import ASGIApp
    try:
        from .async_drivers.tornado import get_tornado_handler
    except ImportError:
        get_tornado_handler = None
else:  # pragma: no cover
    AsyncServer = None
    AsyncClient = None
    get_tornado_handler = None
    ASGIApp = 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/engineio/asyncio_socket.py", line 13
    async def poll(self):
            ^
SyntaxError: invalid syntax

As a workaround, simply drop the unusable file from TARGET_DIR if building
for python 2.x.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 package/python-engineio/python-engineio.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/package/python-engineio/python-engineio.mk b/package/python-engineio/python-engineio.mk
index 36ca326877..d0e073fa95 100644
--- a/package/python-engineio/python-engineio.mk
+++ b/package/python-engineio/python-engineio.mk
@@ -10,4 +10,14 @@ PYTHON_ENGINEIO_SETUP_TYPE = setuptools
 PYTHON_ENGINEIO_LICENSE = MIT
 PYTHON_ENGINEIO_LICENSE_FILES = LICENSE
 
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+# only needed/valid for python 3.x
+define PYTHON_ENGINEIO_RM_PY3_FILES
+	rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/engineio/async_drivers \
+		$(TARGET_DIR)/usr/lib/python*/site-packages/engineio/asyncio_*.py
+endef
+
+PYTHON_ENGINEIO_POST_INSTALL_TARGET_HOOKS += PYTHON_ENGINEIO_RM_PY3_FILES
+endif
+
 $(eval $(python-package))
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio files for python 2.x to fix pycompile issue
  2020-10-04 21:49 [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio files for python 2.x to fix pycompile issue Peter Korsgaard
  2020-10-04 21:49 ` [Buildroot] [PATCH 2/2] python-engineio: drop asyncio " Peter Korsgaard
@ 2020-10-08 20:07 ` Thomas Petazzoni
  2020-10-10 20:59 ` Peter Korsgaard
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2020-10-08 20:07 UTC (permalink / raw)
  To: buildroot

On Sun,  4 Oct 2020 23:49:01 +0200
Peter Korsgaard <peter@korsgaard.com> wrote:

> Fixes:
> http://autobuild.buildroot.net/results/455f3e09a590f7a6724ab8cd1b86bdf2bba8071a/
> 
> 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.
> 
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> ---
>  package/python-socketio/python-socketio.mk | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Thanks, both applied.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio files for python 2.x to fix pycompile issue
  2020-10-04 21:49 [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio files for python 2.x to fix pycompile issue Peter Korsgaard
  2020-10-04 21:49 ` [Buildroot] [PATCH 2/2] python-engineio: drop asyncio " Peter Korsgaard
  2020-10-08 20:07 ` [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio " Thomas Petazzoni
@ 2020-10-10 20:59 ` Peter Korsgaard
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2020-10-10 20:59 UTC (permalink / raw)
  To: buildroot

>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:

 > Fixes:
 > http://autobuild.buildroot.net/results/455f3e09a590f7a6724ab8cd1b86bdf2bba8071a/

 > 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.

 > Signed-off-by: Peter Korsgaard <peter@korsgaard.com>

Committed to 2020.02.x, 2020.05.x and 2020.08.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/2] python-engineio: drop asyncio files for python 2.x to fix pycompile issue
  2020-10-04 21:49 ` [Buildroot] [PATCH 2/2] python-engineio: drop asyncio " Peter Korsgaard
@ 2020-10-10 20:59   ` Peter Korsgaard
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2020-10-10 20:59 UTC (permalink / raw)
  To: buildroot

>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:

 > Fixes:
 > http://autobuild.buildroot.net/results/72c/72cfdffeb4d0fb7c3032b52f0a26a4758eea6762/

 > engineio has conditional logic to load asyncio files when running under
 > Python 3.x:

 > if sys.version_info >= (3, 5):  # pragma: no cover
 >     from .asyncio_server import AsyncServer
 >     from .asyncio_client import AsyncClient
 >     from .async_drivers.asgi import ASGIApp
 >     try:
 >         from .async_drivers.tornado import get_tornado_handler
 >     except ImportError:
 >         get_tornado_handler = None
 > else:  # pragma: no cover
 >     AsyncServer = None
 >     AsyncClient = None
 >     get_tornado_handler = None
 >     ASGIApp = 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/engineio/asyncio_socket.py", line 13
 >     async def poll(self):
 >             ^
 > SyntaxError: invalid syntax

 > As a workaround, simply drop the unusable file from TARGET_DIR if building
 > for python 2.x.

 > Signed-off-by: Peter Korsgaard <peter@korsgaard.com>

Committed to 2020.02.x, 2020.05.x and 2020.08.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-10 20:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 21:49 [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio files for python 2.x to fix pycompile issue Peter Korsgaard
2020-10-04 21:49 ` [Buildroot] [PATCH 2/2] python-engineio: drop asyncio " Peter Korsgaard
2020-10-10 20:59   ` Peter Korsgaard
2020-10-08 20:07 ` [Buildroot] [PATCH 1/2] python-socketio: drop asgi/asyncio " Thomas Petazzoni
2020-10-10 20:59 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.