aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo-Chuan Hsieh <sunpoet@FreeBSD.org>2023-04-09 13:30:57 +0000
committerPo-Chuan Hsieh <sunpoet@FreeBSD.org>2023-04-09 13:36:44 +0000
commit69512db5c3b8a4dbeca228a0c5012e35b86a5391 (patch)
tree699ddbb764a64aee3551201785ec5e3d4101e1c5
parent2973ab578ca7c55b3edbca4fcf5e1dcd1282427d (diff)
downloadports-69512db5c3b8a4dbeca228a0c5012e35b86a5391.tar.gz
ports-69512db5c3b8a4dbeca228a0c5012e35b86a5391.zip
devel/py-argcomplete: Convert to USE_PYTHON=unittest
-rw-r--r--devel/py-argcomplete/Makefile17
-rw-r--r--devel/py-argcomplete/files/patch-test-test.py34
2 files changed, 43 insertions, 8 deletions
diff --git a/devel/py-argcomplete/Makefile b/devel/py-argcomplete/Makefile
index 5543c553a98c..acaae153f168 100644
--- a/devel/py-argcomplete/Makefile
+++ b/devel/py-argcomplete/Makefile
@@ -11,21 +11,22 @@ WWW= https://github.com/kislyuk/argcomplete
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE.rst
-TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}coverage>=0:devel/py-coverage@${PY_FLAVOR} \
+TEST_DEPENDS= bash:shells/bash \
+ ${PYTHON_PKGNAMEPREFIX}coverage>=0:devel/py-coverage@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}flake8>=0:devel/py-flake8@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}mypy>=0:devel/py-mypy@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pexpect>=0:misc/py-pexpect@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
-USES= python:3.6+
-USE_PYTHON= autoplist concurrent distutils
+USES= python:3.8+ shebangfix
+USE_PYTHON= autoplist concurrent distutils unittest
NO_ARCH= yes
-.include <bsd.port.pre.mk>
+SHEBANG_FILES= scripts/* \
+ test/prog
-.if ${PYTHON_REL} < 30800
-RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}importlib-metadata>=0.23<6:devel/py-importlib-metadata@${PY_FLAVOR}
-.endif
+post-patch:
+ @${REINPLACE_CMD} -e 's|%%PYTHON_CMD%%|${PYTHON_CMD}|' ${WRKSRC}/test/test.py
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/devel/py-argcomplete/files/patch-test-test.py b/devel/py-argcomplete/files/patch-test-test.py
new file mode 100644
index 000000000000..b6644ccd8dc0
--- /dev/null
+++ b/devel/py-argcomplete/files/patch-test-test.py
@@ -0,0 +1,34 @@
+--- test/test.py.orig 2023-03-17 17:34:51 UTC
++++ test/test.py
+@@ -1247,11 +1247,11 @@ class TestBashGlobal(TestBash):
+
+ def test_python_completion(self):
+ self.sh.run_command("cd " + TEST_DIR)
+- self.assertEqual(self.sh.run_command("python3 ./prog basic f\t"), "foo\r\n")
++ self.assertEqual(self.sh.run_command("%%PYTHON_CMD%% ./prog basic f\t"), "foo\r\n")
+
+ def test_python_filename_completion(self):
+ self.sh.run_command("cd " + TEST_DIR)
+- self.assertEqual(self.sh.run_command("python3 ./pro\tbasic f\t"), "foo\r\n")
++ self.assertEqual(self.sh.run_command("%%PYTHON_CMD%% ./pro\tbasic f\t"), "foo\r\n")
+
+ def test_python_not_executable(self):
+ """Test completing a script that cannot be run directly."""
+@@ -1263,7 +1263,7 @@ class TestBashGlobal(TestBash):
+ # Ensure prog is no longer able to be run as "./prog".
+ self.assertIn("<<126>>", self.sh.run_command('./prog; echo "<<$?>>"'))
+ # Ensure completion still functions when run via python.
+- self.assertEqual(self.sh.run_command("python3 ./prog basic f\t"), "foo\r\n")
++ self.assertEqual(self.sh.run_command("%%PYTHON_CMD%% ./prog basic f\t"), "foo\r\n")
+
+ def test_python_module(self):
+ """Test completing a module run with python -m."""
+@@ -1273,7 +1273,7 @@ class TestBashGlobal(TestBash):
+ open("package/__init__.py", "w").close()
+ shutil.copy(prog, "package/prog.py")
+ self.sh.run_command("cd " + os.getcwd())
+- self.assertEqual(self.sh.run_command("python3 -m package.prog basic f\t"), "foo\r\n")
++ self.assertEqual(self.sh.run_command("%%PYTHON_CMD%% -m package.prog basic f\t"), "foo\r\n")
+
+ def _test_console_script(self, package=False, wheel=False):
+ with TempDir(prefix="test_dir_py", dir="."):