%global pypi_name legacy-cgi %global pypi_dist legacy_cgi Name: python-%{pypi_name} Version: 2.6.4 Release: 2%{?dist} Summary: Fork of the standard library cgi and cgitb modules (removed in Python 3.13) License: PSF-2.0 URL: https://github.com/jackrosenthal/legacy-cgi Source0: %{pypi_source %{pypi_dist} %{version}} BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-pip # hatchling build backend BuildRequires: python3-hatchling %description This is a fork of the standard library cgi and cgitb modules, which were deprecated in Python 3.11 and removed in Python 3.13. It provides those modules unchanged for code (such as 3D Slicer's DICOM scripted modules) that still imports them on modern Python. %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} A fork of the standard library cgi and cgitb modules (removed in Python 3.13). %prep %autosetup -n %{pypi_dist}-%{version} %build %pyproject_wheel %install %pyproject_install # cgi.py carries the shebang the CPython stdlib source has always had, # "#! /usr/local/bin/python", and this package is that stdlib module lifted onto # PyPI unchanged. rpm's shebang dependency generator turns it into a hard # Requires: /usr/local/bin/python, which nothing on a Fedora system provides, so # the package is UNINSTALLABLE -- caught by repoclosure, not by the build, which # is perfectly happy. Neither file is executable and neither is meant to be run # as a script, so per Fedora's Python guidelines the shebang should not be there # at all. Remove it rather than adding a dependency filter, which would leave a # misleading shebang in a library module. sed -i '1{\@^#!.*/python@d}' %{buildroot}%{python3_sitelib}/cgi.py \ %{buildroot}%{python3_sitelib}/cgitb.py # Assert it worked: a sed whose address never matches exits 0 and changes nothing, # which is how this would quietly come back on the next upstream bump. if grep -lE '^#!' %{buildroot}%{python3_sitelib}/cgi.py \ %{buildroot}%{python3_sitelib}/cgitb.py 2>/dev/null; then echo "ERROR: a shebang survived in the files listed above; the Requires on" >&2 echo " an absolute interpreter path will come back." >&2 exit 1 fi %pyproject_save_files cgi cgitb %check %pyproject_check_import %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.rst %changelog * Sun Sep 27 2026 Morgan Hough - 2.6.4-2 - Strip the shebang from cgi.py and cgitb.py. -1 was UNINSTALLABLE: cgi.py carries the CPython stdlib's historical "#! /usr/local/bin/python", and rpm's shebang dependency generator turned that into Requires: /usr/local/bin/python, which nothing provides. The build never complained; repoclosure found it. - Neither file is executable or meant to be run, so removing the shebang is what Fedora's Python guidelines call for, rather than filtering the dependency and leaving a misleading interpreter line in a library module. - The %%install step asserts no shebang survives, because a sed whose address does not match exits 0 and changes nothing -- which is exactly how this would come back unnoticed on the next upstream bump. * Sat Jun 27 2026 Morgan Hough - 2.6.4-1 - Initial package (restores cgi/cgitb for 3D Slicer scripted modules on Py3.14)