Blob Blame History Raw
Name:           python-grabbit
Version:        0.2.6
Release:        %autorelease
Summary:        Get grabby with file trees

# The bundled grabbit/external/ is GPLv3+, but we remove it.
License:        MIT
Source0:        %{url}/archive/%{version}/grabbit-%{version}.tar.gz

# Update versioneer from 0.18 to 0.21
# Fixes Python 3.11 compatiblity (RHBZ#2026767)
Patch0:         %{url}/pull/93.patch

BuildArch:      noarch

BuildRequires:  python3-devel

%global _description %{expand: \
Grabbit is a lightweight Python package for simple queries over filenames
within a project. It is geared towards projects or applications with highly
structured filenames that allow useful queries to be performed without having
to inspect the file metadata or contents.


%package -n python3-grabbit
Summary:        %{summary}

%description -n python3-grabbit

%autosetup -n grabbit-%{version} -p1

# Unbundle inflect and six
for bundled in 'inflect' 'six'
  cat > "grabbit/external/${bundled}.py" <<EOF
# Use an external copy of ${bundled} to imitate a bundled one.
from ${bundled} import *
  sed -r -i "s/(install_requires=\[)/\1'${bundled}', /"

%pyproject_buildrequires -t


%pyproject_save_files grabbit


%files -n python3-grabbit -f %{pyproject_files}
# pyproject_files handles LICENSE; verify with “rpm -qL -p …”
%license LICENSE
%doc examples