Blob Blame History Raw
%global modname mne

Name:           python-%{modname}
Version:        0.13.1
Release:        3%{?dist}
Summary:        Magnetoencephalography (MEG) and Electroencephalography (EEG) data analysis

# Bundled FieldTrip
# https://github.com/fieldtrip/fieldtrip/blob/master/realtime/src/buffer/python/FieldTrip.py
# Not possible to package because it is matlab package with some plugins

License:        BSD
URL:            http://martinos.org/mne/
Source0:        https://github.com/mne-tools/mne-python/archive/v%{version}/%{name}-%{version}.tar.gz
#Source1:        https://s3.amazonaws.com/mne-python/datasets/MNE-sample-data-processed.tar.gz
BuildArch:      noarch

%description
This package is designed for sensor- and source-space analysis of M-EEG data,
including frequency-domain and time-frequency analyses and non-parametric
statistics.

%package -n python2-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{modname}}
Provides:       bundled(bootstrap)
Provides:       bundled(js-jquery)
Provides:       bundled(js-jquery-ui)
Provides:       bundled(js-d3)
Provides:       bundled(js-mpld3)
Provides:       bundled(python2-FieldTrip)
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-nose
BuildRequires:  python2-numpy
# Test deps
BuildRequires:  python2-scipy
BuildRequires:  python2-matplotlib
BuildRequires:  python2-decorator
BuildRequires:  python2-h5io
BuildRequires:  python2-jdcal
BuildRequires:  python2-six
BuildRequires:  python-tempita
BuildRequires:  python2-scikit-learn
BuildRequires:  python2-patsy
#BuildRequires:  Mayavi # XXX: GUI needed
BuildRequires:  python2-Traits
Requires:       python2-numpy
Requires:       python2-scipy
Requires:       python2-matplotlib
Requires:       python2-decorator
Requires:       python2-h5io
Requires:       python2-jdcal
Requires:       python2-six
Requires:       python-tempita
Recommends:     python2-scikit-learn
Recommends:     python2-pandas
Recommends:     python2-patsy
Recommends:     python2-pillow
Recommends:     python2-h5py
Recommends:     python2-statsmodels
Recommends:     python2-Traits

%description -n python2-%{modname}
This package is designed for sensor- and source-space analysis of M-EEG data,
including frequency-domain and time-frequency analyses and non-parametric
statistics.

Python 2 version.

%package -n python3-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{modname}}
Provides:       bundled(bootstrap)
Provides:       bundled(js-jquery)
Provides:       bundled(js-jquery-ui)
Provides:       bundled(js-d3)
Provides:       bundled(js-mpld3)
Provides:       bundled(python3-FieldTrip)
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-nose
BuildRequires:  python3-numpy
# Test deps
BuildRequires:  python3-scipy
BuildRequires:  python3-matplotlib
BuildRequires:  python3-decorator
BuildRequires:  python3-h5io
BuildRequires:  python3-jdcal
BuildRequires:  python3-six
BuildRequires:  python3-tempita
BuildRequires:  python3-scikit-learn
BuildRequires:  python3-patsy
BuildRequires:  python3-Traits
Requires:       python3-numpy
Requires:       python3-scipy
Requires:       python3-matplotlib
Requires:       python3-decorator
Requires:       python3-h5io
Requires:       python3-jdcal
Requires:       python3-six
Requires:       python3-tempita
Recommends:     python3-scikit-learn
Recommends:     python3-pandas
Recommends:     python3-patsy
Recommends:     python3-pillow
Recommends:     python3-h5py
Recommends:     python3-statsmodels
Recommends:     python3-Traits

%description -n python3-%{modname}
This package is designed for sensor- and source-space analysis of M-EEG data,
including frequency-domain and time-frequency analyses and non-parametric
statistics.

Python 3 version.

%prep
%autosetup -n %{modname}-python-%{version}

pushd %{modname}/externals/
  # Remove bundled six, jdcal, decorator, tempita, h5io
  # Save bundled FieldTrip (can't find upstream)
  rm -rf six.py jdcal.py decorator.py tempita/ h5io/
  echo > __init__.py
  [ $(find -maxdepth 1 -mindepth 1 | grep -v FieldTrip.py | grep -v __init__.py | wc -l) -eq 0 ] || exit 1
popd
# use all six/jdcal/decorator/h5io from system
# fix API change for jdjcal/jcal2jd
find -type f -name '*.py' -exec sed -i \
  -e "s/from mne.externals.six/from six/" \
  -e "s/from \.*externals.six/from six/" \
  -e "s/from mne.externals import six/import six/" \
  -e "s/from \.*externals import six/import six/" \
  -e "s/from \.*externals.jdcal/from jdcal/" \
  -e "s/from \.*externals.decorator/from decorator/" \
  -e "s/from \.*externals.h5io/from h5io/" \
  -e "s/from \.*externals.tempita/from tempita/" \
  -e "s/jd2jcal(\(.*\))/jd2jcal(\1, 0)[:-1]/" \
  -e "s/(jcal2jd(\(.*\)))/(jcal2jd(\1)[-1])/" \
  {} ';'
sed -i -e "/mne\.externals\.[^']*/d" setup.py

sed -i -e '1{\@^#!/usr/bin/env python@d}' %{modname}/commands/*.py
sed -i -e '1s|^#!.*$|#!%{__python3}|' bin/%{modname}

#cp -p %{SOURCE1} .
#python -c "import mne; mne.datasets.sample.data_path(verbose=True, download=False)"

%build
%py2_build
%py3_build

%install
%py2_install
%py3_install

%check
export MNE_SKIP_TESTING_DATASET_TESTS=true
export MNE_SKIP_NETWORK_TESTS=1
# In koji it is timing out
%global to_skip test_spectral_connectivity
nosetests-%{python2_version} -v %{?to_skip:-e %{to_skip}} || :
nosetests-%{python3_version} -v %{?to_skip:-e %{to_skip}} || :

%files -n python2-%{modname}
%license LICENSE.txt
%doc README.rst examples AUTHORS.rst
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{modname}-*.egg-info/

%files -n python3-%{modname}
%license LICENSE.txt
%doc README.rst examples AUTHORS.rst
%{_bindir}/%{modname}
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-*.egg-info/

%changelog
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.13.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 0.13.1-2
- Rebuild for Python 3.6

* Tue Nov 29 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.13.1-1
- Update to 0.13.1

* Mon Sep 26 2016 Dominik Mierzejewski <rpm@greysector.net> - 0.10-8
- rebuilt for matplotlib-2.0.0

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10-7
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.10-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sun Nov 29 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.10-5
- Rebuild for fixed scipy

* Wed Nov 11 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.10-4
- Fix non-executable-script

* Mon Nov 09 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.10-3
- Fix unbundling jdcal

* Sun Nov 08 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.10-2
- /usr/bin/mne uses python3
- fix dependencies around Traits (add py3 version)
- unbundle jdcal/six/decorator/tempita/h5io
- add Provides: bundled(pythonX-FieldTrip)
- More better Summary

* Fri Oct 30 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.10-1
- Initial package