%global srcname beancount %global forgeurl https://github.com/beancount/beancount Name: python-%{srcname} Version: 2.3.6 Release: %autorelease Summary: Double-Entry Accounting from Text Files License: GPL-2.0-only URL: https://furius.ca/beancount/ # The PyPI tarball is missing docs and tests Source: %{forgeurl}/archive/%{version}/%{srcname}-%{version}.tar.gz # setup: Fix indentation Patch: %{forgeurl}/commit/11a0c482f969a88fe40e19f721c3de5395636787.patch # setup: Move pytest and pdfminer to extra_requires Patch: %{forgeurl}/commit/dc761f986c32bbb109cb719969ae55d6eb7247ae.patch # setup: Fix typo for extras_require Patch: %{forgeurl}/pull/790.patch # Make file type logic work with both magic libraries Patch: %{forgeurl}/pull/791.patch BuildRequires: bison BuildRequires: findutils BuildRequires: flex BuildRequires: gcc BuildRequires: gpg BuildRequires: make BuildRequires: sed BuildRequires: python3-devel %global _description %{expand: Beancount is double-entry bookkeeping computer language that lets you define financial transaction records in a text file, read them in memory, generate a variety of reports from them, and provides a web interface.} %description %_description %package -n %{srcname} Summary: %{summary} Provides: python3-%{srcname} = %{version}-%{release} # Vendored under beancount/web/third_party/sorttable.js Provides: bundled(js-sorttable) = 2 Suggests: %{srcname}-doc %description -n %{srcname} %_description %package -n %{srcname}-doc Summary: Documentation and examples for %{srcname} BuildArch: noarch %description -n %{srcname}-doc %_description This package contains additional documentation and examples for Beancount. %prep %autosetup -p1 -n %{srcname}-%{version} # Tidy up the examples sed -i 's:/usr/bin/env bean-web:%{_bindir}/bean-web:' \ examples/simple/starter.beancount %py3_shebang_fix examples/ingest/office/{example.import,example_import.py} find examples/ -type f -name .keep -delete find examples/ -type f -name BUILD -delete # Do not attempt to build the extension, we'll use our macro instead sed -i '/build_ext/d' Makefile # Use python-file-magic instead of python-magic (rhbz#2020606) sed -i 's/"python-magic.*"/"file-magic"/' setup.py # We call this here to delete any generated artifacts (e.g. the parser) make clean %generate_buildrequires %pyproject_buildrequires -x test -x examples %build %make_build PYVERSION="%{python3_version}" %pyproject_wheel %install %pyproject_install %pyproject_save_files %{srcname} %check make ctest PYVERSION="%{python3_version}" ln -s \ ../../build/lib.%{python3_platform}-%{python3_cache_tag}/beancount/parser/_parser%{python3_ext_suffix} \ beancount/parser/ rm beancount/scripts/setup_test.py %pytest -v beancount examples %files -n %{srcname} -f %{pyproject_files} %license COPYING %doc README.rst CHANGES CREDITS TODO %{_bindir}/bean-bake %{_bindir}/bean-check %{_bindir}/bean-doctor %{_bindir}/bean-example %{_bindir}/bean-extract %{_bindir}/bean-file %{_bindir}/bean-format %{_bindir}/bean-identify %{_bindir}/bean-price %{_bindir}/bean-query %{_bindir}/bean-report %{_bindir}/bean-sql %{_bindir}/bean-web %{_bindir}/treeify %{_bindir}/upload-to-sheets %files -n %{srcname}-doc %license COPYING %doc docs examples %changelog %autochangelog