Blob Blame History Raw
%global pypi_name pynwb

%global desc %{expand:
PyNWB is a Python package for working with NWB files. It provides a high-level
API for efficiently working with Neurodata stored in the NWB format.
https://pynwb.readthedocs.io/en/latest/}

Name:           python-%{pypi_name}
Version:        2.0.0
Release:        %autorelease
Summary:        PyNWB is a Python package for working with NWB files
License:        BSD
URL:            https://github.com/NeurodataWithoutBorders/pynwb
# Use the pypi tar because GitHub tar does not include the required git-submodules
Source0:        %{pypi_source}
BuildArch:      noarch

%{?python_enable_dependency_generator}

%description %{desc}

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

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-certifi
BuildRequires:  python3-chardet
BuildRequires:  python3-h5py
BuildRequires:  python3-idna
BuildRequires:  python3-numpy
BuildRequires:  python3-dateutil
BuildRequires:  python3-requests
BuildRequires:  python3-ruamel-yaml
BuildRequires:  python3-six
BuildRequires:  python3-urllib3
BUildRequires:  python3-pandas
BUildRequires:  python3-pytest
BuildRequires:  python3-hdmf

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

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

# test_validate uses python instead of python3
sed -i 's|python|python3|' tests/validation/test_validate.py

%build
%py3_build

%install
%py3_install

%check
# do not run ros tests (--ros3)
export PYTHONPATH=".:%{buildroot}/%{python3_sitelib}:%{buildroot}/%{python3_sitearch}" 
# run unit tests using pytest so that we can exclude tests that fail etc., which is hard to do with the test.py script
# Disable test which fails on s390x on F34
%if 0%{?fedora} < 35 && "%{_host_cpu}" == "s390x" || "%{_host_cpu}" == "ppc64le"
%{pytest} tests/unit -k "not test_icephys_filtering_roundtrip"
%else
%{pytest} tests/unit
%endif
%{__python3} test.py --example --validation --integration --backwards

%files -n python3-%{pypi_name}
%license license.txt
%doc README.rst
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-*.egg-info

%changelog
%autochangelog