aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Peter Korsgaard <peter@korsgaard.com>2020-10-02 15:40:47 +0200
committerGravatar Peter Korsgaard <peter@korsgaard.com>2020-10-05 08:03:33 +0200
commit6356b2277059218c713a37220690d3bd068ece2f (patch)
tree85ad819e38839dd506ec0647a692e737839da0fd
parent300e1976d89843a1fceb37362344eb3a01b11e24 (diff)
downloadbuildroot-6356b2277059218c713a37220690d3bd068ece2f.tar.gz
buildroot-6356b2277059218c713a37220690d3bd068ece2f.tar.bz2
package/python-aenum: drop test_v3.py file for python 2.x to fix pycompile issue
Fixes: http://autobuild.buildroot.net/results/4ca459d54545c0e20b0f0cdc63bd81844ecd7f36/ aenum has conditional logic to load python 3.x code located in test_v3.py: if pyver >= 3.0: from aenum.test_v3 import TestEnumV3, TestOrderV3, TestNamedTupleV3 And contains logic in setup.py to drop that file during setup.py install if building for python 2.x: py3_only = ('aenum/test_v3.py', ) .. if __name__ == '__main__': if 'install' in sys.argv: import os, sys .. if sys.version_info[0] != 3: for file in py3_only: try: os.unlink(file) But this doesn't work in Buildroot as pkg-python.dk first does setup.py build (which copies test_v3.py to the build directory) before setup.py install, so test_v3.py gets installed, leading to errors from pycompile: error: File "/usr/lib/python2.7/site-packages/aenum/test_v3.py", line 12 class MagicAutoNumberEnum(Enum, settings=AutoNumber): ^ SyntaxError: invalid syntax As a workaround, add a hook to drop it from the target directory when building for python 2.x. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> (cherry picked from commit 753c031977cfda84237366a98098bde828692f33) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
-rw-r--r--package/python-aenum/python-aenum.mk9
1 files changed, 9 insertions, 0 deletions
diff --git a/package/python-aenum/python-aenum.mk b/package/python-aenum/python-aenum.mk
index 1d5322ef41..97fcbb5e86 100644
--- a/package/python-aenum/python-aenum.mk
+++ b/package/python-aenum/python-aenum.mk
@@ -11,4 +11,13 @@ PYTHON_AENUM_SETUP_TYPE = setuptools
PYTHON_AENUM_LICENSE = BSD-3-Clause
PYTHON_AENUM_LICENSE_FILES = aenum/LICENSE
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+# only needed/valid for python 3.x
+define PYTHON_AENUM_RM_PY3_FILE
+ rm -f $(TARGET_DIR)/usr/lib/python*/site-packages/aenum/test_v3.py
+endef
+
+PYTHON_AENUM_POST_INSTALL_TARGET_HOOKS += PYTHON_AENUM_RM_PY3_FILE
+endif
+
$(eval $(python-package))