## START: Set by rpmautospec
## (rpmautospec version 0.7.2)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    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

%global pypi_name extract-msg
%global forgeurl https://github.com/TeamMsgExtractor/msg-extractor

Name:           %{pypi_name}
Version:        0.50.1
Release:        %{autorelease}
Summary:        Extracts emails and attachments saved in M$ Outlook .msg files
%forgemeta
License:        GPL-3.0-only
URL:            %forgeurl
Source:         %forgesource

BuildArch:      noarch
BuildRequires:  python3-devel
BuildRequires:  python3-pytest

Provides:       python3-%{pypi_name} = %{?epoch:%{epoch}:}%{version}-%{release}

%global _description %{expand:
The python package extract_msg automates the extraction of key email
data (from, to, cc, date, subject, body) and the email’s attachments.}

%description %_description


%prep
%forgeautosetup -p1

# Loosen upper bound on red-black-tree-mod
sed -i -e 's/red-black-tree-mod==1.20/red-black-tree-mod>=1.20/' requirements.txt

# Remove shebang
sed -i '/^#!.*python/d' extract_msg/__init__.py


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files extract_msg


%check
%{py3_test_envvars} %{python3} tests.py


%files -n %{pypi_name} -f %{pyproject_files}
%doc README.* CHANGELOG.md
%{_bindir}/extract_msg


%changelog
## START: Generated by rpmautospec
* Tue Oct 08 2024 Sandro <devel@penguinpee.nl> - 0.50.1-1
- Update to 0.50.1
- Fix bug introduced in 0.50.0

* Tue Oct 08 2024 Sandro <devel@penguinpee.nl> - 0.50.0-1
- Update to 0.50.0
- Adjust html header code to replace non-ascii characters with escaped
  versions. Also adujusted plain text to html conversion to ensure non-
  ascii character from the body are encoded to escpaed values to be safe.
- Made some corrections to `NullDate`.

* Thu Aug 22 2024 Sandro <devel@penguinpee.nl> - 0.49.0-1
- Update to 0.49.0

* Sun Jul 07 2024 Sandro <devel@penguinpee.nl> - 0.48.6-1
- Update to 0.48.5
- Fixed issues with openMsg where some corrupted MSG files could end up
  throwing an uncaught exception and leaving the file handle open

* Fri Apr 19 2024 Sandro <devel@penguinpee.nl> - 0.48.5-1
- Update to 0.48.5
- Changelog: https://github.com/TeamMsgExtractor/msg-
  extractor/blob/master/CHANGELOG.md

* Sat Dec 09 2023 Sandro <devel@penguinpee.nl> - 0.45.0-3
- Unpin olefile

* Sat Dec 02 2023 Sandro <devel@penguinpee.nl> - 0.45.0-2
- Remove upper bound from imapclient

* Mon Oct 16 2023 Sandro <devel@penguinpee.nl> - 0.45.0-1
- Initial package
## END: Generated by rpmautospec