diff --git a/science/py-nibabel/Makefile b/science/py-nibabel/Makefile index 3fbc19195c17..90dbc234add4 100644 --- a/science/py-nibabel/Makefile +++ b/science/py-nibabel/Makefile @@ -1,31 +1,32 @@ PORTNAME= nibabel DISTVERSION= 5.2.0 +PORTREVISION= 1 CATEGORIES= science python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= yuri@FreeBSD.org COMMENT= Read/write some common neuroimaging file formats WWW= https://nipy.org/nibabel/ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hatch-vcs>0:devel/py-hatch-vcs@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}hatchling>0:devel/py-hatchling@${PY_FLAVOR} RUN_DEPENDS= ${PYNUMPY} \ ${PYTHON_PKGNAMEPREFIX}packaging>=17:devel/py-packaging@${PY_FLAVOR} USES= python:3.9+ USE_PYTHON= pep517 concurrent autoplist pytest # 1 tests fails, see https://github.com/nipy/nibabel/issues/1285 NO_ARCH= yes TEST_ENV= ${MAKE_ENV} PATH=${STAGEDIR}${PREFIX}/bin post-install: @${REINPLACE_CMD} -i '' -e 's|#!python|#!${PYTHON_CMD}|' \ ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/nibabel/cmdline/diff.py \ ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/nibabel/cmdline/ls.py .include diff --git a/science/py-nibabel/files/patch-fix-tests b/science/py-nibabel/files/patch-fix-tests new file mode 100644 index 000000000000..1a3db66036b6 --- /dev/null +++ b/science/py-nibabel/files/patch-fix-tests @@ -0,0 +1,37 @@ +- fix for the failing test from https://github.com/nipy/nibabel/issues/1285#issuecomment-1852612513 + +diff --git nibabel/pkg_info.py nibabel/pkg_info.py +index 7e816939..7232806a 100644 +--- nibabel/pkg_info.py ++++ nibabel/pkg_info.py +@@ -1,6 +1,7 @@ + from __future__ import annotations + + import sys ++from contextlib import suppress + from subprocess import run + + from packaging.version import Version +@@ -102,14 +103,16 @@ def pkg_commit_hash(pkg_path: str | None = None) -> tuple[str, str]: + ver = Version(__version__) + if ver.local is not None and ver.local.startswith('g'): + return 'installation', ver.local[1:8] +- # maybe we are in a repository +- proc = run( +- ('git', 'rev-parse', '--short', 'HEAD'), +- capture_output=True, +- cwd=pkg_path, +- ) +- if proc.stdout: +- return 'repository', proc.stdout.decode().strip() ++ # maybe we are in a repository, but consider that we may not have git ++ with suppress(FileNotFoundError): ++ proc = run( ++ ('git', 'rev-parse', '--short', 'HEAD'), ++ capture_output=True, ++ cwd=pkg_path, ++ ) ++ if proc.stdout: ++ return 'repository', proc.stdout.decode().strip() ++ + return '(none found)', ''