Name: python-bitmath Summary: Work with file sizes like numbers — convert, compare, sort, and format across any unit prefix Version: 2.0.1 Release: 1.20260520001346374863.pr138.16.gc7ad84b%{?dist} License: MIT Source0: bitmath-2.0.1.tar.gz URL: https://github.com/timlnx/bitmath BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros BuildRequires: python3-hatchling BuildRequires: python3-pytest %description bitmath simplifies many facets of interacting with file sizes in various units. Examples include: converting between SI and NIST prefix units (GiB to kB), converting between units of the same type (SI to SI, or NIST to NIST), basic arithmetic operations (subtracting 42KiB from 50GiB), capacity math with floor division, modulo, and divmod (GiB(1) // MiB(300), GiB(1) % MiB(300)), rich comparison operations (1024 Bytes == 1KiB), bit-wise operations, sorting, automatic best human-readable prefix selection, and completely customizable formatting. In addition to the conversion and math operations, bitmath provides human readable representations of values which are suitable for use in interactive shells as well as larger scripts and applications. It can also read the capacity of system storage devices. bitmath can parse strings (like "1 KiB") into proper objects and has support for integration with the argparse module as a custom argument type. bitmath ships almost 300 unit tests with near 100% code coverage. ###################################################################### # Sub-package setup %package -n python3-bitmath Summary: Aids representing and manipulating file sizes in various prefix notations %description -n python3-bitmath bitmath simplifies many facets of interacting with file sizes in various units. Examples include: converting between SI and NIST prefix units (GiB to kB), converting between units of the same type (SI to SI, or NIST to NIST), basic arithmetic operations (subtracting 42KiB from 50GiB), capacity math with floor division, modulo, and divmod (GiB(1) // MiB(300), GiB(1) % MiB(300)), rich comparison operations (1024 Bytes == 1KiB), bit-wise operations, sorting, automatic best human-readable prefix selection, and completely customizable formatting. In addition to the conversion and math operations, bitmath provides human readable representations of values which are suitable for use in interactive shells as well as larger scripts and applications. It can also read the capacity of system storage devices. bitmath can parse strings (like "1 KiB") into proper objects and has support for integration with the argparse module as a custom argument type. bitmath ships almost 300 unit tests with near 100% code coverage. ###################################################################### %generate_buildrequires %pyproject_buildrequires ###################################################################### %prep %setup -n bitmath-2.0.1 -q ###################################################################### %build %pyproject_wheel ###################################################################### %install %pyproject_install %pyproject_save_files bitmath pushd %{buildroot}%{_bindir} ln -s bitmath bitmath-%{python3_version} popd mkdir -p %{buildroot}%{_mandir}/man1/ cp -v *.1 %{buildroot}%{_mandir}/man1/ ln -s bitmath.1 %{buildroot}%{_mandir}/man1/bitmath-%{python3_version}.1 mkdir -p %{buildroot}%{_docdir}/%{name}/docs cp -v -r docsite/source/* %{buildroot}%{_docdir}/%{name}/docs/ find %{buildroot}%{_docdir}/%{name}/docs -name '.gitkeep' -delete ###################################################################### %check %pytest tests/ ###################################################################### %files %license LICENSE ###################################################################### %files -n python3-bitmath -f %{pyproject_files} %license LICENSE %doc README.rst NEWS.rst %{_bindir}/bitmath %{_bindir}/bitmath-%{python3_version} %{_mandir}/man1/bitmath.1* %{_mandir}/man1/bitmath-%{python3_version}.1* %{_docdir}/%{name}/ ###################################################################### %changelog * Wed May 20 2026 Packit - 2.0.1-1.20260520001346374863.pr138.16.gc7ad84b - Add OSSF Scorecard security scan workflow (Tim Case) - Normalize internal representation to uniform floating-point (Tim Case) - Refresh documentation and deprecate listdir() (Tim Case) - Add bandit security badge and refresh README badges (Tim Case) - Add bandit security scanning (Tim Case) - Read the package version dynamically from the VERSION file (Tim Case) - SPDX-ify copyright headers in tests/ (Tim Case) - Add tests for all coverage gaps, reach 100% on macOS (Tim Case) - Fix uniqueness checker to anchor grep to line-start class definitions (Tim Case) - Replace flake8/pyflakes with pylint in CI and toolchain (Tim Case) - Raise pylint score from 7.29 to 10.00/10 (Tim Case) - Split test_parse.py into strict and unsafe halves (Tim Case) - Add pylint config, address findings, rename listdir filter→glob (Tim Case) - SPDX-ify copyright headers, https everywhere, drop stale comment (Tim Case) * Sat Apr 18 2026 Tim Case - 0-1 - Packit-managed changelog. See https://github.com/timlnx/bitmath/releases