# SlicerDevelopmentToolbox: widgets, helpers, decorators, mixins and a step-based # module framework that other Slicer extensions build on. Pure Python; the # QuantitativeReporting module imports it (SlicerDevelopmentToolboxUtils). # Installed file by file from upstream's CMake lists, without a CMake build (the # DentalSegmentator / IDCBrowser pattern), so it stays noarch. %global commit f675c0fdf2c8d468772a1bf725d2eaf2dd37aca4 %global shortcommit %(c=%{commit}; echo ${c:0:8}) %global snapdate 20240423 %global slicer_inst %{_prefix}/lib/slicer %global slicer_subdir Slicer-5.12 %global qtsm %{slicer_inst}/lib/%{slicer_subdir}/qt-scripted-modules Name: 3dslicer-developmenttoolbox Version: 0 Release: 0.1.%{snapdate}git%{shortcommit}%{?dist} Summary: Development toolbox for 3D Slicer extensions (SlicerDevelopmentToolbox) # The 3D Slicer Contribution and Software License Agreement v1.0, accepted # provisionally by the project pending a Fedora Legal determination # (ci/check-fedora-licence.py, PROVISIONAL). License: 3D-Slicer-1.0 URL: https://github.com/QIICR/SlicerDevelopmentToolbox Source0: %{url}/archive/%{commit}/SlicerDevelopmentToolbox-%{shortcommit}.tar.gz # Two Python standard-library removals; the official Slicer build hides the # second behind setuptools' distutils shim, a system Python does not. For upstream. # - helpers.py imports urllib.request.FancyURLopener (removed in 3.14) at module # level, so the whole package failed to import. Only the unused # SampleDataDownloader derives from it. # - ModuleWidgetMixin.isQtVersionOlder() imports distutils (removed in 3.12); # QuantitativeReporting's panel calls it and lost its measurements area. Patch0: 3dslicer-developmenttoolbox-python312-stdlib.patch BuildArch: noarch # %%check only. BuildRequires: python3 Requires: 3dslicer Requires: python3-six %description SlicerDevelopmentToolbox makes it easier to develop 3D Slicer modules and extensions. It provides widgets (incoming-data windows, target tables, rating and settings dialogs, watch boxes), helpers, decorators, events, constants, mix-in classes and a session/step framework for workflow modules. QuantitativeReporting is built on it. %prep %autosetup -n SlicerDevelopmentToolbox-%{commit} -p1 %build %install _mod=SlicerDevelopmentToolbox; _n=0 for _f in $(sed -n '/^set(MODULE_PYTHON_SCRIPTS$/,/^ )$/p' CMakeLists.txt \ | grep -vE '^set\(|^ \)$' | sed -e 's/^ *//' -e "s/\${MODULE_NAME}/$_mod/g") \ $(find Resources/Icons Resources/UI -type f | sort); do test -f "$_f" || { echo "ERROR: $_mod lists $_f, which is missing" >&2; exit 1; } install -Dpm0644 "$_f" "%{buildroot}%{qtsm}/$_f" _n=$((_n + 1)) done # 23 scripts + 40 icon/UI resources at f675c0fd; a changed list means re-check the loop. test "$_n" -eq 63 || { echo "ERROR: installed $_n $_mod files, expected 63" >&2; exit 1; } ( cd %{buildroot} && find . \( -type f -o -type l \) | sed 's|^\.||' ) > %{_builddir}/developmenttoolbox.files %check # Patch0 took, and every module parses (compile() writes no __pycache__). grep -q 'class FancyURLopener:' %{buildroot}%{qtsm}/SlicerDevelopmentToolboxUtils/helpers.py ! grep -rnE '^\s*(from|import) distutils' %{buildroot}%{qtsm} --include='*.py' find %{buildroot}%{qtsm} -name '*.py' -print0 | xargs -0 -n1 %{python3} -c \ 'import sys; compile(open(sys.argv[1]).read(), sys.argv[1], "exec")' %files -f %{_builddir}/developmenttoolbox.files %license License.txt %changelog * Mon Oct 12 2026 Morgan Hough - 0-0.1.20240423gitf675c0fd - Initial package, for QuantitativeReporting (IDC Browser's extension dependency) - Patch0: no urllib.request.FancyURLopener (removed in Python 3.14) and no distutils (removed in 3.12)