Skip to contentSkip to conversation

package/python-pymodbus: 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-pymodbus: drop asyncio files for python 2.x to fix pycompile issue

Pymodbus has optional support for 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/pymodbus/client/asynchronous/asyncio/__init__.py", line 257
yield from self._connect()
^
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/cc4/cc48927cbe9ae6c2d8b12d65467ec40df82febf6/

---
 package/python-pymodbus/python-pymodbus.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/python-pymodbus/python-pymodbus.mk +9 -0
index d96e21a55c..9135a4d0c4 100644
@@ -11,4 +11,13 @@ PYTHON_PYMODBUS_SETUP_TYPE = setuptools
 PYTHON_PYMODBUS_LICENSE = BSD-3-Clause
 PYTHON_PYMODBUS_LICENSE_FILES = doc/LICENSE
 
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+# only needed/valid for python 3.x
+define PYTHON_PYMODBUS_RM_PY3_FILES
+	rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/pymodbus/client/asynchronous/asyncio
+endef
+
+PYTHON_PYMODBUS_POST_INSTALL_TARGET_HOOKS += PYTHON_PYMODBUS_RM_PY3_FILES
+endif
+
 $(eval $(python-package))
Signature · 1 line
2.20.1
#1 lore raw

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

Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Pymodbus has optional support for 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/pymodbus/client/asynchronous/asyncio/__init__.py", line 257
yield from self._connect()
^
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/cc4/cc48927cbe9ae6c2d8b12d65467ec40df82febf6/

Committed, thanks.

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

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

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

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

Pymodbus has optional support for 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/pymodbus/client/asynchronous/asyncio/__init__.py", line 257
yield from self._connect()
^
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/cc4/cc48927cbe9ae6c2d8b12d65467ec40df82febf6/

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

Signature · 1 line
Bye, Peter Korsgaard