5858bd
# what it's called on pypi
5858bd
%global srcname immutables
5858bd
# what it's imported as
5858bd
%global libname %{srcname}
5858bd
# name of egg info directory
5858bd
%global eggname %{srcname}
5858bd
# package name fragment
5858bd
%global pkgname %{srcname}
5858bd
5858bd
# Tests fail on 32-bit
5858bd
# https://github.com/MagicStack/immutables/issues/50
5858bd
%ifnarch %{ix86} %{arm32}
5858bd
%bcond_without  tests
5858bd
%endif
5858bd
5858bd
%global common_description %{expand:
5858bd
An immutable mapping type for Python.
5858bd
5858bd
The underlying datastructure is a Hash Array Mapped Trie (HAMT) used in
5858bd
Clojure, Scala, Haskell, and other functional languages. This implementation is
5858bd
used in CPython 3.7 in the contextvars module (see PEP 550 and PEP 567 for more
5858bd
details).
5858bd
5858bd
Immutable mappings based on HAMT have O(log N) performance for both set() and
5858bd
get() operations, which is essentially O(1) for relatively small mappings.}
5858bd
5858bd
5858bd
Name:           python-%{pkgname}
5858bd
Version:        0.15
5858bd
Release:        2%{?dist}
5858bd
Summary:        Immutable Collections
5858bd
License:        ASL 2.0 and MIT
5858bd
URL:            https://github.com/MagicStack/immutables
5858bd
Source0:        %pypi_source
5858bd
# upstream is missing license for pythoncapi_compat.h
5858bd
# https://github.com/MagicStack/immutables/pull/64
5858bd
Source1:        https://raw.githubusercontent.com/pythoncapi/pythoncapi_compat/main/COPYING
5858bd
5858bd
BuildRequires:  gcc
5858bd
5858bd
5858bd
%description %{common_description}
5858bd
5858bd
5858bd
%package -n python3-%{pkgname}
5858bd
Summary:        %{summary}
5858bd
BuildRequires:  python3-devel
5858bd
BuildRequires:  python3-setuptools
5858bd
%if %{with tests}
5858bd
BuildRequires:  python3-pytest
5858bd
%endif
5858bd
5858bd
5858bd
%description -n python3-%{pkgname} %{common_description}
5858bd
5858bd
5858bd
%prep
5858bd
%autosetup -n %{srcname}-%{version}
5858bd
rm -rf %{eggname}.egg-info
5858bd
5858bd
# copy second license file to builddir for %%license macro
5858bd
cp %{SOURCE1} LICENSE.MIT
5858bd
5858bd
# don't install source files
5858bd
sed -e '/include_package_data=/ s/True/False/' -i setup.py
5858bd
5858bd
5858bd
%build
5858bd
%py3_build
5858bd
5858bd
5858bd
%install
5858bd
%py3_install
5858bd
5858bd
5858bd
%if %{with tests}
5858bd
%check
5858bd
%pytest --verbose
5858bd
%endif
5858bd
5858bd
5858bd
%files -n python3-%{pkgname}
5858bd
%license LICENSE LICENSE.MIT
5858bd
%doc README.rst
5858bd
%{python3_sitearch}/%{libname}
5858bd
%{python3_sitearch}/%{eggname}-%{version}-py%{python3_version}.egg-info
5858bd
5858bd
5858bd
%changelog
5858bd
* Wed Apr 21 2021 Carl George <carl@george.computer> - 0.15-2
5858bd
- Include missing upstream license
5858bd
- Disable package data in setup.py to avoid installing source files
5858bd
5858bd
* Wed Apr 21 2021 Carl George <carl@george.computer> - 0.15-1
5858bd
- Initial package rhbz#1951868