From patchwork Fri Dec 28 17:01:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1019213 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43RCfc658Kz9s55 for ; Sat, 29 Dec 2018 04:01:44 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A78DA22005; Fri, 28 Dec 2018 17:01:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b8wtP0lVAjx4; Fri, 28 Dec 2018 17:01:41 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 1611222699; Fri, 28 Dec 2018 17:01:41 +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 349C21C31CA for ; Fri, 28 Dec 2018 17:01:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 31FB484CAD for ; Fri, 28 Dec 2018 17:01:39 +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 1CokzUdYMvyq for ; Fri, 28 Dec 2018 17:01:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7611C85531 for ; Fri, 28 Dec 2018 17:01:37 +0000 (UTC) Received: by mail.bootlin.com (Postfix, from userid 110) id 9D2E820A02; Fri, 28 Dec 2018 18:01:35 +0100 (CET) Received: from localhost (mat33-2-88-189-187-82.fbx.proxad.net [88.189.187.82]) by mail.bootlin.com (Postfix) with ESMTPSA id 45DF42073D; Fri, 28 Dec 2018 18:01:35 +0100 (CET) From: Thomas Petazzoni To: buildroot@buildroot.org Date: Fri, 28 Dec 2018 18:01:29 +0100 Message-Id: <20181228170132.13049-2-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181228170132.13049-1-thomas.petazzoni@bootlin.com> References: <20181228170132.13049-1-thomas.petazzoni@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/3] package/python3-setuptools: new package 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: Rhys Williams , Thomas Petazzoni , Asaf Kahlon Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This new package allows to install the host version of setuptools for python3, regardless of what the default Python version is. It will be used by the python-package infrastructure to make sure that host Python packages that need python3 and setuptools have setuptools installed for Python 3. Signed-off-by: Thomas Petazzoni Reviewed-by: Yegor Yefremov --- .../0001-add-executable.patch | 72 +++++++++++++++++++ .../python3-setuptools.hash | 1 + .../python3-setuptools/python3-setuptools.mk | 24 +++++++ 3 files changed, 97 insertions(+) create mode 100644 package/python3-setuptools/0001-add-executable.patch create mode 120000 package/python3-setuptools/python3-setuptools.hash create mode 100644 package/python3-setuptools/python3-setuptools.mk diff --git a/package/python3-setuptools/0001-add-executable.patch b/package/python3-setuptools/0001-add-executable.patch new file mode 100644 index 0000000000..1f8714eaeb --- /dev/null +++ b/package/python3-setuptools/0001-add-executable.patch @@ -0,0 +1,72 @@ +From 9b3d307f8f6a1af88f3f810f5a6cf0835830e1e8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Mon, 7 Dec 2015 01:14:33 +0100 +Subject: [PATCH 1/1] add executable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add a new --executable option to distribute so that we can +force the shebang line in installed python scripts. + +[Thomas: refresh for setuptools 5.8.] +[Jörg: refresh for setuptools 18.7.1] + +Signed-off-by: Gustavo Zacarias +Signed-off-by: Thomas Petazzoni +Signed-off-by: Jörg Krause +--- + setuptools/command/install.py | 2 ++ + setuptools/command/install_scripts.py | 9 +++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/setuptools/command/install.py b/setuptools/command/install.py +index d2bca2e..b60ef19 100644 +--- a/setuptools/command/install.py ++++ b/setuptools/command/install.py +@@ -16,6 +16,7 @@ class install(orig.install): + """Use easy_install to install the package, w/dependencies""" + + user_options = orig.install.user_options + [ ++ ('executable=', 'e', "specify final destination interpreter path"), + ('old-and-unmanageable', None, "Try not to use this!"), + ('single-version-externally-managed', None, + "used by system package builders to create 'flat' eggs"), +@@ -31,6 +32,7 @@ class install(orig.install): + + def initialize_options(self): + orig.install.initialize_options(self) ++ self.executable = None + self.old_and_unmanageable = None + self.single_version_externally_managed = None + +diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py +index be66cb2..07afaf8 100755 +--- a/setuptools/command/install_scripts.py ++++ b/setuptools/command/install_scripts.py +@@ -11,6 +11,13 @@ class install_scripts(orig.install_scripts): + def initialize_options(self): + orig.install_scripts.initialize_options(self) + self.no_ep = False ++ self.executable = None ++ ++ def finalize_options(self): ++ orig.install_scripts.finalize_options(self) ++ self.set_undefined_options('install', ++ ('executable','executable') ++ ) + + def run(self): + import setuptools.command.easy_install as ei +@@ -31,6 +38,8 @@ class install_scripts(orig.install_scripts): + ) + bs_cmd = self.get_finalized_command('build_scripts') + exec_param = getattr(bs_cmd, 'executable', None) ++ if self.executable is not None: ++ exec_param = self.executable + bw_cmd = self.get_finalized_command("bdist_wininst") + is_wininst = getattr(bw_cmd, '_is_running', False) + writer = ei.ScriptWriter +-- +2.6.3 + diff --git a/package/python3-setuptools/python3-setuptools.hash b/package/python3-setuptools/python3-setuptools.hash new file mode 120000 index 0000000000..a3af7f0fb1 --- /dev/null +++ b/package/python3-setuptools/python3-setuptools.hash @@ -0,0 +1 @@ +../python-setuptools/python-setuptools.hash \ No newline at end of file diff --git a/package/python3-setuptools/python3-setuptools.mk b/package/python3-setuptools/python3-setuptools.mk new file mode 100644 index 0000000000..b6de5d4b25 --- /dev/null +++ b/package/python3-setuptools/python3-setuptools.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# python3-setuptools +# +################################################################################ + +# Please keep in sync with +# package/python-setuptools/python-setuptools.mk +PYTHON3_SETUPTOOLS_VERSION = 40.6.3 +PYTHON3_SETUPTOOLS_SOURCE = setuptools-$(PYTHON3_SETUPTOOLS_VERSION).zip +PYTHON3_SETUPTOOLS_SITE = https://files.pythonhosted.org/packages/37/1b/b25507861991beeade31473868463dad0e58b1978c209de27384ae541b0b +PYTHON3_SETUPTOOLS_LICENSE = MIT +PYTHON3_SETUPTOOLS_LICENSE_FILES = LICENSE +PYTHON3_SETUPTOOLS_SETUP_TYPE = setuptools +HOST_PYTHON3_SETUPTOOLS_DL_SUBDIR = python-setuptools +HOST_PYTHON3_SETUPTOOLS_NEEDS_HOST_PYTHON = python3 + +define HOST_PYTHON3_SETUPTOOLS_EXTRACT_CMDS + $(UNZIP) -d $(@D) $(HOST_PYTHON3_SETUPTOOLS_DL_DIR)/$(PYTHON3_SETUPTOOLS_SOURCE) + mv $(@D)/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)/* $(@D) + $(RM) -r $(@D)/setuptools-$(PYTHON3_SETUPTOOLS_VERSION) +endef + +$(eval $(host-python-package)) From patchwork Fri Dec 28 17:01:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1019215 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43RCfl0PSvz9s55 for ; Sat, 29 Dec 2018 04:01:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 553D52283C; Fri, 28 Dec 2018 17:01:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kKj0MCSjN1ey; Fri, 28 Dec 2018 17:01:43 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id BC0D32278C; Fri, 28 Dec 2018 17:01:41 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 9D6591C31CA for ; Fri, 28 Dec 2018 17:01:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 993F182BB2 for ; Fri, 28 Dec 2018 17:01:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tnYBVw66ykm7 for ; Fri, 28 Dec 2018 17:01:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by whitealder.osuosl.org (Postfix) with ESMTP id BFC1982953 for ; Fri, 28 Dec 2018 17:01:37 +0000 (UTC) Received: by mail.bootlin.com (Postfix, from userid 110) id 9F38A20A2E; Fri, 28 Dec 2018 18:01:36 +0100 (CET) Received: from localhost (mat33-2-88-189-187-82.fbx.proxad.net [88.189.187.82]) by mail.bootlin.com (Postfix) with ESMTPSA id 4852A2073D; Fri, 28 Dec 2018 18:01:36 +0100 (CET) From: Thomas Petazzoni To: buildroot@buildroot.org Date: Fri, 28 Dec 2018 18:01:30 +0100 Message-Id: <20181228170132.13049-3-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181228170132.13049-1-thomas.petazzoni@bootlin.com> References: <20181228170132.13049-1-thomas.petazzoni@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/3] package/pkg-python: use host-python3-setuptools when needed 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: Rhys Williams , Thomas Petazzoni , Asaf Kahlon Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" When a package uses "setuptools" as its _SETUP_TYPE, we currently add a dependency on host-python-setuptools. This means that: (1) When BR2_PACKAGE_PYTHON=y, the default host Python version is Python 2.x, and host-python-setuptools is installed for host-python. (2) When BR2_PACKAGE_PYTHON3=y, the default host Python version is Python 3.x, and host-python-setuptools is installed for host-python3. (3) When no target Python interpreter is selected, the default host Python version is Python 2.x, and host-python-setuptools is installed for host-python. Situations (1) and (3) are problematic for host Python packages that need Python 3.x. Such packages use _NEEDS_HOST_PYTHON = python3, but if they use setuptools as their setup type, they will not find setuptools installed for host-python3 in situations (1) and (3) described above. We currently have a single package that sets _NEEDS_HOST_PYTHON = python3: host-meson. host-meson generally works because if setuptools is not found, it falls back to distutils, which is part of the standard Python library. However, if there is a setuptools version installed system-wide, it may be picked up, but may not necessarily be the same version as Buildroot setuptools, potentially causing problems. This commit makes the necessary change to the python-package infrastructure to fix this behavior, by identifying the following cases: - When a host Python package says _NEEDS_HOST_PYTHON = python3, then we know it wants setuptools installed for host-python3, so we use host-python3-setuptools. - When a host Python package says _NEEDS_HOST_PYTHON = python2, then we known it wants setuptools installed for host-python, so we use host-python-setuptools. - When BR2_PACKAGE_PYTHON3=y, and we have a target package, or a host package with no NEEDS_HOST_PYTHON option, then we want setuptools installed for host-python3, so we use host-python3-setuptools. - When BR2_PACKAGE_PYTHON=y or no target interpreter is enabled at all, and we have a target package, or a host package with no NEEDS_HOST_PYTHON option, then we want setuptools for host-python, so we use host-python-setuptools. To make this happen, we use host-python3-setuptools introduced in a previous commit, but we also change host-python-setuptools to force its installation for host-python. The latter is needed if you build with BR2_PACKAGE_PYTHON3=y but want to install a Python-based package that has NEEDS_HOST_PYTHON=python2. There is one single package that needs be adjusted following this: lirc-tools, because it is not using the python-package infrastructure. It directly depends on host-python-setuptools, which no longer works because host-python-setuptools now only installs for Python 2.x, while lirc-tools Python binding only supports Python 3.x. Switching to host-python3-setuptools solves this problem. Signed-off-by: Thomas Petazzoni Reviewed-by: Asaf Kahlon Reviewed-by: Yegor Yefremov --- package/lirc-tools/lirc-tools.mk | 2 +- package/pkg-python.mk | 35 ++++++++++++++----- .../python-setuptools/python-setuptools.mk | 1 + 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/package/lirc-tools/lirc-tools.mk b/package/lirc-tools/lirc-tools.mk index a5165ad438..e468f2a25d 100644 --- a/package/lirc-tools/lirc-tools.mk +++ b/package/lirc-tools/lirc-tools.mk @@ -46,7 +46,7 @@ LIRC_TOOLS_DEPENDENCIES += libftdi1 endif ifeq ($(BR2_PACKAGE_PYTHON3),y) -LIRC_TOOLS_DEPENDENCIES += python3 host-python-setuptools +LIRC_TOOLS_DEPENDENCIES += python3 host-python3-setuptools LIRC_TOOLS_MAKE_ENV += SETUPTOOLS_ENV="$(PKG_PYTHON_SETUPTOOLS_ENV)" endif diff --git a/package/pkg-python.mk b/package/pkg-python.mk index 3dc8a5d10f..b641e3f865 100644 --- a/package/pkg-python.mk +++ b/package/pkg-python.mk @@ -188,16 +188,35 @@ endif endif # ($$($(2)_NEEDS_HOST_PYTHON),) endif # ($(4),target) -# Setuptools based packages will need host-python-setuptools (both -# host and target). We need to have a special exclusion for the -# host-setuptools package itself: it is setuptools-based, but -# shouldn't depend on host-setuptools (because it would otherwise -# depend on itself!). +# Setuptools based packages will need setuptools for the host Python +# interpreter (both host and target). +# +# If we have a host package that says "I need Python 3", we install +# setuptools for python3. +# +# If we have a host packge that says "I need Python 2", we install +# setuptools for python2. +# +# If we have a target package, or a host package that doesn't have any +# _NEEDS_HOST_PYTHON, and BR2_PACKAGE_PYTHON3 is used, then +# Python 3.x is the default Python interpreter, so we install +# setuptools for python3. +# +# In all other cases, we install setuptools for python2. Those other +# cases are: a target package or host package with +# BR2_PACKAGE_PYTHON=y, or a host-package with neither +# BR2_PACKAGE_PYTHON3=y or BR2_PACKAGE_PYTHON=y. ifeq ($$($(2)_SETUP_TYPE),setuptools) -ifneq ($(2),HOST_PYTHON_SETUPTOOLS) -$(2)_DEPENDENCIES += host-python-setuptools -endif +ifeq ($(4):$$($(2)_NEEDS_HOST_PYTHON),host:python3) +$(2)_DEPENDENCIES += $$(if $$(filter host-python3-setuptools,$(1)),,host-python3-setuptools) +else ifeq ($(4):$$($(2)_NEEDS_HOST_PYTHON),host:python2) +$(2)_DEPENDENCIES += $$(if $$(filter host-python-setuptools,$(1)),,host-python-setuptools) +else ifeq ($$(BR2_PACKAGE_PYTHON3),y) +$(2)_DEPENDENCIES += $$(if $$(filter host-python3-setuptools,$(1)),,host-python3-setuptools) +else +$(2)_DEPENDENCIES += $$(if $$(filter host-python-setuptools,$(1)),,host-python-setuptools) endif +endif # SETUP_TYPE # Python interpreter to use for building the package. # diff --git a/package/python-setuptools/python-setuptools.mk b/package/python-setuptools/python-setuptools.mk index cc6f991cdd..d915449c5d 100644 --- a/package/python-setuptools/python-setuptools.mk +++ b/package/python-setuptools/python-setuptools.mk @@ -10,6 +10,7 @@ PYTHON_SETUPTOOLS_SITE = https://files.pythonhosted.org/packages/37/1b/b25507861 PYTHON_SETUPTOOLS_LICENSE = MIT PYTHON_SETUPTOOLS_LICENSE_FILES = LICENSE PYTHON_SETUPTOOLS_SETUP_TYPE = setuptools +HOST_PYTHON_SETUPTOOLS_NEEDS_HOST_PYTHON = python2 define PYTHON_SETUPTOOLS_EXTRACT_CMDS $(UNZIP) -d $(@D) $(PYTHON_SETUPTOOLS_DL_DIR)/$(PYTHON_SETUPTOOLS_SOURCE) From patchwork Fri Dec 28 17:01:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1019214 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43RCfd5Bw3z9s7h for ; Sat, 29 Dec 2018 04:01:45 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 78E6C82953; Fri, 28 Dec 2018 17:01:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x+waOLntUh5Z; Fri, 28 Dec 2018 17:01:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 6077082BB2; Fri, 28 Dec 2018 17:01:42 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id BE2351C31CA for ; Fri, 28 Dec 2018 17:01:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id BB86F22699 for ; Fri, 28 Dec 2018 17:01:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SvEEc-jMHhhR for ; Fri, 28 Dec 2018 17:01:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by silver.osuosl.org (Postfix) with ESMTP id E4ED322005 for ; Fri, 28 Dec 2018 17:01:38 +0000 (UTC) Received: by mail.bootlin.com (Postfix, from userid 110) id 9D5CB20A44; Fri, 28 Dec 2018 18:01:37 +0100 (CET) Received: from localhost (mat33-2-88-189-187-82.fbx.proxad.net [88.189.187.82]) by mail.bootlin.com (Postfix) with ESMTPSA id 5402C2073D; Fri, 28 Dec 2018 18:01:37 +0100 (CET) From: Thomas Petazzoni To: buildroot@buildroot.org Date: Fri, 28 Dec 2018 18:01:31 +0100 Message-Id: <20181228170132.13049-4-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181228170132.13049-1-thomas.petazzoni@bootlin.com> References: <20181228170132.13049-1-thomas.petazzoni@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 3/3] package/pkg-python: use --single-version-externally-managed for host setuptools 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: Rhys Williams , Thomas Petazzoni , Asaf Kahlon Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Currently, host Python packages that use setuptools are installed as Python Eggs, i.e they are installed in $(HOST_DIR)/lib/python2.7/site-packages/Something-.egg. Once installed, each Python Egg is registered to a file called $(HOST_DIR)/lib/python2.7/site-packages/easy-install.pth. This file is read by the Python interpreter so that the installation location of each Egg is added to the Python path, and can be found by the Python interpreter. However, the fact that the installation of different Python modules need to update a common file is clearly not compatible with per-package directories and top-level parallel build. To fix this, we avoid using Python Eggs using the same --single-version-externally-managed option that we use for target modules. This option is normally meant for distributions packaging Python modules, and can therefore only be used if either --record (to record the list of files being installed) or --root is passed. --root=/ works fine and was suggested by https://stackoverflow.com/questions/6301003/stopping-setup-py-from-installing-as-egg/33791008#33791008. With this change, host Python modules installed by setuptools are now installed in the "regular" way, i.e directly in $(HOST_DIR)/lib/python2.7/site-packages/mako for host-python-mako. This makes the installation of host Python modules more similar to the one of target modules, and makes it compatible with per-package directory support and top-level parallel build. Signed-off-by: Thomas Petazzoni Reviewed-by: Asaf Kahlon Reviewed-by: Yegor Yefremov --- package/pkg-python.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/pkg-python.mk b/package/pkg-python.mk index b641e3f865..4f42e2efc2 100644 --- a/package/pkg-python.mk +++ b/package/pkg-python.mk @@ -85,7 +85,9 @@ HOST_PKG_PYTHON_SETUPTOOLS_ENV = \ PYTHONNOUSERSITE=1 HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \ - --prefix=$(HOST_DIR) + --prefix=$(HOST_DIR) \ + --root=/ \ + --single-version-externally-managed ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) define PKG_PYTHON_FIXUP_SYSCONFIGDATA