git: fd932c22056b - main - devel/py-setuptools58: add

From: Charlie Li <vishwin_at_FreeBSD.org>
Date: Sun, 15 Jan 2023 19:57:00 UTC
The branch main has been updated by vishwin:

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

commit fd932c22056b7aed8fc14e3408437896a543cc95
Author:     Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2023-01-02 05:04:00 +0000
Commit:     Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2023-01-15 19:55:02 +0000

    devel/py-setuptools58: add
    
    This port will eventually serve as the one used in USE_PYTHON=distutils,
    namely for executing ${PYSETUP}. See
    https://wiki.freebsd.org/Python/setuptools for details.
    
    Approved by: fluffy (mentor)
    Differential Revision: https://reviews.freebsd.org/D38069
---
 Mk/Uses/python.mk                                 |  3 +-
 devel/Makefile                                    |  1 +
 devel/py-setuptools58/Makefile                    | 48 +++++++++++++++++++++++
 devel/py-setuptools58/distinfo                    |  3 ++
 devel/py-setuptools58/files/easy-install.pth.dist |  2 +
 devel/py-setuptools58/files/pkg-message.in        |  8 ++++
 devel/py-setuptools58/pkg-descr                   |  8 ++++
 7 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
index 0aa9b44f75d2..8ac80fcacd76 100644
--- a/Mk/Uses/python.mk
+++ b/Mk/Uses/python.mk
@@ -605,7 +605,8 @@ UNIQUE_FIND_SUFFIX_MAN_FILES+=	${_UNIQUE_FIND_SUFFIX_FILES} | \
 
 _CURRENTPORT:=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
 .  if defined(_PYTHON_FEATURE_DISTUTILS) && \
-	${_CURRENTPORT} != ${PYTHON_PKGNAMEPREFIX}setuptools &&\
+	${_CURRENTPORT} != ${PYTHON_PKGNAMEPREFIX}setuptools && \
+	${_CURRENTPORT} != ${PYTHON_PKGNAMEPREFIX}setuptools58 && \
 	${_CURRENTPORT} != ${PYTHON_PKGNAMEPREFIX}setuptools44
 .    if ${PYTHON_VER} == 2.7
 BUILD_DEPENDS+=		${PYTHON_PKGNAMEPREFIX}setuptools44>0:devel/py-setuptools44@${PY_FLAVOR}
diff --git a/devel/Makefile b/devel/Makefile
index 979840dee3d4..026f11c94eeb 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -5368,6 +5368,7 @@
     SUBDIR += py-setuptools-pkg
     SUBDIR += py-setuptools-rust
     SUBDIR += py-setuptools44
+    SUBDIR += py-setuptools58
     SUBDIR += py-setuptools_hg
     SUBDIR += py-setuptools_scm
     SUBDIR += py-setuptools_scm_git_archive
diff --git a/devel/py-setuptools58/Makefile b/devel/py-setuptools58/Makefile
new file mode 100644
index 000000000000..6630578290d0
--- /dev/null
+++ b/devel/py-setuptools58/Makefile
@@ -0,0 +1,48 @@
+PORTNAME=	setuptools
+PORTVERSION=	58.5.3
+CATEGORIES=	devel python
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+PKGNAMESUFFIX=	58
+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.
+MAINTAINER=	python@FreeBSD.org
+COMMENT=	Python packages installer
+WWW=		https://pypi.org/project/setuptools/
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		cpe python:3.7+
+USE_PYTHON=	allflavors autoplist concurrent distutils
+
+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>
diff --git a/devel/py-setuptools58/distinfo b/devel/py-setuptools58/distinfo
new file mode 100644
index 000000000000..bc632d47d468
--- /dev/null
+++ b/devel/py-setuptools58/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1672635792
+SHA256 (python/setuptools-58.5.3.tar.gz) = dae6b934a965c8a59d6d230d3867ec408bb95e73bd538ff77e71fedf1eaca729
+SIZE (python/setuptools-58.5.3.tar.gz) = 2269854
diff --git a/devel/py-setuptools58/files/easy-install.pth.dist b/devel/py-setuptools58/files/easy-install.pth.dist
new file mode 100644
index 000000000000..e7ab88be464d
--- /dev/null
+++ b/devel/py-setuptools58/files/easy-install.pth.dist
@@ -0,0 +1,2 @@
+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-setuptools58/files/pkg-message.in b/devel/py-setuptools58/files/pkg-message.in
new file mode 100644
index 000000000000..2c33be99f2e5
--- /dev/null
+++ b/devel/py-setuptools58/files/pkg-message.in
@@ -0,0 +1,8 @@
+[
+{ 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
+}
+]
diff --git a/devel/py-setuptools58/pkg-descr b/devel/py-setuptools58/pkg-descr
new file mode 100644
index 000000000000..56d7f5d82a6d
--- /dev/null
+++ b/devel/py-setuptools58/pkg-descr
@@ -0,0 +1,8 @@
+Setuptools is a fully-featured, actively-maintained, and stable library
+designed to facilitate packaging Python projects, where packaging includes:
+ - Python package and module definitions
+ - Distribution package metadata
+ - Test hooks
+ - Project installation
+ - Platform-specific details
+ - Python 3 support