%global pypi_name fileformats Name: python-%{pypi_name} Version: 0.22.0 Release: 1%{?dist} Summary: Python classes describing file formats, for typing data workflows License: Apache-2.0 URL: https://github.com/python-fileformats/fileformats Source0: %{pypi_source %{pypi_name}} BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros %global _description %{expand: fileformats represents file formats as Python classes (generic files and directories, archives, JSON/YAML/XML, images, medical formats and so on), identified by extension and magic number, so workflow engines such as pydra can type-check and validate their inputs and outputs. Format conversions and the heavier format-specific readers live in the separate fileformats-extras project.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -n %{pypi_name}-%{version} %generate_buildrequires export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_buildrequires %build export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} %check # converter_chain builds format conversions as pydra 1.0 tasks (attrs, pydra); # it is the fileformats-extras side and is not imported by the core. %pyproject_check_import -e fileformats.core.converter_chain # The sdist excludes upstream's tests (they need fileformats-extras and pydra # 1.0). Check format identification and validation on real files. cd %{_builddir} %{py3_test_envvars} %{python3} - <<'PYEOF' import json, os, tempfile, zipfile from fileformats.core import from_mime, FileSet from fileformats.generic import File, Directory from fileformats.application import Json, Zip from fileformats.core.exceptions import FormatMismatchError from fileformats.core import __version__ assert __version__.startswith("%{version}"), __version__ d = tempfile.mkdtemp() j = os.path.join(d, "a.json"); json.dump({"x": 1}, open(j, "w")) z = os.path.join(d, "a.zip"); zipfile.ZipFile(z, "w").writestr("x.txt", "x") assert os.path.samefile(Json(j).fspath, j) Zip(z) try: Json(z) except FormatMismatchError: pass else: raise AssertionError("a .zip validated as JSON") assert from_mime("application/json") is Json assert os.path.samefile(Directory(d).fspath, d) print("fileformats ok") PYEOF %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md %changelog * Fri Oct 16 2026 Morgan Hough - 0.22.0-1 - Initial package (pydra dependency, pyAFQ chain).