# This package buildrequires flit_core to build the wheel, but flit_core requires tomli. # To bootstrap, we copy the files to appropriate locations manually and create a minimal dist-info metadata. # Note that as a pure Python package, the wheel contains no pre-built binary stuff. # When bootstrap is enabled, we don't run tests either, just an import check. %bcond_without bootstrap Name: python-tomli Version: 1.2.3 Release: 1~bootstrap%{?dist} Summary: A little TOML parser for Python License: MIT URL: https://pypi.org/project/tomli/ Source0: https://github.com/hukkin/tomli/archive/%{version}/%{name}-%{version}.tar.gz # RHEL 8's pytest is too old and does not support the tmp_path filter. Patch0: 0001-tests-Replace-tmp_path-with-tmpdir-pytest-fixture.patch # RHEL 8's old dateutil is missing parser.isoparse. # This upstream change removes that dependency entirely. Patch1: https://github.com/hukkin/tomli/commit/a54d95e.patch#/Remove_python-dateutil_test_dependency BuildArch: noarch BuildRequires: python3-devel %if %{without bootstrap} BuildRequires: %{py3_dist flit-core} # Upstream test requirements are in tests/requirements.txt, # but they're mixed together with coverage ones. Tests only need: BuildRequires: %{py3_dist pytest} BuildRequires: %{py3_dist python-dateutil} %endif %global _description %{expand: Tomli is a Python library for parsing TOML. Tomli is fully compatible with TOML v1.0.0.} %description %_description %package -n python3-tomli Summary: %{summary} %description -n python3-tomli %_description %prep %autosetup -p1 -n tomli-%{version} %build %if %{without bootstrap} %{python3} -m flit_core.wheel %else %global distinfo tomli-%{version}+rpmbootstrap.dist-info mkdir %{distinfo} cat > %{distinfo}/METADATA << EOF Metadata-Version: 2.2 Name: tomli Version: %{version}+rpmbootstrap EOF %endif %install %if %{without bootstrap} %py3_install_wheel tomli-%{version}-py3-none-any.whl %else mkdir -p %{buildroot}%{python3_sitelib} cp -a tomli %{distinfo} %{buildroot}%{python3_sitelib} %endif %check %py3_check_import tomli %if %{without bootstrap} # assert the properly built package has no runtime requires # if it does, we need to change the bootstrap metadata test -f %{buildroot}%{python3_sitelib}/tomli-%{version}.dist-info/METADATA grep '^Requires-Dist:' %{buildroot}%{python3_sitelib}/tomli-%{version}.dist-info/METADATA && exit 1 || true %pytest %endif %files -n python3-tomli %doc README.md %doc CHANGELOG.md %license LICENSE %{python3_sitelib}/tomli %{python3_sitelib}/tomli-%{version}%{?with_bootstrap:+rpmbootstrap}.dist-info %changelog * Fri Oct 07 2022 Maxwell G - 1.2.3-2 - Initial EPEL 8 build