diff mbox series

[PATCH-2020.02.x] package/python-autobahn: drop asyncio files for python 2.x to fix pycompile issu

Message ID 20201011082943.9561-1-peter@korsgaard.com
State Accepted
Headers show
Series [PATCH-2020.02.x] package/python-autobahn: drop asyncio files for python 2.x to fix pycompile issu | expand

Commit Message

Peter Korsgaard Oct. 11, 2020, 8:29 a.m. UTC
Fixes:
http://autobuild.buildroot.net/results/234/234913f86da45df0708bbe3bf7361169e2398c9f

Autobahn contains optional logic using asyncio, which causes pycompile
issues when running in python 2.x:

pycompile.py --strip-root /srv/storage/autobuild/run/instance-1/output-1/target /srv/storage/autobuild/run/instance-1/output-1/target/usr/lib/python2.7
error:   File "/usr/lib/python2.7/site-packages/autobahn/xbr/_blockchain.py", line 97
    async def get_market_status(self, market_id):
            ^
SyntaxError: invalid syntax

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

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
Only for 2020.02.x. Newer autobahn versions are python3 only
---
 package/python-autobahn/python-autobahn.mk | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Peter Korsgaard Oct. 11, 2020, 9:11 p.m. UTC | #1
>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:

 > Fixes:
 > http://autobuild.buildroot.net/results/234/234913f86da45df0708bbe3bf7361169e2398c9f

 > Autobahn contains optional logic using asyncio, which causes pycompile
 > issues when running in python 2.x:

 > pycompile.py --strip-root /srv/storage/autobuild/run/instance-1/output-1/target /srv/storage/autobuild/run/instance-1/output-1/target/usr/lib/python2.7
 > error:   File "/usr/lib/python2.7/site-packages/autobahn/xbr/_blockchain.py", line 97
 >     async def get_market_status(self, market_id):
 >             ^
 > SyntaxError: invalid syntax

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

 > Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
 > ---
 > Only for 2020.02.x. Newer autobahn versions are python3 only

Committed to 2020.02.x, thanks.
diff mbox series

Patch

diff --git a/package/python-autobahn/python-autobahn.mk b/package/python-autobahn/python-autobahn.mk
index 6c5c608b9a..4b367177a6 100644
--- a/package/python-autobahn/python-autobahn.mk
+++ b/package/python-autobahn/python-autobahn.mk
@@ -11,4 +11,15 @@  PYTHON_AUTOBAHN_LICENSE = MIT
 PYTHON_AUTOBAHN_LICENSE_FILES = LICENSE
 PYTHON_AUTOBAHN_SETUP_TYPE = setuptools
 
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+# only needed/valid for python 3.x
+define PYTHON_AUTOBAHN_RM_PY3_FILES
+	rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/autobahn/asyncio \
+		$(TARGET_DIR)/usr/lib/python*/site-packages/autobahn/xbr \
+		$(TARGET_DIR)/usr/lib/python*/site-packages/autobahn/twisted/xbr.py
+endef
+
+PYTHON_AUTOBAHN_POST_INSTALL_TARGET_HOOKS += PYTHON_AUTOBAHN_RM_PY3_FILES
+endif
+
 $(eval $(python-package))