7739b56
# These are problematic, sometimes they randomly fail or hang
7739b56
%bcond_with xvfb_tests
7739b56
f31f6dd
%global desc \
f31f6dd
The fslpy project is a FSL programming library written in Python. It is used by \
f31f6dd
FSLeyes.
f31f6dd
071afb7
Name:           python-fslpy
1215ca5
Version:        3.8.1
071afb7
Release:        %autorelease
f31f6dd
Summary:        The FSL Python Library
f31f6dd
f31f6dd
f31f6dd
License:        ASL 2.0
071afb7
URL:            https://pypi.python.org/pypi/fslpy
071afb7
Source0:        %{pypi_source fslpy}
f31f6dd
f31f6dd
BuildArch:      noarch
f31f6dd
BuildRequires:  python3-devel
f31f6dd
7268dd5
BuildRequires:  dcm2niix
071afb7
BuildRequires:  %{py3_dist pytest}
071afb7
BuildRequires:  %{py3_dist pytest-cov}
071afb7
%if %{with xvfb_tests}
f31f6dd
BuildRequires:  xorg-x11-server-Xvfb
071afb7
%endif
f31f6dd
f31f6dd
f31f6dd
%description
f31f6dd
%{desc}
f31f6dd
071afb7
%package -n python3-fslpy
f31f6dd
Summary:        %{summary}
69a7f61
071afb7
%description -n python3-fslpy
f31f6dd
%{desc}
f31f6dd
69a7f61
f31f6dd
%prep
071afb7
%autosetup -n fslpy-%{version}
f31f6dd
69a7f61
# For the dep generator to pick up
69a7f61
cat requirements-extra.txt >> requirements.txt
69a7f61
f31f6dd
# remove unneeded shebangs
ae3d83d
find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env python$/ d' {} 2>/dev/null ';'
ae3d83d
# some scripts have the shebang, so we correct these
ae3d83d
find . -type f -name "*.py" -exec sed -i 's/#![  ]*\/usr\/bin\/env python$/#!\/usr\/bin\/python3/' {} 2>/dev/null ';'
f31f6dd
071afb7
%generate_buildrequires
071afb7
%pyproject_buildrequires -r
071afb7
f31f6dd
%build
071afb7
%pyproject_wheel
f31f6dd
f31f6dd
%install
071afb7
%pyproject_install
071afb7
%pyproject_save_files fsl
f31f6dd
a26f2c0
# Remove test packages that are installed in site packages
a26f2c0
rm -rfv %{buildroot}/%{python3_sitelib}/tests/
a26f2c0
a0915c3
071afb7
%check
7739b56
%if %{with xvfb_tests}
f31f6dd
# From https://git.fmrib.ox.ac.uk/fsl/fslpy/blob/master/.ci/test_template.sh
f31f6dd
xvfb-run pytest-3 tests/test_idle.py
f31f6dd
sleep 10
f31f6dd
# Sometimes fails, sometimes passes
69a7f61
xvfb-run pytest-3 tests/test_platform.py || exit 0
7739b56
%endif
f31f6dd
f31f6dd
# Ignore tests that have already been done
f31f6dd
# Ignore immv_imcp because it requires a "nobody" user
f31f6dd
# Ignore tests that require downloading data.
f31f6dd
# Ignore tests requiring trimesh
f31f6dd
# Ignore test using dcm2niix
a6e6b92
# Ignore intermittently failing test: https://github.com/pauldmccarthy/fslpy/issues/10
a6e6b92
# Ignore submit tests
a6e6b92
%{pytest} tests  -m "not longtest and not test_submit" \
a0915c3
  --ignore=tests/test_idle.py --ignore=tests/test_platform.py \
a0915c3
  --ignore=tests/test_immv_imcp.py --ignore=tests/test_atlases.py \
a0915c3
  --ignore=tests/test_atlases_query.py \
a0915c3
  --ignore=tests/test_scripts/test_atlasq_list_summary.py \
a0915c3
  --ignore=tests/test_scripts/test_atlasq_ohi.py \
a0915c3
  --ignore=tests/test_scripts/test_atlasq_query.py --ignore=tests/test_callfsl.py \
a0915c3
  --ignore=tests/test_mesh.py --ignore=tests/test_dicom.py \
a0915c3
  --ignore=tests/test_parse_data.py \
a0915c3
  --ignore=tests/test_scripts/test_fsl_apply_x5.py
a0915c3
071afb7
%files -n python3-fslpy -f %{pyproject_files}
f31f6dd
%doc README.rst
f31f6dd
%{_bindir}/atlasq
f31f6dd
%{_bindir}/atlasquery
257130a
%{_bindir}/fsl_apply_x5
f31f6dd
%{_bindir}/fsl_ents
257130a
%{_bindir}/fsl_convert_x5
f31f6dd
%{_bindir}/imcp
f31f6dd
%{_bindir}/imglob
f31f6dd
%{_bindir}/immv
69a7f61
%{_bindir}/resample_image
0473c5f
%{_bindir}/Text2Vest
0473c5f
%{_bindir}/Vest2Text
0473c5f
%{_bindir}/fsl_abspath
0473c5f
%{_bindir}/imln
0473c5f
%{_bindir}/imrm
0473c5f
%{_bindir}/imtest
0473c5f
%{_bindir}/remove_ext
f31f6dd
f31f6dd
%changelog
071afb7
%autochangelog