From patchwork Fri Oct 2 13:40:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Korsgaard X-Patchwork-Id: 1375766 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=korsgaard.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=vCRDwPbH; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C2rjq41Xkz9sSC for ; Fri, 2 Oct 2020 23:41:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id ED5BC86538; Fri, 2 Oct 2020 13:40:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VbbL3g4c-Xso; Fri, 2 Oct 2020 13:40:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5EC8C86559; Fri, 2 Oct 2020 13:40:59 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id E4E501BF9B9 for ; Fri, 2 Oct 2020 13:40:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id DBAE786559 for ; Fri, 2 Oct 2020 13:40:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WITvb9OK0HKY for ; Fri, 2 Oct 2020 13:40:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 3BFF686538 for ; Fri, 2 Oct 2020 13:40:54 +0000 (UTC) Received: by mail-ej1-f68.google.com with SMTP id i26so2016715ejb.12 for ; Fri, 02 Oct 2020 06:40:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lGLgRfz3Qosb8rgxRZe4699Rb3KqBeP5cW9/5hbRI3A=; b=vCRDwPbH7g1falfIsGJQDQUJcXeg2vBuH6NBM79+88OnN/y8lbPj64cJb6CqwXUx4Q 3uZuzRUjg/8nwYtYS5vVOX9s/qkQ6LuJ8mu0IcPQOF/wcFTq2QQ9kth7HEc7ABy5h1sG ZJfERnZ5pjUp4e/BxvlcJpJEGn67axxCkHIC3ShsmHuHvoILBGZhMG5I5JWly1WqWOZU f55UKX6bGxtWw+HW6ZQpgHohXrk4Ol9x74GCPSJEV1SQBhbDNRS9wom3SDMiIpTB0+UB 0V0CdtVJ5zeXHBCi++7VqnBgWRzJ1cB/iP0nidlsFuWLjsyX+qIoAnbMh4fWD/WQaDYT vVTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=lGLgRfz3Qosb8rgxRZe4699Rb3KqBeP5cW9/5hbRI3A=; b=gMv74cEgZEPzWCZVaCOfMCwdDxd9kZWMQj5p2AXAmla1kkzOr0HAoS6kTMVhe+m+d8 DrL3qkTcYJDuRtx1n99Rl5IgIUOqgKFLMjLlxgrfUudlv6SSA1coynGU6s6gIB4OMOTv /ZK4JPnm5ghUSMCPIGxZmW+xXJcgMVE9aPJRT+PSiHoBT2BPs/xj59JDiSd0YhNb+7GZ EIr6PR5vdVOhXz46RPhWvVDvPCLvc+oYiBJEw4aN+3DLP3aV3toYRerBEN5D3fJh5j4/ zkAhf9Y+t/HLOYAHnKEzcT9T3bVZnV11e+KXDHbBATkXpDEE1gVo0ntmp8ucHG0GjAPN WveQ== X-Gm-Message-State: AOAM533848Qulk4LTX0xyhrn0EuvTUlOIr9YGfvFVoEdmzfEOzLJn70n kBXiKoakcgtTg+NbsiT9Ye1zTgMwMIQ= X-Google-Smtp-Source: ABdhPJzDtDJ307M2ykuthcumoLVo4EgzRHeHrFINR7Hd7C6m3rsGxQ82rtAxjKIVVoKsO7ea1Urr2w== X-Received: by 2002:a17:906:14d8:: with SMTP id y24mr2223890ejc.123.1601646051870; Fri, 02 Oct 2020 06:40:51 -0700 (PDT) Received: from dell.be.48ers.dk (d51A5BC31.access.telenet.be. [81.165.188.49]) by smtp.gmail.com with ESMTPSA id a20sm1183793edr.9.2020.10.02.06.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2020 06:40:50 -0700 (PDT) Received: from peko by dell.be.48ers.dk with local (Exim 4.92) (envelope-from ) id 1kOLIo-0006NW-6E; Fri, 02 Oct 2020 15:40:50 +0200 From: Peter Korsgaard To: buildroot@buildroot.org Date: Fri, 2 Oct 2020 15:40:47 +0200 Message-Id: <20201002134048.24473-1-peter@korsgaard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/2] package/python-aenum: drop test_v3.py file for python 2.x to fix pycompile issue X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Korsgaard , Asaf Kahlon Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 --- package/python-aenum/python-aenum.mk | 9 +++++++++ 1 file changed, 9 insertions(+) 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))