%bcond tests 1 Name: python-cramjam Version: 2.7.0 Release: %autorelease Summary: Thin Python bindings to de/compression algorithms in Rust License: MIT URL: https://github.com/milesgranger/cramjam Source0: %{pypi_source cramjam} # See https://github.com/milesgranger/cramjam/pull/124 and # python-cramjam-2.7.0-license-file.patch. Source1: %{url}/raw/v%{version}/LICENSE # Use pyo3 0.20 # https://github.com/milesgranger/cramjam/pull/118 Patch: python-cramjam-2.7.0-pyo3-0.20.patch # Downstream-only: use the system copy of the libcramjam crate # # It makes sense that this is vendored upstream, because it is developed in the # same git repository and belongs to the same cargo workspace. # # This applies on top of python-cramjam-2.7.0-pyo3-0.20.patch. Patch: python-cramjam-2.7.0-system-rust-libcramjam.patch # Do not strip the compiled Python module; we need useful debuginfo. Upstream # set this intentionally, so this makes sense to keep downstream-only. Patch: python-cramjam-2.7.0-no-strip.patch # Reduce max size for test_variants_different_dtypes # https://github.com/milesgranger/cramjam/commit/67f69027a403b51f69a6226a42785e0bff00664e # # Fixes: # # Python test test_variants_different_dtypes[brotli] sometimes times out # https://github.com/milesgranger/cramjam/issues/123 # # Rebased on the released sdist (so that it applies with -p1 instead of -p2) Patch: python-cramjam-2.7.0-reduce-max-size-variants.patch # Fix missing license file in the Python sdist and bdist/wheel # https://github.com/milesgranger/cramjam/pull/124 # Rebased on the released sdist (pyproject.toml change only; needs the LICENSE # file copied in as an additional source) Patch: python-cramjam-2.7.0-license-file.patch BuildRequires: python3-devel BuildRequires: cargo-rpm-macros >= 24 %global common_description %{expand: %{summary}.} %description %{common_description} %package -n python3-cramjam Summary: %{summary} # (Apache-2.0 OR MIT) AND BSD-3-Clause # Apache-2.0 # Apache-2.0 OR BSL-1.0 # Apache-2.0 OR MIT # MIT License: %{shrink: (Apache-2.0 OR MIT) AND BSD-3-Clause AND Apache-2.0 AND (Apache-2.0 OR BSL-1.0) AND MIT } # LICENSE.dependencies contains a full license breakdown %description -n python3-cramjam %{common_description} %prep %autosetup -n cramjam-%{version} -p1 # Downstream-only: patch out linters/formatters/etc. from the “dev” extra so we # can use it to generate test dependencies. # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters sed -r -i 's/^([[:blank:]]*)("(black)\b)/\1# \2/' pyproject.toml # Remove bundled rust-libcramjam: rm -rv local_dependencies/ # Copy in the missing LICENSE file from upstream: cp -p '%{SOURCE1}' . %cargo_prep %generate_buildrequires %pyproject_buildrequires %{?with_tests:-x dev} %cargo_generate_buildrequires %build export RUSTFLAGS='%{build_rustflags}' %cargo_license_summary %{cargo_license} > LICENSES.dependencies %pyproject_wheel %install %pyproject_install %pyproject_save_files cramjam %check %pyproject_check_import %if %{with tests} %pytest -v -n auto --ignore-glob='benchmarks/*' %endif %files -n python3-cramjam -f %{pyproject_files} %license LICENSE LICENSES.dependencies %doc README.md %changelog %autochangelog