f80254b
Name:           python-grabbit
f80254b
Version:        0.2.6
7d9d861
Release:        %autorelease
f80254b
Summary:        Get grabby with file trees
cfb3b36
bc76264
# The entire source is MIT, except:
bc76264
# - The bundled grabbit/external/inflect.py is GPL-3.0-or-later, but we remove
bc76264
#   it in %%prep.
bc76264
# - The bundled versioneer.py (which is not packaged), and the _version.py it
bc76264
#   generates (which is packaged) are CC0-1.0, which is not-allowed for code in
bc76264
#   Fedora, but this case is covered by the following exception
bc76264
#   (https://gitlab.com/fedora/legal/fedora-license-data/-/issues/91#note_1151947383):
bc76264
#
bc76264
#     Existing uses of CC0-1.0 on code files in Fedora packages prior to
bc76264
#     2022-08-01, and subsequent upstream versions of those files in those
bc76264
#     packages, continue to be allowed. We encourage Fedora package maintainers
bc76264
#     to ask upstreams to relicense such files.
5e665b8
#   However, we patch the source to update Versioneer to version 0.29, which is
5e665b8
#   Unlicense (along with the _version.py it generates).
5e665b8
License:        MIT AND Unlicense
f80254b
URL:            https://github.com/grabbles/grabbit
d70e8e5
Source:         %{url}/archive/%{version}/grabbit-%{version}.tar.gz
819c19d
# Replace deprecated logging function
819c19d
# https://github.com/grabbles/grabbit/pull/95
819c19d
Patch:          %{url}/pull/95.patch
f80254b
f80254b
# Update versioneer from 0.18 to 0.21
f80254b
# Fixes Python 3.11 compatiblity (RHBZ#2026767)
f80254b
# https://github.com/grabbles/grabbit/pull/93
d70e8e5
Patch:          %{url}/pull/93.patch
5e665b8
# Update versioneer to 0.29
5e665b8
# https://github.com/grabbles/grabbit/pull/94
5e665b8
Patch:          %{url}/pull/94.patch
f80254b
f80254b
BuildArch:      noarch
f80254b
f80254b
BuildRequires:  python3-devel
cfb3b36
4e8e491
%global _description %{expand:
a27a5b6
Grabbit is a lightweight Python package for simple queries over filenames
a27a5b6
within a project. It is geared towards projects or applications with highly
a27a5b6
structured filenames that allow useful queries to be performed without having
4e8e491
to inspect the file metadata or contents.}
a27a5b6
4e8e491
%description %{_description}
cfb3b36
a27a5b6
f80254b
%package -n python3-grabbit
f80254b
Summary:        %{summary}
f80254b
4e8e491
%description -n python3-grabbit %{_description}
f80254b
cfb3b36
cfb3b36
%prep
f80254b
%autosetup -n grabbit-%{version} -p1
f80254b
f80254b
# Unbundle inflect and six
f80254b
for bundled in 'inflect' 'six'
f80254b
do
f80254b
  cat > "grabbit/external/${bundled}.py" <
f80254b
# Use an external copy of ${bundled} to imitate a bundled one.
f80254b
from ${bundled} import *
f80254b
EOF
f80254b
  sed -r -i "s/(install_requires=\[)/\1'${bundled}', /" setup.py
f80254b
done
f80254b
f80254b
f80254b
%generate_buildrequires
f80254b
%pyproject_buildrequires -t
f80254b
cfb3b36
cfb3b36
%build
f80254b
%pyproject_wheel
cfb3b36
cfb3b36
cfb3b36
%install
f80254b
%pyproject_install
433933d
%pyproject_save_files -l grabbit
f80254b
cfb3b36
cfb3b36
%check
f80254b
%tox
cfb3b36
cfb3b36
f80254b
%files -n python3-grabbit -f %{pyproject_files}
f80254b
%doc README.md
ae12d8d
%doc examples/
a27a5b6
a27a5b6
cfb3b36
%changelog
7d9d861
%autochangelog