2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2012-01-04 12:30:03 +01:00
|
|
|
#
|
|
|
|
# python-setuptools
|
|
|
|
#
|
2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2012-01-04 12:30:03 +01:00
|
|
|
|
2019-01-14 20:59:33 +01:00
|
|
|
# Please keep in sync with
|
|
|
|
# package/python3-setuptools/python3-setuptools.mk
|
2019-10-17 17:17:11 +02:00
|
|
|
PYTHON_SETUPTOOLS_VERSION = 41.4.0
|
2018-09-21 17:01:50 +02:00
|
|
|
PYTHON_SETUPTOOLS_SOURCE = setuptools-$(PYTHON_SETUPTOOLS_VERSION).zip
|
2019-10-17 17:17:11 +02:00
|
|
|
PYTHON_SETUPTOOLS_SITE = https://files.pythonhosted.org/packages/f4/d5/a6c19dcbcbc267aca376558797f036d9bcdff344c9f785fe7d0fe9a5f2a7
|
2017-06-15 10:03:19 +02:00
|
|
|
PYTHON_SETUPTOOLS_LICENSE = MIT
|
|
|
|
PYTHON_SETUPTOOLS_LICENSE_FILES = LICENSE
|
2013-12-11 21:26:52 +01:00
|
|
|
PYTHON_SETUPTOOLS_SETUP_TYPE = setuptools
|
package/pkg-python: use host-python3-setuptools when needed
When a package uses "setuptools" as its <pkg>_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 <pkg>_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 <pkg>_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 <pkg>_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 <pkg>_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 <thomas.petazzoni@bootlin.com>
Reviewed-by: Asaf Kahlon <asafka7@gmail.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-12-28 18:01:30 +01:00
|
|
|
HOST_PYTHON_SETUPTOOLS_NEEDS_HOST_PYTHON = python2
|
2012-01-04 12:30:03 +01:00
|
|
|
|
2018-09-21 17:01:50 +02:00
|
|
|
define PYTHON_SETUPTOOLS_EXTRACT_CMDS
|
|
|
|
$(UNZIP) -d $(@D) $(PYTHON_SETUPTOOLS_DL_DIR)/$(PYTHON_SETUPTOOLS_SOURCE)
|
|
|
|
mv $(@D)/setuptools-$(PYTHON_SETUPTOOLS_VERSION)/* $(@D)
|
|
|
|
$(RM) -r $(@D)/setuptools-$(PYTHON_SETUPTOOLS_VERSION)
|
2017-06-15 10:03:19 +02:00
|
|
|
endef
|
|
|
|
|
2018-09-21 17:01:50 +02:00
|
|
|
define HOST_PYTHON_SETUPTOOLS_EXTRACT_CMDS
|
|
|
|
$(UNZIP) -d $(@D) $(HOST_PYTHON_SETUPTOOLS_DL_DIR)/$(PYTHON_SETUPTOOLS_SOURCE)
|
|
|
|
mv $(@D)/setuptools-$(PYTHON_SETUPTOOLS_VERSION)/* $(@D)
|
|
|
|
$(RM) -r $(@D)/setuptools-$(PYTHON_SETUPTOOLS_VERSION)
|
|
|
|
endef
|
2017-06-15 10:03:19 +02:00
|
|
|
|
2013-12-11 21:26:52 +01:00
|
|
|
$(eval $(python-package))
|
|
|
|
$(eval $(host-python-package))
|