git: 8b5ae17d2f43 - main - devel/py-setuptools: convert to USE_PYTHON=pep517

From: Charlie Li <vishwin_at_FreeBSD.org>
Date: Sat, 05 Apr 2025 20:57:45 UTC
The branch main has been updated by vishwin:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8b5ae17d2f43388fade30e266615a9e34bf06abd

commit 8b5ae17d2f43388fade30e266615a9e34bf06abd
Author:     Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2025-04-05 20:45:55 +0000
Commit:     Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2025-04-05 20:45:55 +0000

    devel/py-setuptools: convert to USE_PYTHON=pep517
    
    The previous method of building/bootstrapping setuptools via the
    built-in distutils module no longer works in Python 3.12+ as it has
    been removed [0]. Since USE_PYTHON=pep517 has its own bootstrapping
    process, use this method to build setuptools.
    
    This allows newer Python distributions/interpreters to land in the
    tree, for the purpose of having buildable packages.
    
    While here, remove a slew of dead code and adjust WWW
    
    [0] https://peps.python.org/pep-0632/
    
    PR: 271673, 274671
---
 devel/py-setuptools/Makefile                       | 39 ++++++----------------
 devel/py-setuptools/files/easy-install.pth.dist    |  2 --
 .../files/patch-setuptools_package__index.py       | 11 ------
 devel/py-setuptools/files/pkg-message.in           |  8 -----
 4 files changed, 10 insertions(+), 50 deletions(-)

diff --git a/devel/py-setuptools/Makefile b/devel/py-setuptools/Makefile
index df00d0d46fef..836352af12b3 100644
--- a/devel/py-setuptools/Makefile
+++ b/devel/py-setuptools/Makefile
@@ -1,48 +1,29 @@
 PORTNAME=	setuptools
 PORTVERSION=	63.1.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
 DIST_SUBDIR=	python
 
-# note: before committing to this port, contact portmgr to arrange for an
-# experimental ports run.  Untested commits may be backed out at portmgr's
-# discretion.
+# note: before committing a new major version, contact portmgr to
+# arrange for an experimental ports run. Untested commits may be
+# backed out.
 MAINTAINER=	python@FreeBSD.org
 COMMENT=	Python packages installer
-WWW=		https://pypi.org/project/setuptools/
+WWW=		https://github.com/pypa/setuptools \
+		https://pypi.org/project/setuptools/
 
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}wheel044<0.46.0:devel/py-wheel044@${PY_FLAVOR}
+
 USES=		cpe python
-USE_PYTHON=	allflavors autoplist concurrent distutils
+USE_PYTHON=	allflavors autoplist concurrent pep517 # pytest to return later
 
 CPE_VENDOR=	python
 
-MAKE_ENV+=	SETUPTOOLS_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT=1
 NO_ARCH=	yes
-PYDISTUTILS_SETUP=	${PYSETUP}
-
-PLIST_FILES=	"@sample %%PYTHON_SITELIBDIR%%/easy-install.pth.dist %%PYTHON_SITELIBDIR%%/easy-install.pth"
-
-.include <bsd.port.pre.mk>
-
-.if ${FLAVOR} != ${FLAVORS:[1]}
-SUB_FILES+=	pkg-message
-SUB_LIST+=	PYTHON_VER=${PYTHON_VER}
-.endif
-
-# These create dependency loops in redports/poudriere, because setuptools
-# is currently an explicit BUILD & RUN dependency in Uses/python.mk.
-#TEST_DEPENDS=  ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR}
-# pkg install -y py38-pytest py38-mock py38-pytest-fixture-config py38-pytest-virtualenv py38-paver
-
-post-install:
-	${INSTALL_DATA} ${FILESDIR}/easy-install.pth.dist ${STAGEDIR}${PYTHON_SITELIBDIR}/
-
-do-test:
-	cd ${WRKSRC} && ${PYTHON_CMD} -m pytest -v -rs
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/devel/py-setuptools/files/easy-install.pth.dist b/devel/py-setuptools/files/easy-install.pth.dist
deleted file mode 100644
index e7ab88be464d..000000000000
--- a/devel/py-setuptools/files/easy-install.pth.dist
+++ /dev/null
@@ -1,2 +0,0 @@
-import sys; sys.__plen = len(sys.path)
-import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
diff --git a/devel/py-setuptools/files/patch-setuptools_package__index.py b/devel/py-setuptools/files/patch-setuptools_package__index.py
deleted file mode 100644
index 85b8319a0b09..000000000000
--- a/devel/py-setuptools/files/patch-setuptools_package__index.py
+++ /dev/null
@@ -1,11 +0,0 @@
---- setuptools/package_index.py.orig	2022-07-04 02:25:25 UTC
-+++ setuptools/package_index.py
-@@ -197,7 +197,7 @@ def unique_values(func):
-     return wrapper
- 
- 
--REL = re.compile(r"""<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>""", re.I)
-+REL = re.compile(r"""<([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>""", re.I)
- # this line is here to fix emacs' cruddy broken syntax highlighting
- 
- 
diff --git a/devel/py-setuptools/files/pkg-message.in b/devel/py-setuptools/files/pkg-message.in
deleted file mode 100644
index 2c33be99f2e5..000000000000
--- a/devel/py-setuptools/files/pkg-message.in
+++ /dev/null
@@ -1,8 +0,0 @@
-[
-{ type: install
-  message: <<EOM
-  Only %%PREFIX%%/bin/easy_install-%%PYTHON_VER%% script has been installed
-  since Python %%PYTHON_VER%% is not the default Python version.
-EOM
-}
-]