Blob Blame History Raw
%global srcname pyrsistent

Name:           python-%{srcname}
Summary:        Persistent/Functional/Immutable data structures
Version:        0.18.0
Release:        %autorelease

# The entire source is MIT, except pyrsistent/_toolz.py which is BSD.
License:        MIT and BSD
URL:            https://github.com/tobgu/pyrsistent/
Source0:        %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz

# Relax dependencies specified in setup.py (allow newer pytest/hypothesis)
Patch0:         00-relax-dependencies.patch

BuildRequires:  python3-devel
BuildRequires:  pyproject-rpm-macros

BuildRequires:  gcc

# For Sphinx documentation
BuildRequires:  make

# We need manual BR’s since they are generally not available where
# %%pyproject_buildrequires can access them, i.e., outside requirements.txt,
# and even in requirements.txt a number of packages are not actually required
# for the RPM build.

# ============================================================================
# From requirements.txt:

# hypothesis
BuildRequires:  python3dist(hypothesis)

# ----------------------------------------------------------------------------
# We do not need these, since we are not running the memorytest* environment
# from tox.ini.
# ----------------------------------------------------------------------------
# memory-profiler==0.57.0
# psutil==5.7.0

# ----------------------------------------------------------------------------
# We do not need this, since we are not running the benchmarks from
# performance_suites/.
# ----------------------------------------------------------------------------
# pyperform

# pytest
BuildRequires:  python3dist(pytest)
# Sphinx
BuildRequires:  python3dist(sphinx)
# sphinx-rtd-theme==0.1.5
BuildRequires:  python3dist(sphinx-rtd-theme)

# ----------------------------------------------------------------------------
# We do not need this, since we are not using tox to run the tests.
# ----------------------------------------------------------------------------
# tox

# ----------------------------------------------------------------------------
# We do not need this, since it is implied by pyproject-rpm-macros.
# ----------------------------------------------------------------------------
# setuptools>=0.16.1

# ----------------------------------------------------------------------------
# We do not need these for the RPM build either.
# ----------------------------------------------------------------------------
# twine>=3.2
# pip>=20.2.3

# ============================================================================
# From setup_requires in setup.py, when tests are to be executed:
BuildRequires:  python3dist(pytest-runner)

# Note that pyrsistent/_toolz.py contains a bit of code ported from toolz, but
# not enough to constitute a bundled dependency.

%global common_description %{expand:
Pyrsistent is a number of persistent collections (by some referred to as
functional data structures). Persistent in the sense that they are
immutable.

All methods on a data structure that would normally mutate it instead
return a new copy of the structure containing the requested updates. The
original structure is left untouched.}

%description %{common_description}


%generate_buildrequires
%pyproject_buildrequires -r


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

%description -n python3-%{srcname} %{common_description}


%package        doc
Summary:        Documentation for %{srcname}

BuildArch:      noarch

%description doc %{common_description}


%prep
%autosetup -n %{srcname}-%{version} -p1


%build
%pyproject_wheel

# Default SPHINXOPTS are '-W -n', but -W turns warnings into errors and there
# are some warnings. We want to build the documentation as best we can anyway.
# Additionally, we parallelize sphinx-build.
%make_build -C docs html SPHINXOPTS='-n %{?_smp_mflags}'
rm -f docs/build/html/.buildinfo


%install
%pyproject_install
%pyproject_save_files %{srcname} _%{srcname}_version pvectorc


%check
%pytest
# See tox.ini:
env PYTHONHASHSEED=0 %pytest --doctest-modules %{srcname}


%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE.mit


%files doc
%license LICENSE.mit
%doc CHANGES.txt
%doc README.rst
%doc docs/build/html


%changelog
%autochangelog