## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 3;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

Name:           jrnl
Version:        3.3
Release:        %autorelease
Summary:        Collect your thoughts and notes without leaving the command line

License:        GPL-3.0-only
URL:            https://jrnl.sh
%global forgeurl https://github.com/jrnl-org/jrnl/
Source0:        %{forgeurl}/archive/v%{version}/jrnl-%{version}.tar.gz

#   Update dependency rich to v13
#   https://github.com/jrnl-org/jrnl/pull/1654
# Changes to poetry.lock are dropped because they are irrelevant here and would
# not apply cleanly.
Patch:          rich-13.patch

BuildArch:      noarch

BuildRequires:  python3-devel

BuildRequires:  dos2unix
BuildRequires:  help2man

# The mkdocs-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can package the Markdown sources without building them; they are still
# relatively legible as plain text. However, the text documentation files are
# no longer large or numerous enough to justify a separate -doc subpackage.
Obsoletes:      jrnl-doc < 3.3-1

%description
jrnl is a simple journal application for the command line.

You can use it to easily create, search, and view journal entries. Journals are
stored as human-readable plain text, and can also be encrypted using AES
encryption.


%prep
%autosetup -n jrnl-%{version}

dos2unix \
    SECURITY.md \
    docs/external-editors.md \
    docs/journal-types.md \
    docs/reference-command-line.md \
    docs/reference-config-file.md


%generate_buildrequires
%pyproject_buildrequires -t


%build
%pyproject_wheel

# https://github.com/jrnl-org/jrnl/issues/74
# https://github.com/jrnl-org/jrnl/issues/1274
help2man --no-info '%{python3} -m jrnl' --output='jrnl.1'


%install
%pyproject_install
%pyproject_save_files jrnl

install -D -t '%{buildroot}%{_mandir}/man1' -p -m 0644 'jrnl.1'


%check
%tox


%files -f %{pyproject_files}
%license LICENSE.md

%doc CHANGELOG.md
%doc CODE_OF_CONDUCT.md
%doc CONTRIBUTING.md
%doc README.md
%doc SECURITY.md
%doc docs/

%{_bindir}/jrnl
%{_mandir}/man1/jrnl.1*


%changelog
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> 3.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Tue Jan 03 2023 Benjamin A. Beasley <code@musicinmybrain.net> 3.3-2
- Update dependency rich to v13 (fix RHBZ#2157861)

* Fri Nov 11 2022 Benjamin A. Beasley <code@musicinmybrain.net> 3.3-1
- Update to 3.3 (close RHBZ#2120137)
- Drop separate -doc subpackage

* Fri Aug 05 2022 Benjamin A. Beasley <code@musicinmybrain.net> 3.0-3
- Update License to SPDX

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> 3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Sun Jul 10 2022 Benjamin A. Beasley <code@musicinmybrain.net> 3.0-1
- Update to 3.0 (close RHBZ#2105753)

* Mon Jun 27 2022 Python Maint <python-maint@redhat.com> 2.8.4-3
- Rebuilt for Python 3.11

* Sun Jun 05 2022 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.4-2
- Backport upstream PR#1495 (fix RHBZ#2039871)
- Fixes error related to display_format in config file for some values

* Sun Feb 13 2022 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.4-1
- Update to 2.8.4 (close RBHZ#2053899)

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> 2.8.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Tue Oct 26 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.3-5
- Support pytest-bdd 5.x (fix RHBZ#2017131)

* Tue Oct 26 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.3-4
- Reduce macro indirection in the spec file

* Tue Oct 26 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.3-3
- Drop the mkdocs option due to JS/CSS policy issues

* Sun Sep 12 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.3-2
- Drop BR on pyproject-rpm-macros, now implied by python3-devel

* Tue Sep 07 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.3-1
- Update to 2.8.3 (close RHBZ#2001704)

* Wed Aug 11 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.2-3
- Disable mkdocs while it is orphaned

* Wed Aug 11 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.2-2
- Add a build conditional for mkdocs

* Sun Aug 01 2021 Benjamin A. Beasley <code@musicinmybrain.net> 2.8.2-1
- Update to 2.8.2 (closes RHBZ#1988758)

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> 2.8.1-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Thu Jul 01 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8.1-5
- Stop allowing tzlocal 2.0; 2.1 is now available in Fedora

* Wed Jun 30 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8.1-4
- Stop maintaining workarounds for F33/F34 dependency versions in the Rawhide
  branch
- Add more links to upstream issues and PR’s
- Align shebang and mode adjustment with upstream PR#1283

* Thu Jun 24 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8.1-3
- Loosen Python version restriction to allow 3.10 (closes RHBZ#1968822)
- Add some missing sed regex metacharacter backslash escapes
- Add “behave” tests to %%check

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 2.8.1-2
- Rebuilt for Python 3.10

* Sun Apr 25 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8.1-1
- New upstream version 2.8.1
- No longer need to patch pyxdg requirement on Fedora 35

* Sat Apr 10 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8-2
- Drop workarounds for Fedora 32

* Wed Apr 07 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 2.8-1
- New upstream release 2.8 (with license change, MIT to GPLv3)
- Switch URL to HTTPS
- Use GitHub tarball instead of PyPI tarball to get documentation and tests
- Build with pyproject-rpm-macros (no setup.py)
- Adjust spec file whitespace to personal preference
- Update summary and description from upstream
- Add CHANGELOG.md, CODE_OF_CONDUCT.md, CONTRIBUTING.md
- Add a new -doc subpackage and build the HTML documentation
- Run the tests
- Generate and install a man page

* Wed Feb 10 2021 Fabian Affolter <mail@fabian-affolter.ch> - 2.7-1
- Update to latest upstream release 2.7 (#1907094)

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sat Nov 28 2020 Fabian Affolter <mail@fabian-affolter.ch> - 2.5-1
- Update to latest upstream release 2.5 (#1875713)

* Fri Sep 04 2020 Fabian Affolter <mail@fabian-affolter.ch> - 2.4.5-2
- Fix requirement for dependency generator

* Sun Aug 23 2020 Fabian Affolter <mail@fabian-affolter.ch> - 2.4.5-1
- Update to latest upstream release 2.4.5 (#1875713)

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 2.4-2
- Rebuilt for Python 3.9

* Fri May 01 2020 Fabian Affolter <mail@fabian-affolter.ch> - 2.4-1
- Update to latest upstream release 2.4

* Sat Mar 28 2020 Fabian Affolter <mail@fabian-affolter.ch> - 2.3-1
- Remove release pinning (#1803355)
- Update to latest upstream release 2.3

* Thu Feb 06 2020 Fabian Affolter <mail@fabian-affolter.ch> - 2.2-1
- Fix build failure (#1791686)
- Update to latest upstream release 2.2

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Mon Jan 06 2020 Fabian Affolter <mail@fabian-affolter.ch> - 2.1.1-1
- Update to latest upstream release 2.1.1

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.9.8-4
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.9.8-3
- Rebuilt for Python 3.8

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sat May 25 2019 Fabian Affolter <mail@fabian-affolter.ch> - 1.9.8-1
- Initial package for Fedora