Blob Blame History Raw
# require network, so disabled by default
# to run on mock, use --enable-network
# only a couple of tests fail
%bcond_with tests

%global forgeurl

Name:           python-datalad
Version:        0.18.3
%global tag     %{version}
Release:        %autorelease
Summary:        Keep code, data, containers under control with git and git-annex

License:        MIT
URL:            %{forgeurl}
Source0:        %{forgesource}

BuildArch:      noarch

%global _description %{expand:
DataLad makes data management and data distribution more accessible. To do
that, it stands on the shoulders of Git and Git-annex to deliver a
decentralized system for data exchange. This includes automated ingestion of
data from online portals and exposing it in readily usable form as Git(-annex)
repositories, so-called datasets. The actual data storage and permission
management, however, remains with the original data providers.

The full documentation is available at and provides a hands-on crash-course on DataLad


A number of extensions are available that provide additional functionality for
DataLad. Extensions are separate packages that are to be installed in addition
to DataLad. In order to install DataLad customized for a particular domain, one
can simply install an extension directly, and DataLad itself will be
automatically installed with it. An annotated list of extensions is available
in the DataLad handbook.


The documentation for this project is found here:

If you have a problem or would like to ask a question about how to use DataLad,
please submit a question to with a datalad tag.
is a platform similar to StackOverflow but dedicated to neuroinformatics.

All previous DataLad questions are available here:}

%description %_description

%package -n python3-datalad
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  python3-pytest
BuildRequires:  git-core
BuildRequires:  git-annex
# for 7za
BuildRequires:  p7zip
BuildRequires:  p7zip-plugins
# Not added automatically
Requires:       git-annex
Requires:       p7zip p7zip-plugins
Provides:       datalad = %{version}-%{release}

%description -n python3-datalad %_description


# tweak test requirements
# - remove type packages
# - remove mypy
# - remove pytest-fail-slow
sed -i -e '/types-python-dateutil/ d' \
    -e '/types-requests/ d' \
    -e '/mypy/ d' \
    -e '/pytest-fail-slow/ d' \

# Do not read deps from tox.ini, just use
# tox.ini calls requirements.txt which doesn't work
rm -f tox.ini

# Correct shebangs in tools
find . -type f -exec sed -i "s|#!/usr/bin/env.*python$|#!%{python3}|" '{}' ';'

# remove shebangs
find datalad/resources/procedures/ -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'

# required for tests, and man page generation
git config --global "Your Name"
git config --global ""

%if %{with tests}
# Tests wants a git repo
git init .
git add .
git commit -m "Dummy commit"

# correct function argument auto_spec -> autospec
sed -i 's/auto_spec/autospec/' datalad/support/tests/

# loosen chardet requirement
# this was because requests didn't support chardet 5 before, but it does now:
# Issue filed upstream:
sed -i "s/chardet.*'/chardet'/"

%pyproject_buildrequires %{?with_tests:-x tests}

# build man pages
%{python3} build_manpage

%pyproject_save_files datalad

# install man pages
install -m 0644 -p -Dt $RPM_BUILD_ROOT/%{_mandir}/man1/  build/man/*.1

%if %{with tests}
export PATH="${PATH}:%{buildroot}/%{_bindir}"
# check import
# exclude imports that require a dataset
%pyproject_check_import -e *test* -e *cfg_text2git* -e *cfg_yoda*

%files -n python3-datalad -f %{pyproject_files}