Skip to contentSkip to conversation

package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue

PATCH Superseded Peter Korsgaard 2 participants 4 messages Sep 30, 2020 – Oct 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue

Fixes:
http://autobuild.buildroot.net/results/76b580000e6311e88584874f942517badd6fadf6/

python-txtorcon DOES support python 2.x, but it contains some optional python 3 / async code in controller_py3.py which is conditionally used from controller.py:

try:
from .controller_py3 import _AsyncOnionAuthContext HAVE_ASYNC = True
except Exception:
HAVE_ASYNC = False

pycompile unfortunately errors out on the async code:

../scripts/pycompile.py ..
error: File "/usr/lib/python2.7/site-packages/txtorcon/controller_py3.py", line 13

    async def __aenter__(self):
            ^

SyntaxError: invalid syntax

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

---
 package/python-txtorcon/python-txtorcon.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/python-txtorcon/python-txtorcon.mk +9 -0
index a01c0b2511..4df400c3e7 100644
@@ -11,4 +11,13 @@ PYTHON_TXTORCON_SETUP_TYPE = setuptools
 PYTHON_TXTORCON_LICENSE = MIT
 PYTHON_TXTORCON_LICENSE_FILES = LICENSE
 
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+# only needed/valid for python 3.x
+define PYTHON_TXTORCON_RM_PY3_FILE
+	rm -f $(TARGET_DIR)/usr/lib/python*/site-packages/txtorcon/controller_py3.py
+endef
+
+PYTHON_TXTORCON_POST_INSTALL_TARGET_HOOKS += PYTHON_TXTORCON_RM_PY3_FILE
+endif
+
 $(eval $(python-package))
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/1 package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue

Peter, All,

On 2020-09-30 09:31 +0200, Peter Korsgaard spake thusly:

Quoted 17 lines

Fixes:
http://autobuild.buildroot.net/results/76b580000e6311e88584874f942517badd6fadf6/

python-txtorcon DOES support python 2.x, but it contains some optional python 3 / async code in controller_py3.py which is conditionally used from controller.py:

try:
from .controller_py3 import _AsyncOnionAuthContext HAVE_ASYNC = True
except Exception:
HAVE_ASYNC = False

pycompile unfortunately errors out on the async code:

../scripts/pycompile.py ..
error: File "/usr/lib/python2.7/site-packages/txtorcon/controller_py3.py", line 13

Quoted 8 lines
    async def __aenter__(self):
            ^

SyntaxError: invalid syntax

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

Applied to master, thanks.

BTW, next time, can you update patchwork to mark the previous one as superseded (or changes-requested), please? ;-]

Regards,
Yann E. MORIN.

Quoted 29 lines
---
 package/python-txtorcon/python-txtorcon.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/python-txtorcon/python-txtorcon.mk +9 -0
index a01c0b2511..4df400c3e7 100644
@@ -11,4 +11,13 @@ PYTHON_TXTORCON_SETUP_TYPE = setuptools
 PYTHON_TXTORCON_LICENSE = MIT
 PYTHON_TXTORCON_LICENSE_FILES = LICENSE
 
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+# only needed/valid for python 3.x
+define PYTHON_TXTORCON_RM_PY3_FILE
+	rm -f $(TARGET_DIR)/usr/lib/python*/site-packages/txtorcon/controller_py3.py
+endef
+
+PYTHON_TXTORCON_POST_INSTALL_TARGET_HOOKS += PYTHON_TXTORCON_RM_PY3_FILE
+endif
+
 $(eval $(python-package))
Signature · 6 lines
2.20.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v2 1/1 package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Hi,

Quoted 6 lines
Quoted 6 lines

../scripts/pycompile.py ..
error: File "/usr/lib/python2.7/site-packages/txtorcon/controller_py3.py", line 13
async def __aenter__(self):
^
SyntaxError: invalid syntax

Quoted 6 lines
Quoted 4 lines

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

Applied to master, thanks.

Thanks.

Quoted 2 lines

BTW, next time, can you update patchwork to mark the previous one as superseded (or changes-requested), please? ;-]

Sure, just got sidetracked by real life stuff (tm) after sending v2.

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

PATCH v2 1/1 package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue

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

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

Fixes:
http://autobuild.buildroot.net/results/76b580000e6311e88584874f942517badd6fadf6/

python-txtorcon DOES support python 2.x, but it contains some optional python 3 / async code in controller_py3.py which is conditionally used from controller.py:

try:
from .controller_py3 import _AsyncOnionAuthContext HAVE_ASYNC = True
except Exception:
HAVE_ASYNC = False

pycompile unfortunately errors out on the async code:

../scripts/pycompile.py ..
error: File "/usr/lib/python2.7/site-packages/txtorcon/controller_py3.py", line 13

Quoted 8 lines
    async def __aenter__(self):
            ^

SyntaxError: invalid syntax

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

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

Signature · 1 line
Bye, Peter Korsgaard