package/pkg-python: drop python2 host/setuptools support

Drop conditonal python version handling now that python2 has been
removed.

Remove python3-setuptools and replace usage with python3 only
python-setuptools.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
James Hilliard 2022-02-11 22:42:27 -07:00 committed by Peter Korsgaard
parent 0baf647329
commit 697acda00d
12 changed files with 6 additions and 181 deletions

View File

@ -28,7 +28,7 @@ LIBAPPARMOR_CONF_OPTS = \
--disable-man-pages
ifeq ($(BR2_PACKAGE_PYTHON3),y)
LIBAPPARMOR_DEPENDENCIES += host-python3 host-python3-setuptools host-swig python3
LIBAPPARMOR_DEPENDENCIES += host-python3 host-python-setuptools host-swig python3
LIBAPPARMOR_CONF_OPTS += \
--with-python \
PYTHON=$(HOST_DIR)/usr/bin/python3 \

View File

@ -73,7 +73,7 @@ LIBIIO_CONF_OPTS += -DHAVE_DNS_SD=OFF
endif
ifeq ($(BR2_PACKAGE_LIBIIO_BINDINGS_PYTHON),y)
LIBIIO_DEPENDENCIES += host-python3-setuptools python3
LIBIIO_DEPENDENCIES += host-python-setuptools python3
LIBIIO_CONF_OPTS += \
-DPYTHON_BINDINGS=ON \
-DPYTHON_EXECUTABLE=$(HOST_DIR)/bin/python3

View File

@ -47,7 +47,7 @@ LIRC_TOOLS_DEPENDENCIES += libftdi1
endif
ifeq ($(BR2_PACKAGE_PYTHON3),y)
LIRC_TOOLS_DEPENDENCIES += python3 host-python3-setuptools
LIRC_TOOLS_DEPENDENCIES += python3 host-python-setuptools
LIRC_TOOLS_MAKE_ENV += SETUPTOOLS_ENV='$(PKG_PYTHON_SETUPTOOLS_ENV)'
endif

View File

@ -150,86 +150,24 @@ endif
# Target packages need both the python interpreter on the target (for
# runtime) and the python interpreter on the host (for
# compilation). However, host packages only need the python
# interpreter on the host, whose version may be enforced by setting
# the *_NEEDS_HOST_PYTHON variable.
#
# So:
# - for target packages, we always depend on the default python interpreter
# (the one selected by the config);
# - for host packages:
# - if *_NEEDS_HOST_PYTHON is not set, then we use the default
# interpreter;
# - otherwise, we depend on the one requested by *_NEEDS_HOST_PYTHON.
# interpreter on the host.
#
ifeq ($(4),target)
$(2)_DEPENDENCIES += $$(if $$(BR2_PACKAGE_PYTHON3),host-python3 python3,host-python python)
$(2)_DEPENDENCIES += host-python3 python3
else
ifeq ($$($(2)_NEEDS_HOST_PYTHON),)
$(2)_DEPENDENCIES += $$(if $$(BR2_PACKAGE_PYTHON3),host-python3,host-python)
else
ifeq ($$($(2)_NEEDS_HOST_PYTHON),python2)
$(2)_DEPENDENCIES += host-python
else ifeq ($$($(2)_NEEDS_HOST_PYTHON),python3)
$(2)_DEPENDENCIES += host-python3
else
$$(error Incorrect value '$$($(2)_NEEDS_HOST_PYTHON)' for $(2)_NEEDS_HOST_PYTHON)
endif
endif # ($$($(2)_NEEDS_HOST_PYTHON),)
endif # ($(4),target)
# 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
# <pkg>_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)
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.
#
# We may want to specify the python interpreter to be used for building a
# package, especially for host-packages (target packages must be built using
# the same version of the interpreter as the one installed on the target).
#
# So:
# - for target packages, we always use the default python interpreter (which
# is the same version as the one built and installed on the target);
# - for host packages:
# - if *_NEEDS_HOST_PYTHON is not set, then we use the default
# interpreter;
# - otherwise, we use the one requested by *_NEEDS_HOST_PYTHON.
#
ifeq ($(4),target)
$(2)_PYTHON_INTERPRETER = $$(HOST_DIR)/bin/python
else
ifeq ($$($(2)_NEEDS_HOST_PYTHON),)
$(2)_PYTHON_INTERPRETER = $$(HOST_DIR)/bin/python
else
$(2)_PYTHON_INTERPRETER = $$(HOST_DIR)/bin/$$($(2)_NEEDS_HOST_PYTHON)
endif
endif
#
# Build step. Only define it if not already defined by the package .mk

View File

@ -1,72 +0,0 @@
From 9b3d307f8f6a1af88f3f810f5a6cf0835830e1e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
Date: Mon, 7 Dec 2015 01:14:33 +0100
Subject: [PATCH] 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 <gustavo@zacarias.com.ar>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
---
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

View File

@ -1,4 +0,0 @@
# From https://pypi.org/pypi/setuptools/json
md5 32b6cdce670ce462086d246bea181e9d setuptools-44.0.0.zip
sha256 e5baf7723e5bb8382fc146e33032b241efc63314211a3a120aaa55d62d2bb008 setuptools-44.0.0.zip
sha256 c32a3ac395af6321efd28be73d06a00f0db6ab887d1c21d4fec46128d2056d5a LICENSE

View File

@ -4,29 +4,14 @@
#
################################################################################
# Please keep in sync with
# package/python3-setuptools/python3-setuptools.mk
PYTHON_SETUPTOOLS_VERSION = 60.7.0
PYTHON_SETUPTOOLS_SOURCE = setuptools-$(PYTHON3_SETUPTOOLS_VERSION).tar.gz
PYTHON_SETUPTOOLS_SOURCE = setuptools-$(PYTHON_SETUPTOOLS_VERSION).tar.gz
PYTHON_SETUPTOOLS_SITE = https://files.pythonhosted.org/packages/29/dd/48d662bb93e5e51e72265ef612f869947d4ae4126328d7156824cd50d440
# The host variant is only for Python 2.x, so we need to use 44.0.0.
HOST_PYTHON_SETUPTOOLS_VERSION = 44.0.0
HOST_PYTHON_SETUPTOOLS_SOURCE = setuptools-$(HOST_PYTHON_SETUPTOOLS_VERSION).zip
HOST_PYTHON_SETUPTOOLS_SITE = https://files.pythonhosted.org/packages/b0/f3/44da7482ac6da3f36f68e253cb04de37365b3dba9036a3c70773b778b485
HOST_PYTHON_SETUPTOOLS_NEEDS_HOST_PYTHON = python2
PYTHON_SETUPTOOLS_LICENSE = MIT
PYTHON_SETUPTOOLS_LICENSE_FILES = LICENSE
PYTHON_SETUPTOOLS_CPE_ID_VENDOR = python
PYTHON_SETUPTOOLS_CPE_ID_PRODUCT = setuptools
PYTHON_SETUPTOOLS_SETUP_TYPE = setuptools
define HOST_PYTHON_SETUPTOOLS_EXTRACT_CMDS
$(UNZIP) -d $(@D) $(HOST_PYTHON_SETUPTOOLS_DL_DIR)/$(HOST_PYTHON_SETUPTOOLS_SOURCE)
mv $(@D)/setuptools-$(HOST_PYTHON_SETUPTOOLS_VERSION)/* $(@D)
$(RM) -r $(@D)/setuptools-$(HOST_PYTHON_SETUPTOOLS_VERSION)
endef
$(eval $(python-package))
$(eval $(host-python-package))

View File

@ -1 +0,0 @@
../python-setuptools/60.7.0/0001-add-executable.patch

View File

@ -1 +0,0 @@
../python-setuptools/60.7.0/python-setuptools.hash

View File

@ -1,20 +0,0 @@
################################################################################
#
# python3-setuptools
#
################################################################################
# Please keep in sync with
# package/python-setuptools/python-setuptools.mk
PYTHON3_SETUPTOOLS_VERSION = 60.7.0
PYTHON3_SETUPTOOLS_SOURCE = setuptools-$(PYTHON3_SETUPTOOLS_VERSION).tar.gz
PYTHON3_SETUPTOOLS_SITE = https://files.pythonhosted.org/packages/29/dd/48d662bb93e5e51e72265ef612f869947d4ae4126328d7156824cd50d440
PYTHON3_SETUPTOOLS_LICENSE = MIT
PYTHON3_SETUPTOOLS_LICENSE_FILES = LICENSE
PYTHON3_SETUPTOOLS_CPE_ID_VENDOR = python
PYTHON3_SETUPTOOLS_CPE_ID_PRODUCT = setuptools
PYTHON3_SETUPTOOLS_SETUP_TYPE = setuptools
HOST_PYTHON3_SETUPTOOLS_DL_SUBDIR = python-setuptools
HOST_PYTHON3_SETUPTOOLS_NEEDS_HOST_PYTHON = python3
$(eval $(host-python-package))