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