## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 9;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%bcond_without tests

Name:           python-exdir
Version:        0.5.0.1
Release:        %{autorelease}
Summary:        Directory structure standard for experimental pipelines

%global forgeurl  https://github.com/CINPLA/exdir
%global tag v%{version}
%forgemeta

# SPDX
License:        MIT
URL:            %{forgeurl}
Source:         %{forgesource}
# Apply patch fixing `NameError`
# https://github.com/CINPLA/exdir/issues/180
Patch:          %{forgeurl}/pull/185.patch
# Patch for NumPy 2.x
# https://github.com/CINPLA/exdir/pull/188
Patch:          %{forgeurl}/commit/81e147c924335c363718d9f8d0374c56d289835a.patch

BuildArch:      noarch

%global _description %{expand:
Experimental Directory Structure (exdir) is a proposed, open specification for
experimental pipelines. Exdir is currently a prototype published to invite
researchers to give feedback on the standard.

Exdir is an hierarchical format based on open standards. It is inspired by
already existing formats, such as HDF5 and NumPy, and attempts to solve some of
the problems assosciated with these while retaining their benefits. The
development of exdir owes a great deal to the efforts of others to standardize
data formats in science in general and neuroscience in particular, among them
the Klusta Kwik Team and Neurodata Without Borders.}

%description %_description

%package -n python3-exdir
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  git-core

# %%dir %%{_sysconfdir}/jupyter
# %%dir %%{_sysconfdir}/jupyter/jupyter_notebook_config.d
# %%dir %%{_sysconfdir}/jupyter/nbconfig
# %%dir %%{_sysconfdir}/jupyter/nbconfig/notebook.d
# %%dir %%{_datadir}/jupyter
# %%dir %%{_datadir}/jupyter/nbextensions
Requires:       python-jupyter-filesystem
# for the notebooks
Recommends:     %{py3_dist notebook}

%description -n python3-exdir %_description

%package doc
Summary:        Documentation for %{name}
BuildRequires:  make
BuildRequires:  %{py3_dist sphinx}
# The included copy is a fork and therefore can’t be unbundled. The
# original can be found at
# https://code.iamkate.com/javascript/collapsible-lists/ and was never
# versioned nor committed to version control.
Provides:       bundled(js-collapsible-lists)

%description doc
This package provides documentation for %{name}.

%prep
%autosetup -p1 -n exdir-%{version} -S git
# Remove 3rdparty directory
# Use git for removal, so Versioneer is not marking version as dirty
git rm -r 3rdparty

# Unpin ruamel-yaml
sed -r -i 's/(ruamel.yaml)[<=]=/\1>=/' setup.py
git add setup.py

# Versioneer, you are a pain in the bottocks!
# Into submission wrangle you, I will!
python3 versioneer.py setup
git commit -m 'Changes for Fedora RPM'
git tag v%{version}


%generate_buildrequires
%pyproject_buildrequires %{?with_tests:-r requirements.in}

%build
%pyproject_wheel

# Sometimes needed so sphinx can import the module
PYTHONPATH=".:.." make -C docs SPHINXOPTS=%{?_smp_mflags} html
rm -rf docs/_build/html/{.doctrees,.buildinfo} -vf

%install
%pyproject_install
%pyproject_save_files -l exdir

# Move jupyter bits to correct location
mkdir -p -m 0755 %{buildroot}%{_sysconfdir}
mv -v %{buildroot}%{_prefix}%{_sysconfdir}/jupyter %{buildroot}%{_sysconfdir}/jupyter

%check
%if %{with tests}
%pytest -v
%endif

%files -n python3-exdir -f %{pyproject_files}
%doc README.md
%{_datadir}/jupyter/nbextensions/exdir
%config(noreplace) %{_sysconfdir}/jupyter/jupyter_notebook_config.d/exdir.json
%config(noreplace) %{_sysconfdir}/jupyter/nbconfig/notebook.d/exdir.json

%files doc
%license LICENSE
%doc docs/_build/html examples

%changelog
## START: Generated by rpmautospec
* Wed Dec 25 2024 Sandro <devel@penguinpee.nl> - 0.5.0.1-9
- Apply patch for NumPy 2.x

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Sat Jun 15 2024 Sandro <devel@penguinpee.nl> - 0.5.0.1-7
- Apply patch fixing tests for Python 3.13 (RHBZ#2266601)

* Sat Jun 08 2024 Python Maint <python-maint@redhat.com> - 0.5.0.1-6
- Rebuilt for Python 3.13

* Wed Mar 13 2024 Sandro <devel@penguinpee.nl> - 0.5.0.1-5
- Fix Packit config

* Wed Feb 21 2024 Sandro <devel@penguinpee.nl> - 0.5.0.1-4
- Add Packit config

* Wed Feb 21 2024 Sandro <devel@penguinpee.nl> - 0.5.0.1-3
- Assert existence of license file

* Wed Feb 21 2024 Sandro <devel@penguinpee.nl> - 0.5.0.1-2
- Migrate to SPDX license (no change)

* Wed Feb 21 2024 Sandro <devel@penguinpee.nl> - 0.5.0.1-1
- Update to 0.5.0.1
- Fixes FTBFS (RHBZ#2261558)
- Unpin `ruamel-yaml`
- Drop patch (merged upstream)
- Wrangle Versioneer into submission once more

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Thu Jul 13 2023 Sandro <devel@penguinpee.nl> - 0.4.2-7
- Fix AttributeError (RHBZ#2220210)

* Wed Jul 12 2023 Python Maint <python-maint@redhat.com> - 0.4.2-6
- Rebuilt for Python 3.12

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 0.4.2-3
- Rebuilt for Python 3.11

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Fri Sep 17 2021 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.4.2-1
- feat: init
## END: Generated by rpmautospec