Blob Blame History Raw
%if 0%{?fedora} >= 30
# disabled by default
%bcond_with py2
%else
%bcond_without py2
%endif

# The test require internet to download data and so cannot be run in koji
# Confirmed all tests pass in mock with network access:
# mock -r fedora-rawhide-x86_64 rebuild ./python-mne-bids-0.1-2.fc29.src.rpm
# --enable-network --rpmbuild-opts="--with tests"
# Test disable
%bcond_with tests

%global pypi_name mne-bids

%global desc %{expand: \
This is a repository for creating BIDS compatible data-sets with MNE.
https://mne-tools.github.io/mne-bids/index.html}

Name:           python-%{pypi_name}
Version:        0.3.1
Release:        1%{?dist}

Summary:        Experimental code for BIDS using MNE
License:        BSD
URL:            https://github.com/mne-tools/mne-bids
Source0:        %{url}/archive/v%{version}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

%{?python_enable_dependency_generator}

%description
%{desc}

%if %{with py2}
%package -n python2-%{pypi_name}
Summary:        %{summary}

BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-numpy
BuildRequires:  python2-pandas
BuildRequires:  python2-six
BuildRequires:  python2-scipy
BuildRequires:  python2-nose
BuildRequires:  python2-pytest-shutil
BuildRequires:  python2-matplotlib
BuildRequires:  python2-mne

Requires:  python2-mne
Requires:  python2-numpy
Requires:  python2-pandas
Requires:  python2-six
Requires:  python2-nose
Requires:  python2-scipy
Requires:  python2-pytest-shutil
Requires:  python2-matplotlib

%{?python_provide:%python_provide python2-%{pypi_name}}

%description -n python2-%{pypi_name}
%{desc}
%endif

%package -n python3-%{pypi_name}
Summary:        %{summary}

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-numpy
BuildRequires:  python3-pandas
BuildRequires:  python3-six
BuildRequires:  python3-nose
BuildRequires:  python3-scipy
BuildRequires:  python3-pytest-shutil
BuildRequires:  python3-matplotlib
BuildRequires:  python3-mne

Requires:  python3-mne
Requires:  python3-numpy
Requires:  python3-pandas
Requires:  python3-six
Requires:  python3-nose
Requires:  python3-scipy
Requires:  python3-pytest-shutil
Requires:  python3-matplotlib

%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-%{pypi_name}
%{desc}

%prep
%autosetup -n %{pypi_name}-%{version}
rm -rf %{pypi_name}.egg-info

sed -i 's/mne.externals.six/six/' mne_bids/utils.py

# remove she-bang lines in .py files.
find * -type f -name "*.py" -exec sed -i '/^#![ ]*\/usr\/bin\/.*$/ d' {} 2>/dev/null ';'

%build
%py3_build
%if %{with py2}
%py2_build
%endif

%install
%if %{with py2}
%py2_install
rm -rf %{buildroot}%{_bindir}/*
%endif
%py3_install

%check
%if %{with tests}
%if %{with py2}
export PYTHONPATH=$RPM_BUILD_ROOT/%{python2_sitelib}
pytest-%{python2_version} mne_bids
%endif

export PYTHONPATH=$RPM_BUILD_ROOT/%{python3_sitelib}
pytest-%{python3_version} mne_bids
%endif

# Run test require internet
# Example:
# mock -r fedora-rawhide-x86_64 rebuild ./python-mne-bids-0.1-2.fc29.src.rpm --enable-network --rpmbuild-opts="--with tests"

%if %{with py2}
%files -n python2-%{pypi_name}
%license LICENSE
%doc README.rst examples/README.txt
%{_bindir}/mne_bids
%{python2_sitelib}/mne_bids
%{python2_sitelib}/*-py?.?.egg-info
%endif

%files -n python3-%{pypi_name}
%license LICENSE
%doc README.rst examples/README.txt
%{_bindir}/mne_bids
%{python3_sitelib}/mne_bids
%{python3_sitelib}/*-py?.?.egg-info

%changelog
* Fri Dec 27 2019 Luis Bazan <lbazan@fedoraproject.org> - 0.3.1-1
- New upstream version

* Tue Aug 20 2019 Miro Hrončok <mhroncok@redhat.com> - 0.3-2
- Rebuilt for Python 3.8

* Tue Aug 20 2019 Luis M. Segundo <blackfile@fedoraproject.org> - 0.3-1
- New upstream version

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.2-3
- Rebuilt for Python 3.8

* Mon Apr 29 2019 Luis Bazan <lbazan@fedoraproject.org> - 0.2-2
- Fix typo

* Mon Apr 29 2019 Luis Bazan <lbazan@fedoraproject.org> - 0.2-1
- New upstream version

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Mon Nov 26 2018 Luis Bazan <lbazan@fedoraproject.org> - 0.1-2
- Fix comment 1 in BZ 1652976

* Fri Nov 23 2018 Luis Bazan <lbazan@fedoraproject.org> - 0.1-1
- New upstream