## START: Set by rpmautospec ## (rpmautospec version 0.2.5) %define autorelease(e:s:pb:) %{?-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*}}%{?dist} ## END: Set by rpmautospec %global forgeurl https://github.com/holoviz/colorcet Name: python-colorcet Version: 3.0.0 # We should package a commit corresponding to a release tag unless there is a # compelling reason to do otherwise. Normally this would mean referencing # source the tag for the version. However, packaging as a snapshot ensures # that we never forget to update the commit hash, which is used to build the # colorcet/.version file (imitating the upstream PyPI release process). %global commit 39af94a51a8cbc9016b548b9d4a975c5402d7c8b %forgemeta Release: %autorelease Summary: Collection of perceptually uniform colormaps License: CC-BY URL: %{forgeurl} # The PyPI archive lacks the Sphinx documentation sources, but since this # documentation requires nbsite (which is not packaged) and specifically # targets HTML output (which will not be suitable for packaging—see # https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion), we have # no use for the documentation anyway. # # It also lacks the file tox.ini for testing, but we need to skip linting and # tests with dependency issues, so we don’t use it anyway. # # It also lacks the baseline images for testing with pytest-mpl: that is enough # to convince us to switch to the GitHub archive. Source0: %{forgesource} BuildArch: noarch BuildRequires: python3-devel # Strictly speaking, the build dependency on pyct should include its [build] # extra; see https://github.com/holoviz/colorcet/pull/76. BuildRequires: %{py3_dist pyct[build]} %global common_description %{expand: Colorcet is a collection of perceptually uniform colormaps for use with Python plotting programs like bokeh, matplotlib, holoviews, and datashader based on the set of perceptually uniform colormaps created by Peter Kovesi at the Center for Exploration Targeting.} %description %{common_description} %package -n python3-colorcet Summary: %{summary} %description -n python3-colorcet %{common_description} # We don’t create a metapackage for the “all” extra because it includes several # extras (“tests”, “tests_extra”, “doc”, “build”) that are only suitable for # development. Only the “examples” extra really makes sense for packaging. %pyproject_extras_subpkg -n python3-colorcet examples %prep %forgeautosetup # nbsmoke is not packaged, so we cannot run tests that use it sed -r -i '/\bnbsmoke\b/d' setup.py # holoviews is not packaged, so we cannot run examples that use it sed -r -i '/\bholoviews\b/d' setup.py # Don’t pull in dependencies for linting, PyPI uploading, or coverage analysis. sed -r -i '/\b(flake8|pytest-cov|twine|rfc3986|keyring)\b/d' setup.py # Imitate the PyPI release process. cat > colorcet/.version <<'EOF' {"git_describe": "v%{version}-0-g%(echo '%{commit}' | cut -b -7)", "version_string": "%{version}"} EOF %generate_buildrequires # We want the “all” extra minus the “doc” extra: %pyproject_buildrequires -x tests,examples,tests_extra,build %build %pyproject_wheel # Sphinx-generated HTML documentation is not suitable for packaging; see # https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion. # Since the documentation uses nbsite, which explicitly targets HTML, it’s # unlikely we could package satisfactory and guideline-compliant documentation # even if python3dist(nbsite) were packaged. %install %pyproject_install %pyproject_save_files colorcet # The command-line tool is not particularly useful, as it only copies examples # from one place to another. The other commands from pyct, which are supposed # to fetch data, aren’t set up to do anything useful. We choose not to package # it. If there is some need for it in the future, see # https://github.com/holoviz/colorcet/pull/76. rm -vf '%{buildroot}%{_bindir}/colorcet' %check # Based loosely on https://github.com/holoviz/colorcet/raw/v%%{version}/tox.ini # commands: unit %pytest colorcet # commands: unit_extra # Test the repository in the source tree so that tests have baseline images: PYTHONPATH="${PWD}" %pytest colorcet --mpl colorcet/tests # We cannot run the “examples” test command because nbsmoke is not packaged. %files -n python3-colorcet -f %{pyproject_files} %license LICENSE.txt %doc README.md %changelog * mar. déc. 28 2021 Benjamin A. Beasley 3.0.0-1 - Initial package (close RHBZ#2022153)