All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] package/python-fire.mk: drop test_components_py3.py file for python 2.x to fix pyfile issue
Date: Fri,  2 Oct 2020 15:40:48 +0200	[thread overview]
Message-ID: <20201002134048.24473-2-peter@korsgaard.com> (raw)
In-Reply-To: <20201002134048.24473-1-peter@korsgaard.com>

Fixes:
http://autobuild.buildroot.net/results/72e0cc78194a1b93bf26a50742e59a1e93bde1d1/

fire has conditional logic to load test_components_py3.py when running under
Python 3.x:

if six.PY3:
  from fire import test_components_py3 as py3

pycompile unfortunately errors out on it:

../scripts/pycompile.py ..

error:   File "/usr/lib/python2.7/site-packages/fire/test_components_py3.py", line 18
    def identity(arg1, arg2: int, arg3=10, arg4: int = 20, *arg5,
                           ^
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-fire/python-fire.mk | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/package/python-fire/python-fire.mk b/package/python-fire/python-fire.mk
index 343abbca7d..f6a2e073f0 100644
--- a/package/python-fire/python-fire.mk
+++ b/package/python-fire/python-fire.mk
@@ -11,4 +11,13 @@ PYTHON_FIRE_SETUP_TYPE = setuptools
 PYTHON_FIRE_LICENSE = Apache-2.0
 PYTHON_FIRE_LICENSE_FILES = LICENSE
 
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+# only needed/valid for python 3.x
+define PYTHON_FIRE_RM_PY3_FILE
+	rm -f $(TARGET_DIR)/usr/lib/python*/site-packages/fire/test_components_py3.py
+endef
+
+PYTHON_FIRE_POST_INSTALL_TARGET_HOOKS += PYTHON_FIRE_RM_PY3_FILE
+endif
+
 $(eval $(python-package))
-- 
2.20.1

  reply	other threads:[~2020-10-02 13:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02 13:40 [Buildroot] [PATCH 1/2] package/python-aenum: drop test_v3.py file for python 2.x to fix pycompile issue Peter Korsgaard
2020-10-02 13:40 ` Peter Korsgaard [this message]
2020-10-03  6:58   ` [Buildroot] [PATCH 2/2] package/python-fire.mk: drop test_components_py3.py file for python 2.x to fix pyfile issue Peter Korsgaard
2020-10-05  6:04   ` Peter Korsgaard
2020-10-03  6:57 ` [Buildroot] [PATCH 1/2] package/python-aenum: drop test_v3.py file for python 2.x to fix pycompile issue Peter Korsgaard
2020-10-05  6:04 ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201002134048.24473-2-peter@korsgaard.com \
    --to=peter@korsgaard.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.