git: 56783cabef13 - main - sysutils/lfm: Convert to USE_PYTHON=pep517

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Wed, 03 Jul 2024 15:38:46 UTC
The branch main has been updated by sunpoet:

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

commit 56783cabef13919eed9c98eb53317d6db38178bf
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-07-03 15:34:30 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-07-03 15:34:30 +0000

    sysutils/lfm: Convert to USE_PYTHON=pep517
    
    - Bump PORTREVISION for package change
---
 sysutils/lfm/Makefile             |  9 +++++----
 sysutils/lfm/files/patch-setup.py | 30 ++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/sysutils/lfm/Makefile b/sysutils/lfm/Makefile
index 350f17811b69..6d2986496e9f 100644
--- a/sysutils/lfm/Makefile
+++ b/sysutils/lfm/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	lfm
 PORTVERSION=	3.1
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	PYPI
 
@@ -10,12 +11,12 @@ WWW=		https://inigo.katxi.org/devel/lfm/
 LICENSE=	GPLv3+
 LICENSE_FILE=	${WRKSRC}/COPYING
 
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
+
 USES=		python
-USE_PYTHON=	autoplist distutils noflavors
+USE_PYTHON=	autoplist noflavors pep517
 
 NO_ARCH=	yes
 
-post-patch:
-	@${REINPLACE_CMD} -e '/print(__doc__)/d' ${WRKSRC}/setup.py
-
 .include <bsd.port.mk>
diff --git a/sysutils/lfm/files/patch-setup.py b/sysutils/lfm/files/patch-setup.py
new file mode 100644
index 000000000000..bef38f3126a5
--- /dev/null
+++ b/sysutils/lfm/files/patch-setup.py
@@ -0,0 +1,30 @@
+--- setup.py.orig	2017-06-25 17:04:03 UTC
++++ setup.py
+@@ -37,18 +37,12 @@ Topic :: Utilities
+ Topic :: Utilities
+ """
+ 
+-print(__doc__)
+-
+ # check python version
+ ver = (version_info.major, version_info.minor)
+ if ver < (3, 4):
+     print('ERROR: Python 3.4 or higher is required to run lfm.')
+     exit(-1)
+ 
+-# to avoid bug in pip 7.x. See https://bitbucket.org/pypa/wheel/issues/92
+-if 'bdist_wheel' in argv:
+-    raise RuntimeError("This setup.py does not support wheels")
+-
+ import shutil
+ try:
+     try:
+@@ -71,7 +65,7 @@ try:
+           license='GPL3+',
+           packages=['lfm'],
+           scripts=['lfm/lfm'],
+-          data_files=[(join(prefix, 'share/man/man1'), MAN_FILES)],
++          data_files=[('share/man/man1', MAN_FILES)],
+           package_data={'': CONFIG_FILES + [join('doc', f) for f in DOC_FILES]},
+     )
+ finally: