# Pinned to a commit rather than the v0.1.0-beta tag (2026-05-06). The session # layer was reworked entirely after that tag -- multi-session support, the # --session flag, `cbrain switch_session`, logout handling and a regression # suite all landed between 2026-08-24 and 2026-09-07 (PR #34). Shipping the tag # would ship a session implementation upstream has already replaced. %global commit 180cecd7fb4688dfcccb710104e1cb2fdf2dd204 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global date 20260907 %global pypi_name cbrain-cli %global module_name cbrain_cli Name: cbrain-cli Version: 0.1.0 Release: 1.%{date}git%{shortcommit}%{?dist} Summary: Command-line client for the CBRAIN neuroinformatics platform # SPDX -- LICENSE is the MIT text, (c) 2026 The Royal Institution for the # Advancement of Learning (McGill University). Note this differs from the CBRAIN # server itself (aces/cbrain), which is GPL-3.0-or-later. License: MIT URL: https://github.com/aces/cbrain-cli Source0: %{url}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros BuildRequires: %{py3_dist setuptools} BuildRequires: %{py3_dist wheel} # %%check runs the upstream suite. BuildRequires: %{py3_dist pytest} %global _description %{expand: A command-line client for CBRAIN, McGill's web-based platform for distributed neuroimaging analysis. It speaks CBRAIN's REST API, so it works against the McGill production portal at portal.cbrain.mcgill.ca or against any self-hosted instance -- no local CBRAIN server is required, and none is packaged here (the server is a Rails 5 application and is deployed, not installed). Provides the cbrain command: log in and manage named sessions across several instances, list and transfer files, and drive data providers, projects, tools, tool configurations, tags, tasks, background activities and remote resources (Bourreau execution servers). Output is human-readable by default or JSON with -j/-jl for scripting. The runtime uses only the Python standard library.} %description %{_description} %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %{_description} %prep %autosetup -n %{name}-%{commit} # find_packages() with no exclude picks up the test suite, because tests/ has an # __init__.py -- that would install a top-level "tests" package into site-packages # and collide with every other package that makes the same mistake. Upstream only # gets away with it because nobody installs this from a wheel yet. Keep tests/ in # the build tree (%%check needs it: the test modules import tests.conftest), just # do not ship it. sed -i 's/find_packages()/find_packages(exclude=["tests", "tests.*"])/' setup.py grep -q 'exclude=\["tests"' setup.py || { echo "ERROR: find_packages exclude not applied" >&2; exit 1; } %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files %{module_name} %check %pyproject_check_import # Upstream suite. Runs from the source tree because the test modules import # tests.conftest, which is deliberately not installed. %pytest # The installed console script has to actually run, and `cbrain version` is the # one command that exercises the packaging itself: cli_utils.version_info() asks # importlib.metadata.version("cbrain-cli") first and only falls back to parsing # setup.cfg, which is not installed. So this fails if the dist-info metadata is # wrong or missing, which an import check would not catch. PATH=%{buildroot}%{_bindir}:$PATH \ PYTHONPATH=%{buildroot}%{python3_sitelib} \ cbrain version | grep -q '%{version}' PATH=%{buildroot}%{_bindir}:$PATH \ PYTHONPATH=%{buildroot}%{python3_sitelib} \ cbrain --help > /dev/null %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md %{_bindir}/cbrain %changelog * Mon Sep 22 2026 Morgan Hough - 0.1.0-1.20260907git180cecd - Initial packaging of cbrain-cli, the command-line client for CBRAIN. New to Fedora and not on PyPI, so Source0 is a GitHub commit archive. - Pinned to 180cecd (2026-09-07) rather than the only tag, v0.1.0-beta (2026-05-06): the entire session layer was rewritten afterwards. - Exclude tests/ from find_packages(). It has an __init__.py, so upstream's bare find_packages() would install a top-level "tests" package into site-packages. - The server (aces/cbrain) is deliberately NOT packaged: it pins Rails ~> 5.0.6 and mysql2 < 0.5 on both master and dev as of the 7.1.0 tag, against Fedora's rubygem-rails 8.0.3 and Ruby 4.0. This client needs no local server.