# This command-line tool is written in Rust, not Python, but it is distributed # on PyPI (so it can be installed using pip, even though it does not provide an # importable Python module), and it uses Python for testing. Name: cramjam-cli Version: 0.1.1 Release: %autorelease Summary: Simple CLI to a variety of compression algorithms # 0BSD OR MIT OR Apache-2.0 # Apache-2.0 # Apache-2.0 OR MIT # BSD-3-Clause # BSD-3-Clause AND MIT (duplicate) # MIT # MIT OR Apache-2.0 (duplicate) # MIT OR Zlib OR Apache-2.0 License: %{shrink: (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR MIT) AND BSD-3-Clause AND MIT AND (MIT OR Zlib OR Apache-2.0) } # LICENSE.dependencies contains a full license breakdown URL: https://github.com/milesgranger/cramjam # The PyPI sdist is structured like the git repository, but with pyproject.toml # moved to the top level from cramjam-python/ and # manifest-path = "cramjam-python/Cargo.toml" # added to the [tool.maturin] section. We find it easiest to just build from # the GitHub source archive. Source: %{pypi_source cramjam_cli} # Remove relative libcramjam dep for python builds # See: https://github.com/milesgranger/cramjam/pull/131 # Rebased on the released PyPI sdist Patch: cramjam-cli-0.1.1-system-libcramjam-crate.patch # Fix missing LICENSE file in cramjam-cli # https://github.com/milesgranger/cramjam/pull/137 # Rebased on the released PyPI sdist Patch: cramjam-cli-0.1.1-license-file.patch # Do not strip the compiled executable; we need useful debuginfo. Upstream set # this intentionally, so this makes sense to keep downstream-only. Patch: cramjam-cli-0.1.1-no-strip.patch BuildRequires: python3-devel BuildRequires: cargo-rpm-macros >= 24 # Required for tests, but not in the dev extra (probably because it is built # from the same workspace): BuildRequires: %{py3_dist cramjam} %description %{summary}. %prep %autosetup -n cramjam_cli-%{version} -p1 # Remove bundled rust-libcramjam. rm -rv local_dependencies/ %cargo_prep %generate_buildrequires %pyproject_buildrequires -x dev %cargo_generate_buildrequires %build export RUSTFLAGS='%{build_rustflags}' %cargo_license_summary %{cargo_license} > LICENSES.dependencies %pyproject_wheel %install %pyproject_install # Because this package is distributed on PyPI and built via Python tooling, it # includes Python metadata, even though it does not provide an importable # package. However, we cannot use %%pyproject_save_files without an importable # module, so we form the appropriate files list manually. ( di='%{buildroot}%{python3_sitearch}/cramjam_cli-%{version}.dist-info' find "${di}" -type d -printf '%%%%dir %%p/\n' find "${di}" ! -type d \( -name 'LICENS*' \) -printf '%%%%license %%p\n' find "${di}" ! -type d ! \( -name 'LICENS*' \) -printf '%%p\n' ) | sed -r 's@(^| )%{buildroot}@\1@' | tee %{pyproject_files} # Roughly equivalent to %%pyproject_save_files -l: grep -E '^%%license' %{pyproject_files} > /dev/null %check %pytest -v %files -f %{pyproject_files} %doc README.md %{_bindir}/cramjam-cli %changelog %autochangelog