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