* [Buildroot] [PATCH] package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue
@ 2020-09-30 6:51 Peter Korsgaard
2020-09-30 6:57 ` Baruch Siach
0 siblings, 1 reply; 3+ messages in thread
From: Peter Korsgaard @ 2020-09-30 6:51 UTC (permalink / raw)
To: buildroot
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.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
package/python-txtorcon/python-txtorcon.mk | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/package/python-txtorcon/python-txtorcon.mk b/package/python-txtorcon/python-txtorcon.mk
index a01c0b2511..e25ce8ba38 100644
--- a/package/python-txtorcon/python-txtorcon.mk
+++ b/package/python-txtorcon/python-txtorcon.mk
@@ -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))
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue
2020-09-30 6:51 [Buildroot] [PATCH] package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue Peter Korsgaard
@ 2020-09-30 6:57 ` Baruch Siach
2020-09-30 7:32 ` Peter Korsgaard
0 siblings, 1 reply; 3+ messages in thread
From: Baruch Siach @ 2020-09-30 6:57 UTC (permalink / raw)
To: buildroot
Hi Peter,
On Wed, Sep 30 2020, Peter Korsgaard wrote:
> 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.
>
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> ---
> package/python-txtorcon/python-txtorcon.mk | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/package/python-txtorcon/python-txtorcon.mk b/package/python-txtorcon/python-txtorcon.mk
> index a01c0b2511..e25ce8ba38 100644
> --- a/package/python-txtorcon/python-txtorcon.mk
> +++ b/package/python-txtorcon/python-txtorcon.mk
> @@ -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
Redundant '/' before 'usr/'.
baruch
> +endef
> +
> +PYTHON_TXTORCON_POST_INSTALL_TARGET_HOOKS += PYTHON_TXTORCON_RM_PY3_FILE
> +endif
> +
> $(eval $(python-package))
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue
2020-09-30 6:57 ` Baruch Siach
@ 2020-09-30 7:32 ` Peter Korsgaard
0 siblings, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2020-09-30 7:32 UTC (permalink / raw)
To: buildroot
>>>>> "Baruch" == Baruch Siach <baruch@tkos.co.il> writes:
> Hi Peter,
> On Wed, Sep 30 2020, Peter Korsgaard wrote:
>> 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.
>>
>> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
>> ---
>> package/python-txtorcon/python-txtorcon.mk | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/package/python-txtorcon/python-txtorcon.mk b/package/python-txtorcon/python-txtorcon.mk
>> index a01c0b2511..e25ce8ba38 100644
>> --- a/package/python-txtorcon/python-txtorcon.mk
>> +++ b/package/python-txtorcon/python-txtorcon.mk
>> @@ -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
> Redundant '/' before 'usr/'.
Ups, indeed - Will fix.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-30 7:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-30 6:51 [Buildroot] [PATCH] package/python-txtorcon.mk: drop _py3 file for python 2.x to fix pycompile issue Peter Korsgaard
2020-09-30 6:57 ` Baruch Siach
2020-09-30 7:32 ` 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.