python3: Split setuptools into separate source package 21190/head
authorJeffery To <jeffery.to@gmail.com>
Thu, 18 May 2023 12:38:09 +0000 (20:38 +0800)
committerJeffery To <jeffery.to@gmail.com>
Fri, 26 May 2023 14:06:24 +0000 (22:06 +0800)
Packaging setuptools from a separate source package allows it to stay
updated with upstream.

Host setuptools will remain installed as part of python3. Host
setuptools is used in a much more controlled way and so is less critical
for it to track upstream.

setuptools was in a separate source package that was removed in
a53d0c5a403d1669e2cf6c59c2be6a9d3ed633a0; this work is not based on that
earlier package.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lang/python/python-setuptools/Makefile [new file with mode: 0644]
lang/python/python3/Makefile
lang/python/python3/files/python3-package-pkg-resources.mk [deleted file]
lang/python/python3/files/python3-package-setuptools.mk [deleted file]
lang/python/python3/patches-host-setuptools/.gitkeep [new file with mode: 0644]
lang/python/python3/patches-setuptools/.placeholder [deleted file]

diff --git a/lang/python/python-setuptools/Makefile b/lang/python/python-setuptools/Makefile
new file mode 100644 (file)
index 0000000..fa6ec74
--- /dev/null
@@ -0,0 +1,82 @@
+#
+# Copyright (C) 2023 Jeffery To
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-setuptools
+PKG_VERSION:=67.8.0
+PKG_RELEASE:=1
+
+PYPI_NAME:=setuptools
+PKG_HASH:=62642358adc77ffa87233bc4d2354c4b2682d214048f500964dbe760ccedf102
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+CPE_ID:=cpe:/a:python:setuptools
+
+include ../pypi.mk
+include $(INCLUDE_DIR)/package.mk
+include ../python3-package.mk
+
+define Package/python3-setuptools/Default
+  SECTION:=lang
+  CATEGORY:=Languages
+  SUBMENU:=Python
+  URL:=https://github.com/pypa/setuptools
+endef
+
+define Package/python3-pkg-resources
+$(call Package/python3-setuptools/Default)
+  TITLE:=Package resource API
+  DEPENDS:=+python3-light +python3-email +python3-logging +python3-urllib
+endef
+
+define Package/python3-setuptools
+$(call Package/python3-setuptools/Default)
+  TITLE:=Fully-featured library to package Python projects
+  DEPENDS:=+python3 +python3-pkg-resources
+endef
+
+define Package/python3-setuptools/description/Default
+Setuptools is a fully-featured, actively-maintained, and stable library
+designed to facilitate packaging Python projects.
+
+It helps developers to easily share reusable code (in the form of a
+library) and programs (e.g., CLI/GUI tools implemented in Python), that
+can be installed with pip and uploaded to PyPI.
+endef
+
+define Package/python3-pkg-resources/description
+$(call Package/python3-setuptools/description/Default)
+
+This is the pkg_resources module of setuptools.
+endef
+
+define Package/python3-setuptools/description
+$(call Package/python3-setuptools/description/Default)
+
+This is the main setuptools module.
+endef
+
+define Py3Package/python3-pkg-resources/filespec
++|$(PYTHON3_PKG_DIR)/pkg_resources
+endef
+
+define Py3Package/python3-setuptools/filespec
++|$(PYTHON3_PKG_DIR)
+-|$(PYTHON3_PKG_DIR)/pkg_resources
+endef
+
+$(eval $(call Py3Package,python3-pkg-resources))
+$(eval $(call Py3Package,python3-setuptools))
+
+$(eval $(call BuildPackage,python3-pkg-resources))
+$(eval $(call BuildPackage,python3-setuptools))
+
+$(eval $(call BuildPackage,python3-pkg-resources-src))
+$(eval $(call BuildPackage,python3-setuptools-src))
index b478f5b6c2605d4cdde69ff6e785ccdc26c1c59c..d2ef977a22c170fb87c64278ceeba39e05b82f8e 100644 (file)
@@ -41,10 +41,6 @@ PKG_BUILD_FLAGS:=no-lto
 PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
 
-PKG_CONFIG_DEPENDS:= \
-       CONFIG_PACKAGE_python3-pkg-resources \
-       CONFIG_PACKAGE_python3-setuptools
-
 PKG_BUILD_DEPENDS:=bluez python3/host python-build/host python-installer/host python-wheel/host
 HOST_BUILD_DEPENDS:=bzip2/host libffi/host
 
@@ -187,38 +183,6 @@ CONFIGURE_ARGS += \
        $(if $(CONFIG_IPV6),--enable-ipv6) \
        $(if $(findstring mips,$(CONFIG_ARCH)),,--with-lto)
 
-ifdef CONFIG_PACKAGE_python3-setuptools
-PYTHON3_SETUPTOOLS_BUILD:=1
-endif
-
-ifdef CONFIG_PACKAGE_python3-pkg-resources
-PYTHON3_SETUPTOOLS_BUILD:=1
-endif
-
-ifeq ($(PYTHON3_SETUPTOOLS_BUILD),1)
-define Build/Compile/python3-setuptools
-       $(HOST_PYTHON3_PIP_VARS) \
-       $(HOST_PYTHON3_PIP) \
-               install \
-               --ignore-installed \
-               --progress-bar off \
-               --root=$(PKG_BUILD_DIR)/install-setuptools \
-               --prefix=/usr \
-               $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)-py3-none-any.whl
-       $(call PatchDir,$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON3_VERSION)/site-packages,./patches-setuptools,)
-endef
-else
-define Build/Compile/python3-setuptools
-       ls $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)-py3-none-any.whl
-endef
-endif # CONFIG_PACKAGE_python3-setuptools
-
-define Build/Compile
-       $(call Build/Compile/Default)
-       # Use host pip to install python-setuptools
-       $(call Build/Compile/python3-setuptools)
-endef
-
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
        $(INSTALL_DIR) $(2)/bin
@@ -347,6 +311,7 @@ HOST_CONFIGURE_ARGS += \
 define Host/Configure
        $(SED) 's/^ENABLE_USER_SITE = None$$$$/ENABLE_USER_SITE = False/' $(HOST_BUILD_DIR)/Lib/site.py
        $(call Host/Configure/Default)
+       ls $(HOST_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-$(PYTHON3_SETUPTOOLS_VERSION)-py3-none-any.whl
        ls $(HOST_BUILD_DIR)/Lib/ensurepip/_bundled/pip-$(PYTHON3_PIP_VERSION)-py3-none-any.whl
 endef
 
@@ -368,7 +333,7 @@ define Host/Install
        )
        $(call Host/Install/Default)
        $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)),,
-               $(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-setuptools,)
+               $(call HostPatchDir,$(HOST_PYTHON3_PKG_DIR),./patches-host-setuptools,)
                touch $(HOST_PYTHON3_PKG_DIR)/.setuptools_installed_$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)
        )
        $(if $(wildcard $(HOST_PYTHON3_PKG_DIR)/.pip_installed_$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)),,
diff --git a/lang/python/python3/files/python3-package-pkg-resources.mk b/lang/python/python3/files/python3-package-pkg-resources.mk
deleted file mode 100644 (file)
index 592fe2c..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (C) 2019 Alexandru Ardelean <ardeleanalex@gmail.com>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Package/python3-pkg-resources
-$(call Package/python3/Default)
-  TITLE:=Python $(PYTHON3_VERSION) pkg_resources module (part of setuptools)
-  VERSION:=$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)
-  LICENSE:=MIT
-  LICENSE_FILES:=LICENSE
-#  CPE_ID:=cpe:/a:python:setuptools # not currently handled this way by uscan
-  DEPENDS:=+python3
-endef
-
-define Py3Package/python3-pkg-resources/install
-       $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
-       $(CP) \
-               $(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON3_VERSION)/site-packages/pkg_resources \
-               $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
-       find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -path '*/__pycache__/*' -delete
-       find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -type d -name __pycache__ -delete
-endef
-
-$(eval $(call Py3BasePackage,python3-pkg-resources, \
-       , \
-       DO_NOT_ADD_TO_PACKAGE_DEPENDS \
-))
diff --git a/lang/python/python3/files/python3-package-setuptools.mk b/lang/python/python3/files/python3-package-setuptools.mk
deleted file mode 100644 (file)
index 3b7c1ca..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Copyright (C) 2017 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Package/python3-setuptools
-$(call Package/python3/Default)
-  TITLE:=Python $(PYTHON3_VERSION) setuptools module
-  VERSION:=$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)
-  LICENSE:=MIT
-  LICENSE_FILES:=LICENSE
-#  CPE_ID:=cpe:/a:python:setuptools # not currently handled this way by uscan
-  DEPENDS:=+python3 +python3-pkg-resources
-endef
-
-define Py3Package/python3-setuptools/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
-       $(CP) \
-               $(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON3_VERSION)/site-packages/setuptools \
-               $(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON3_VERSION)/site-packages/setuptools-$(PYTHON3_SETUPTOOLS_VERSION).dist-info \
-               $(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON3_VERSION)/site-packages/_distutils_hack \
-               $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
-       find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -path '*/__pycache__/*' -delete
-       find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -type d -name __pycache__ -delete
-endef
-
-$(eval $(call Py3BasePackage,python3-setuptools, \
-       , \
-       DO_NOT_ADD_TO_PACKAGE_DEPENDS \
-))
diff --git a/lang/python/python3/patches-host-setuptools/.gitkeep b/lang/python/python3/patches-host-setuptools/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/lang/python/python3/patches-setuptools/.placeholder b/lang/python/python3/patches-setuptools/.placeholder
deleted file mode 100644 (file)
index e69de29..0000000