git: f37a5323291b - main - sysutils/py-ansible-lint: fix the `make test` target

From: Matthew Seaman <matthew_at_FreeBSD.org>
Date: Thu, 11 May 2023 07:21:53 UTC
The branch main has been updated by matthew:

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

commit f37a5323291b14ad970cac08c9cf5a0a216c40c7
Author:     Matthew Seaman <matthew@FreeBSD.org>
AuthorDate: 2023-05-11 07:16:12 +0000
Commit:     Matthew Seaman <matthew@FreeBSD.org>
CommitDate: 2023-05-11 07:21:48 +0000

    sysutils/py-ansible-lint: fix the `make test` target
    
    Enable the test suite to actually run.
    
    Currently this results in: 12 failed, 782 passed in 915.04s (0:15:15)
---
 sysutils/py-ansible-lint/Makefile                  | 29 +++++++++++-----------
 sysutils/py-ansible-lint/files/patch-conftest.py   | 11 ++++++++
 .../files/patch-tools_install-reqs.sh              |  8 ++++++
 3 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/sysutils/py-ansible-lint/Makefile b/sysutils/py-ansible-lint/Makefile
index 14114787f245..90fe12fd0149 100644
--- a/sysutils/py-ansible-lint/Makefile
+++ b/sysutils/py-ansible-lint/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	ansible-lint
 PORTVERSION=	6.16.0
+PORTREVISION=	1
 CATEGORIES=	sysutils python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -22,29 +23,29 @@ RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}ansible-core>=2.12.0:sysutils/py-ansible-cor
 		${PYTHON_PKGNAMEPREFIX}wcmatch>=8.1.2:textproc/py-wcmatch@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}yaml>=5.4.1:devel/py-yaml@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}yamllint>=1.30.0:devel/py-yamllint@${PY_FLAVOR}
-
 BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}setuptools>=63.0.0:devel/py-setuptools@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}setuptools_scm7>=7.0.5:devel/py-setuptools_scm7@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
-
-TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}coverage_enable_subprocess>0:devel/py-coverage_enable_subprocess@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}coverage>-6.4.4:devel/py-coverage@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}mypy>0:devel/py-mypy@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}netaddr>0:net/py-netaddr@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}psutil>0:sysutils/py-psutil@${PY_FLAVOR} \
-		pylint${PYTHON_PKGNAMESUFFIX}>0:devel/pylint@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}pytest>7.2.2:devel/py-pytest@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}pytest-mock>0:devel/py-pytest-mock@${PY_FLAVOR} \
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}coverage_enable_subprocess>=0:devel/py-coverage_enable_subprocess@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}coverage>=6.4.4:devel/py-coverage@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}jmespath>=0:devel/py-jmespath@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}mypy>=0:devel/py-mypy@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}netaddr>=0:net/py-netaddr@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}psutil>=0:sysutils/py-psutil@${PY_FLAVOR} \
+		pylint${PYTHON_PKGNAMESUFFIX}>=0:devel/pylint@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest>=7.2.2:devel/py-pytest@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-mock>=0:devel/py-pytest-mock@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pytest-plus>=0.2:devel/py-pytest-plus@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pytest-xdist>=2.1.0:devel/py-pytest-xdist@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}ruamel.yaml.clib>0:devel/py-ruamel.yaml.clib${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}spdx-tools>0.7.1:misc/py-spdx-tools@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}types-jsonschema>0:devel/py-types-jsonschema@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}types-PyYAML>0:devel/py-types-PyYAML@${PY_FLAVOR}
+		${PYTHON_PKGNAMEPREFIX}ruamel.yaml.clib>=0:devel/py-ruamel.yaml.clib@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}spdx-tools>=0.7.1:misc/py-spdx-tools@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}types-jsonschema>=0:devel/py-types-jsonschema@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}types-PyYAML>=0:devel/py-types-PyYAML@${PY_FLAVOR}
 
 USES=		python:3.9+
 USE_PYTHON=	autoplist concurrent pep517 pytest
 
+TEST_ENV=	LC_ALL=C.UTF-8 PYTHONPATH=${WRKSRC}/src
 NO_ARCH=	yes
 
 .include <bsd.port.mk>
diff --git a/sysutils/py-ansible-lint/files/patch-conftest.py b/sysutils/py-ansible-lint/files/patch-conftest.py
new file mode 100644
index 000000000000..2a26b6a13fab
--- /dev/null
+++ b/sysutils/py-ansible-lint/files/patch-conftest.py
@@ -0,0 +1,11 @@
+--- conftest.py.orig	2023-05-09 16:16:59 UTC
++++ conftest.py
+@@ -44,7 +44,7 @@ if not HAS_LIBYAML:
+     # While presence of libyaml is not required for runtime, we keep this error
+     # fatal here in order to be sure that we spot libyaml errors during testing.
+     arch = platform.machine()
+-    if arch not in ("arm64", "x86_64"):
++    if arch not in ("arm64", "amd64"):
+         warnings.warn(
+             f"This architecture ({arch}) is not supported by libyaml, performance will be degraded.",
+             category=pytest.PytestWarning,
diff --git a/sysutils/py-ansible-lint/files/patch-tools_install-reqs.sh b/sysutils/py-ansible-lint/files/patch-tools_install-reqs.sh
new file mode 100644
index 000000000000..defdd608c79a
--- /dev/null
+++ b/sysutils/py-ansible-lint/files/patch-tools_install-reqs.sh
@@ -0,0 +1,8 @@
+--- tools/install-reqs.sh.orig	2023-05-10 11:30:52 UTC
++++ tools/install-reqs.sh
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/usr/bin/env bash
+ set -euo pipefail
+ pushd examples/playbooks/collections >/dev/null
+ MISSING=()