music / rpms / python-dipy

Forked from rpms/python-dipy 2 years ago
Clone

Blame python-dipy.spec

4618ef8
# No py3 since it depends on nibabel which we only provide for py3
4618ef8
%global srcname dipy
4618ef8
4618ef8
%global desc %{expand: \
4618ef8
DIPY is a python toolbox for analysis of MR diffusion imaging.
4618ef8
DIPY is for research only; please do not use results from DIPY for clinical
4618ef8
decisions.
4618ef8
4618ef8
Current information can always be found from the DIPY website - http://dipy.org}
4618ef8
4618ef8
%global commit 756b519f13437c484477b17088549000ab2dfa5a
4618ef8
%global shortcommit %(c=%{commit}; echo ${c:0:7})
4618ef8
4618ef8
# Full documentation downloads 100+MB of data, so we'd rather users look at the
4618ef8
# upstream documentation
4618ef8
%bcond_without docs
4618ef8
4618ef8
# Fail because of xvfb related errors
4618ef8
%bcond_with tests
4618ef8
4618ef8
%{?python_enable_dependency_generator}
4618ef8
4618ef8
Name:           python-%{srcname}
4618ef8
Version:        0.15.0
4618ef8
Release:        0.1.git%{shortcommit}%{?dist}
4618ef8
Summary:        Diffusion MRI utilities in python
4618ef8
4618ef8
License:        BSD
4618ef8
URL:            http://nipy.org/dipy/
4618ef8
Source0:        https://github.com/nipy/dipy/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
4618ef8
4618ef8
%description
4618ef8
%{desc}
4618ef8
4618ef8
%package -n python3-%{srcname}
4618ef8
Summary:        %{summary}
4618ef8
BuildRequires:      python3-devel
4618ef8
BuildRequires:      gcc
4618ef8
BuildRequires:      %{py3_dist setuptools}
4618ef8
BuildRequires:      %{py3_dist nose}
4618ef8
BuildRequires:      %{py3_dist Cython}
4618ef8
BuildRequires:      %{py3_dist numpy}
4618ef8
BuildRequires:      %{py3_dist scipy}
4618ef8
BuildRequires:      %{py3_dist nibabel}
4618ef8
BuildRequires:      %{py3_dist h5py}
4618ef8
BuildRequires:      %{py3_dist matplotlib}
4618ef8
BuildRequires:      python3-vtk
4618ef8
%if %{with tests}
4618ef8
BuildRequires:      %{py3_dist xvfbwrapper}
4618ef8
BuildRequires:      xorg-x11-server-Xvfb
4618ef8
%endif
4618ef8
4618ef8
# Required for some modules but not in Fedora yet
4618ef8
# BuildRequires:      %%{py3_dist cvxpy}
4618ef8
4618ef8
Suggests:           %{py3_dist ipython}
4618ef8
%{?python_provide:%python_provide python3-%{srcname}}
4618ef8
4618ef8
%description -n python3-%{srcname}
4618ef8
%{desc}
4618ef8
4618ef8
%package doc
4618ef8
BuildArch:      noarch
4618ef8
Summary:        %{summary}
4618ef8
4618ef8
%description doc
4618ef8
Documentation for %{name}.
4618ef8
4618ef8
4618ef8
%prep
4618ef8
%autosetup -n %{srcname}-%{commit}
4618ef8
export TEST_WITH_XVFB=true
4618ef8
# clean it all up (from the Makefile)
4618ef8
find . -name "*.so" -print -delete
4618ef8
find . -name "*.pyd" -print -delete
4618ef8
find . -name "*.c" -print -delete
4618ef8
find . -name "*.html" -print -delete
4618ef8
rm -rf build
4618ef8
rm -rf docs/_build
4618ef8
rm -rf docs/dist
4618ef8
rm -rf dipy/dipy.egg-info
4618ef8
4618ef8
# Correct interpreter for these---used in building docs and so on
4618ef8
sed -i 's/#!\/usr\/bin\/env python/#!\/usr\/bin\/python3/' doc/tools/docgen_cmd.py
4618ef8
sed -i 's/#!\/usr\/bin\/env python/#!\/usr\/bin\/python3/' doc/tools/build_modref_templates.py
4618ef8
find tools/ -name "*.py" -exec sed -i 's/#!\/usr\/bin\/env python/#!\/usr\/bin\/python3/' '{}' \;
4618ef8
4618ef8
# Other shebangs and permission fixes
4618ef8
for f in "dipy/boots/resampling.py" "dipy/reconst/benchmarks/bench_csd.py" "dipy/reconst/dki.py" "dipy/reconst/dti.py"  "dipy/workflows/mask.py" "dipy/workflows/tracking.py" "dipy/reconst/dki_micro.py"
4618ef8
do
4618ef8
    chmod -x "$f"
4618ef8
    sed -i '/^#!\/usr\/bin\/env python/ d' "$f"
4618ef8
    sed -i '/^#!\/usr\/bin\/python/ d' "$f"
4618ef8
done
4618ef8
4618ef8
%build
4618ef8
export TEST_WITH_XVFB=true
4618ef8
%py3_build
4618ef8
4618ef8
%if %{with docs}
4618ef8
pushd doc
4618ef8
    export PYTHONPATH=../build/
4618ef8
    make SPHINXBUILD=sphinx-build-3 PYTHON=%{__python3} html
4618ef8
    rm -rf _build/html/.doctrees
4618ef8
    rm -rf _build/html/.buildinfo
4618ef8
popd
4618ef8
%endif
4618ef8
4618ef8
%install
4618ef8
%py3_install
4618ef8
4618ef8
%check
4618ef8
export TEST_WITH_XVFB=True
4618ef8
%if %{with tests}
4618ef8
%{__python3} -c 'import dipy; dipy.test()'
4618ef8
%endif
4618ef8
4618ef8
%files -n python3-%{srcname}
4618ef8
%license LICENSE
4618ef8
%doc README.rst Changelog AUTHOR
4618ef8
%{_bindir}/dipy_fit_csa
4618ef8
%{_bindir}/dipy_fit_csd
4618ef8
%{_bindir}/dipy_fit_dki
4618ef8
%{_bindir}/dipy_fit_dti
4618ef8
%{_bindir}/dipy_fit_mapmri
4618ef8
%{_bindir}/dipy_info
4618ef8
%{_bindir}/dipy_labelsbundles
4618ef8
%{_bindir}/dipy_mask
4618ef8
%{_bindir}/dipy_median_otsu
4618ef8
%{_bindir}/dipy_nlmeans
4618ef8
%{_bindir}/dipy_recobundles
4618ef8
%{_bindir}/dipy_reslice
4618ef8
%{_bindir}/dipy_slr
4618ef8
%{_bindir}/dipy_track_det
4618ef8
%{python3_sitearch}/%{srcname}
4618ef8
%{python3_sitearch}/%{srcname}-%{version}dev-py3.?.egg-info
4618ef8
4618ef8
%files doc
4618ef8
%license LICENSE
4618ef8
# Installed by package
4618ef8
%{_docdir}/%{srcname}/examples
4618ef8
%if %{with docs}
4618ef8
%doc doc/_build/html
4618ef8
%endif
4618ef8
4618ef8
%changelog
4618ef8
* Thu Nov 15 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.15.0-0.1.git756b519
4618ef8
- Initial rpm build