buildroot/package/python-txtorcon/python-txtorcon.mk
Peter Korsgaard 6728c67307 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.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-09-30 21:10:06 +02:00

24 lines
819 B
Makefile

################################################################################
#
# python-txtorcon
#
################################################################################
PYTHON_TXTORCON_VERSION = 19.1.0
PYTHON_TXTORCON_SOURCE = txtorcon-$(PYTHON_TXTORCON_VERSION).tar.gz
PYTHON_TXTORCON_SITE = https://files.pythonhosted.org/packages/8c/26/d5b2fba4ffbcb23957ff2cee4d7d0a2d667372b9eb04807058bd561c8e8f
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))