git: c881e8210178 - main - misc/py-shell-gpt: don't install test files

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Sun, 02 Apr 2023 06:25:13 UTC
The branch main has been updated by tagattie:

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

commit c881e82101784ab6b0ee63de2485eb90fd37570f
Author:     Hiroki Tagato <tagattie@FreeBSD.org>
AuthorDate: 2023-04-02 06:23:12 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2023-04-02 06:25:08 +0000

    misc/py-shell-gpt: don't install test files
    
    py-shell-gpt and py-notus-scanner both try to install test files to a
    generic location (/usr/local/lib/python3.9/site-packages/tests).
    py-shell-gtp does not require test files for normal operations, so
    avoid collision by not installing test files.
    
    PR:             270542
    Reported by:    John Hein <jcfyecrayz@liamekaens.com>
---
 misc/py-shell-gpt/Makefile                                    |  9 ++++++++-
 misc/py-shell-gpt/files/patch-shell__gpt.egg-info_SOURCES.txt | 10 ++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/misc/py-shell-gpt/Makefile b/misc/py-shell-gpt/Makefile
index 8331ba46c8c4..0032fccf71d5 100644
--- a/misc/py-shell-gpt/Makefile
+++ b/misc/py-shell-gpt/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	shell-gpt
 DISTVERSION=	0.8.1
+PORTREVISION=	1
 CATEGORIES=	misc python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -24,8 +25,14 @@ USE_PYTHON=	autoplist distutils pytest
 BINARY_ALIAS=	python=${PYTHON_CMD}
 NO_ARCH=	yes
 
+post-extract:
+	@${RM} ${WRKSRC}/tests/__init__.py
+
+post-patch:
+	@${FIND} ${WRKSRC} -type f -name '*.orig' -delete
+
 do-test:
-	cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} tests/unittests.py
+	cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m unittest tests/unittests.py
 	cd ${TEST_WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest tests/integrational_tests.py
 
 .include <bsd.port.mk>
diff --git a/misc/py-shell-gpt/files/patch-shell__gpt.egg-info_SOURCES.txt b/misc/py-shell-gpt/files/patch-shell__gpt.egg-info_SOURCES.txt
new file mode 100644
index 000000000000..8afe86591b47
--- /dev/null
+++ b/misc/py-shell-gpt/files/patch-shell__gpt.egg-info_SOURCES.txt
@@ -0,0 +1,10 @@
+--- shell_gpt.egg-info/SOURCES.txt.orig	2023-04-02 05:52:27 UTC
++++ shell_gpt.egg-info/SOURCES.txt
+@@ -15,6 +15,3 @@ shell_gpt.egg-info/dependency_links.txt
+ shell_gpt.egg-info/entry_points.txt
+ shell_gpt.egg-info/requires.txt
+ shell_gpt.egg-info/top_level.txt
+-tests/__init__.py
+-tests/integrational_tests.py
+-tests/unittests.py
+\ No newline at end of file