Skip to contentSkip to conversation

package/python-sentry-sdk: drop asyncio files for python 2.x to fix pycompile issue

PATCH New Peter Korsgaard 1 participant 3 messages Oct 11, 2020 – Oct 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/python-sentry-sdk: drop asyncio files for python 2.x to fix pycompile issue

sentry-sdk has a set of optional "integrations", some of which use asyncio.

pycompile unfortunately errors out on these files when running under Python 2.x:

../scripts/pycompile.py ..
error: File "/usr/lib/python2.7/site-packages/sentry_sdk/integrations/sanic.py", line 64
async def sentry_handle_request(self, request, *args, **kwargs):
^
SyntaxError: invalid syntax

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

Fixes:
http://autobuild.buildroot.net/results/9e4/9e47ee2a56153379e4e7bc839be5972a2302ba9f/

---
 package/python-sentry-sdk/python-sentry-sdk.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)
package/python-sentry-sdk/python-sentry-sdk.mk +10 -0
index 696c487005..256aafa62d 100644
@@ -11,4 +11,14 @@ PYTHON_SENTRY_SDK_SETUP_TYPE = setuptools
 PYTHON_SENTRY_SDK_LICENSE = BSD-2-Clause
 PYTHON_SENTRY_SDK_LICENSE_FILES = LICENSE
 
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+# only needed/valid for python 3.x
+define PYTHON_SENTRY_SDK_RM_PY3_FILES
+	rm -f $(addprefix $(TARGET_DIR)/usr/lib/python*/site-packages/sentry_sdk/integrations/,\
+		aiohttp.py asgi.py django/asgi.py sanic.py tornado.py)
+endef
+
+PYTHON_SENTRY_SDK_POST_INSTALL_TARGET_HOOKS += PYTHON_SENTRY_SDK_RM_PY3_FILES
+endif
+
 $(eval $(python-package))
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/python-sentry-sdk: drop asyncio files for python 2.x to fix pycompile issue

Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

sentry-sdk has a set of optional "integrations", some of which use asyncio. pycompile unfortunately errors out on these files when running under Python 2.x:

../scripts/pycompile.py ..
error: File "/usr/lib/python2.7/site-packages/sentry_sdk/integrations/sanic.py", line 64
async def sentry_handle_request(self, request, *args, **kwargs):
^
SyntaxError: invalid syntax

Quoted 7 lines

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

Fixes:
http://autobuild.buildroot.net/results/9e4/9e47ee2a56153379e4e7bc839be5972a2302ba9f/

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 package/python-sentry-sdk: drop asyncio files for python 2.x to fix pycompile issue

In reply to Peter Korsgaard
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

sentry-sdk has a set of optional "integrations", some of which use asyncio. pycompile unfortunately errors out on these files when running under Python 2.x:

../scripts/pycompile.py ..
error: File "/usr/lib/python2.7/site-packages/sentry_sdk/integrations/sanic.py", line 64
async def sentry_handle_request(self, request, *args, **kwargs):
^
SyntaxError: invalid syntax

Quoted 7 lines

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

Fixes:
http://autobuild.buildroot.net/results/9e4/9e47ee2a56153379e4e7bc839be5972a2302ba9f/

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

Signature · 1 line
Bye, Peter Korsgaard