%global pypi_name datalad-osf Name: python-%{pypi_name} Version: 0.3.0 Release: 1%{?dist} Summary: DataLad extension for the Open Science Framework License: MIT URL: https://github.com/datalad/datalad-osf Source0: https://github.com/datalad/datalad-osf/archive/%{version}/datalad-osf-%{version}.tar.gz BuildArch: noarch BuildRequires: python3-devel # DataLad imports and its extension entry points need git and git-annex at import time BuildRequires: git-core BuildRequires: git-annex %global _description %{expand: datalad-osf publishes datasets to, and clones them from, the Open Science Framework (osf.io), with a git-annex special remote for OSF storage. It is a DataLad extension: installing it adds commands and functionality to the datalad command and Python API.} %description %{_description} %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %{_description} %prep %autosetup -p1 -n datalad-osf-%{version} # Fedora rejects ambiguous #!/usr/bin/env python shebangs in installed modules. find . -name '*.py' -exec sed -i '1s|^#!/usr/bin/env python$|#!%{python3}|' {} + # Old _datalad_buildsupport imports DistutilsOptionError from setuptools, which current # setuptools no longer re-exports; setuptools.errors.OptionError is the same class. if [ -f _datalad_buildsupport/setup.py ] && grep -q 'from setuptools import Command, DistutilsOptionError' _datalad_buildsupport/setup.py; then sed -i 's/^from setuptools import Command, DistutilsOptionError$/from setuptools import Command\nfrom setuptools.errors import OptionError as DistutilsOptionError/' _datalad_buildsupport/setup.py grep -q '^from setuptools.errors import OptionError as DistutilsOptionError$' _datalad_buildsupport/setup.py fi # Old versioneer.py uses configparser.SafeConfigParser and readfp, both removed in Python 3.12. if [ -f versioneer.py ] && grep -q SafeConfigParser versioneer.py; then sed -i 's/SafeConfigParser/ConfigParser/g; s/\.readfp(/.read_file(/g' versioneer.py if grep -qE 'SafeConfigParser|readfp\(' versioneer.py; then exit 1; fi fi # A GitHub tag archive has no git metadata for versioneer to read; pin the version. cat > datalad_osf/_version.py << 'EOF' def get_versions(): return {'version': '%{version}', 'full-revisionid': None, 'dirty': False, 'error': None, 'date': None} EOF sed -i 's/version=versioneer.get_version()/version="%{version}"/' setup.py grep -q 'version="%{version}"' setup.py %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install # Build helpers some DataLad-template projects install at top level; not part of the package. rm -rf %{buildroot}%{python3_sitelib}/_datalad_buildsupport %{buildroot}%{python3_sitelib}/tools %{buildroot}%{python3_sitelib}/benchmarks %{buildroot}%{python3_sitelib}/tests %{buildroot}%{python3_sitelib}/tests.py # Old setup.py data_files can drop these at the top of site-packages (osfclient does). rm -f %{buildroot}%{python3_sitelib}/{LICENSE,VERSION,requirements.txt} %pyproject_save_files -L datalad_osf %check export HOME=$PWD git config --global user.name mockbuild && git config --global user.email mockbuild@localhost %pyproject_check_import -e 'datalad_osf.tests*' -e 'datalad_osf.*.tests*' -e '*.test_*' -e '*.conftest' -e '*.pytest_plugin' -e '*.resources.procedures.*' # The extension registers with DataLad: its command suite loads through datalad's API. %{py3_test_envvars} %{python3} - <<'EOF' from importlib.metadata import entry_points eps = [e for e in entry_points(group='datalad.extensions') if e.value.startswith('datalad_osf')] assert eps, 'no datalad.extensions entry point for datalad_osf' for e in eps: suite = e.load() print(e.name, '->', suite[0] if isinstance(suite, tuple) else suite) EOF %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %{_bindir}/git-annex-remote-osf %{_bindir}/git-remote-osf %changelog * Mon Oct 12 2026 Morgan Hough - 0.3.0-1 - Initial package, for the DataLad extension stack and dandi.