e5db00d
%bcond_without tests
d0bf068
e5db00d
Name:       python-pybids
e5db00d
Version:    0.15.5
464ef2b
Release:    %autorelease
d0bf068
Summary:    Interface with datasets conforming to BIDS
d0bf068
d6d2624
# The entire source is MIT, except:
d6d2624
#   - The bundled single-file versioneer.py (from python-versioneer), version
d6d2624
#     0.20, is CC0-1.0. While this license is approved for content only, this
d6d2624
#     file falls under an exception
d6d2624
#     (https://gitlab.com/fedora/legal/fedora-license-data/-/issues/91#note_1151947383):
d6d2624
#
d6d2624
#       Existing uses of CC0-1.0 on code files in Fedora packages prior to
d6d2624
#       2022-08-01, and subsequent upstream versions of those files in those
d6d2624
#       packages, continue to be allowed. We encourage Fedora package
d6d2624
#       maintainers to ask upstreams to relicense such files.
d6d2624
#
d6d2624
#     More recent versions of python-versioneer are Unlicense, so this may
d6d2624
#     change if upstream updates the bundled versioneer.py.
d6d2624
#
d6d2624
#     The bundled versioneer.py is not packaged, so we do not treat it as a
d6d2624
#     bundled library; however, the generated _version.py falls under the same
d6d2624
#     license, so CC0-1.0 still appears in the license of the subpackage that
d6d2624
#     contains it.
48369b9
#   - We presume other test datasets (bids/tests/data/*/) are under the overall
48369b9
#     MIT license, unless evidence to the contrary comes to light.
48369b9
#
48369b9
# In the python3-pybids+test subpackage:
48369b9
d6d2624
#   - The following test datasets (content) are PDDL-1.0:
d6d2624
#       bids/tests/data/ds005/
d6d2624
#       bids/tests/data/ds005_conflict/
d6d2624
#
d6d2624
# We refrain from including the bids-examples/ submodule
d6d2624
# (https://github.com/bids-standard/bids-examples/) because many of the
d6d2624
# datasets therein have unspecified licenses. A small number of tests are
d6d2624
# skipped as a result.
48369b9
License:        MIT AND CC0-1.0
d6d2624
URL:            https://bids.neuroimaging.io
d6d2624
Source0:        https://github.com/bids-standard/pybids/archive/%{version}/pybids-%{version}.tar.gz
e5db00d
3f008f7
# FIX: Adapt to SQLAlchemy 1.4+
3f008f7
# https://github.com/bids-standard/pybids/pull/985
3f008f7
# Backported to 0.15.5.
3f008f7
Patch:          pybids-0.15.5-sqlalchemy-1.4.patch
3f008f7
d0bf068
BuildArch:      noarch
d0bf068
e2d5335
# tests fail on 32 bit systems, plus:
e2d5335
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
3a50eb4
ExcludeArch:    %{ix86}
3a50eb4
578f6ee
BuildRequires:  hardlink
578f6ee
a1b06ae
%global _description %{expand:
a1b06ae
PyBIDS is a Python library to centralize interactions with datasets conforming
a1b06ae
BIDS (Brain Imaging Data Structure) format. For more information about BIDS
a1b06ae
visit https://bids.neuroimaging.io.}
a1b06ae
1e1a6ca
%description %{_description}
d0bf068
b18b321
cf0ab5b
%pyproject_extras_subpkg -n python3-pybids plotting
cf0ab5b
cf0ab5b
e5db00d
%package -n python3-pybids
d0bf068
Summary:    Interface with datasets conforming to BIDS
8730db8
d0bf068
BuildRequires:  python3-devel
8730db8
32f60e7
Obsoletes:      python-pybids-doc < 0.15.5-13
32f60e7
e5db00d
# unbundled
e5db00d
BuildRequires:  %{py3_dist inflect}
e5db00d
Requires:  %{py3_dist inflect}
e5db00d
e5db00d
%description -n python3-pybids %{_description}
d0bf068
b18b321
48369b9
%package -n python3-pybids+test
48369b9
%global test_summary Tests and test extras for PyBIDS
48369b9
Summary:        %{test_summary}
48369b9
48369b9
# See comment above base package License tag for licensing breakdown.
48369b9
#
48369b9
# The CC0-1.0 file _version.py does not appear in this subpackage.
48369b9
License:        MIT AND PDDL-1.0
48369b9
48369b9
Requires:       python3-pybids = %{version}-%{release}
48369b9
48369b9
%global test_description %{expand: \
48369b9
These are the tests for python3-pybids. This package:
48369b9
48369b9
• Provides the “bids.tests” package
48369b9
• Makes sure the “test” extra dependencies are installed}
48369b9
48369b9
%description -n python3-pybids+test %{test_description}
48369b9
48369b9
48369b9
# Upstream duplicates all extras with singular and plural names.
48369b9
# Based loosely on: rpm -E '%%pyproject_extras_subpkg -n python3-pybids tests'
48369b9
%package -n python3-pybids+tests
48369b9
Summary:        %{test_summary}
48369b9
48369b9
# This has no files of its own, so none of the non-MIT licenses apply.
48369b9
License:        MIT
48369b9
48369b9
# This metapackage is basically an alias for python3-pybids+test. We build it
48369b9
# as a separate subpackage rather than adding a virtual Provides so that we can
48369b9
# benefit from generators to add Provides like python3dist(pybids[tests]).
48369b9
Requires:       python3-pybids+test = %{version}-%{release}
48369b9
48369b9
%description -n python3-pybids+tests %{test_description}
48369b9
48369b9
d0bf068
%prep
3f008f7
%autosetup -n pybids-%{version} -p1
d0bf068
e5db00d
# Remove bundled inflect
c2f075a
rm -rf bids/external
fadb763
sed -r -i.backup 's/from.*external (import)/\1/' bids/layout/layout.py
c2f075a
e5db00d
# unpin formulaic requirement
e5db00d
# https://github.com/bids-standard/pybids/issues/915
e5db00d
# https://github.com/bids-standard/pybids/pull/916
e5db00d
sed -i 's/formulaic.*/formulaic/' setup.cfg
d0bf068
1cb181d
# Remove bogus executable bits for non-script files
1cb181d
find bids doc -type f -perm /0111 -execdir chmod -v a-x '{}' '+'
1cb181d
e5db00d
e5db00d
%generate_buildrequires
cf0ab5b
%pyproject_buildrequires -x test,plotting
d0bf068
d0bf068
e5db00d
%build
e5db00d
%pyproject_wheel
d0bf068
b18b321
d0bf068
%install
e5db00d
%pyproject_install
e5db00d
%pyproject_save_files bids
578f6ee
# Save space by hardlinking duplicate test data files (of nonzero size).
578f6ee
hardlink -c -v '%{buildroot}%{python3_sitelib}/bids/tests/data/'
d0bf068
b18b321
d0bf068
%check
d0bf068
%if %{with tests}
d7d3e4c
%pytest -v
e5db00d
%else
e5db00d
%pyproject_check_import
d0bf068
%endif
d0bf068
b18b321
e5db00d
%files -n python3-pybids -f %{pyproject_files}
d0bf068
%doc README.md
8f64106
%{_bindir}/pybids
48369b9
%exclude %{python3_sitelib}/bids/tests/
48369b9
48369b9
48369b9
%files -n python3-pybids+test
48369b9
%{python3_sitelib}/bids/tests/
48369b9
%ghost %{python3_sitelib}/*.dist-info
48369b9
48369b9
48369b9
%files -n python3-pybids+tests
48369b9
%ghost %{python3_sitelib}/*.dist-info
d0bf068
b18b321
d0bf068
%changelog
464ef2b
%autochangelog