%global pypi_name importlib_resources %global pkg_name importlib-resources %global _description\ importlib_resources is a backport of Python 3.7's standard \ library importlib.resources module for Python 2.7, and 3.4 through 3.6. \ Users of Python 3.7 and beyond should use the standard library module, since \ for these versions, importlib_resources just delegates to that module. \ The key goal of this module is to replace parts of pkg_resources with a \ solution in Python stdlib that relies on well-defined APIs. This makes \ reading resources included in packages easier, with more stable and consistent \ semantics. %if 0%{?fedora} > 31 %global with_python2 0 %else %global with_python2 1 %endif Name: python-%{pkg_name} Version: 1.0.2 Release: 1%{?dist} Summary: Read resources from Python packages License: Apache Software License URL: http://importlib-resources.readthedocs.io/ Source0: https://files.pythonhosted.org/packages/source/i/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch %if 0%{?with_python2} # Python 2 BuildRequires: python2-devel BuildRequires: python-setuptools %endif # Python 3 BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-pathlib2 BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-typing BuildRequires: python%{python3_pkgversion}-wheel BuildRequires: python%{python3_pkgversion}-sphinx %if 0%{?with_python3_other} BuildRequires: python%{python3_other_pkgversion}-devel BuildRequires: python%{python3_other_pkgversion}-pathlib2 BuildRequires: python%{python3_other_pkgversion}-setuptools BuildRequires: python%{python3_other_pkgversion}-typing BuildRequires: python%{python3_other_pkgversion}-wheel BuildRequires: python%{python3_other_pkgversion}-sphinx %endif %description %_description # Python 2 %if 0%{?with_python2} %package -n python2-%{pkg_name} Summary: %{summary} %{?python_provide:%python_provide python2-%{pkg_name}} Requires: python2-pathlib2 Requires: python2-typing %description -n python2-%{pkg_name} %_description %endif # Python 3 %package -n python%{python3_pkgversion}-%{pkg_name} Summary: %{summary} %{?python_provide:%python_provide python%{python3_pkgversion}-%{pkg_name}} Requires: python%{python3_pkgversion}-pathlib2 Requires: python%{python3_pkgversion}-typing %description -n python%{python3_pkgversion}-%{pkg_name} %_description %if 0%{?with_python3_other} %package -n python%{python3_other_pkgversion}-%{pkg_name} Summary: %{summary} %{?python_provide:%python_provide python%{python3_other_pkgversion}-%{pkg_name}} Requires: python%{python3_other_pkgversion}-pathlib2 Requires: python%{python3_other_pkgversion}-typing %description -n python%{python3_other_pkgversion}-%{pkg_name} %_description %endif %package -n python-%{pkg_name}-doc Summary: importlib_resources documentation %description -n python-%{pkg_name}-doc Documentation for importlib_resources %prep %autosetup -n %{pypi_name}-%{version} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info %build %if 0%{?with_python2} %py2_build %endif %py3_build %if 0%{?with_python3_other} %py3_other_build %endif # generate html docs PYTHONPATH=${PWD} sphinx-build-3 importlib_resources/docs html # remove the sphinx-build leftovers rm -rf html/.{doctrees,buildinfo} %install %if 0%{?with_python2} %py2_install # Remove the Py3-specific module that we can't compile on Py2. rm %{buildroot}%{python2_sitelib}/%{pypi_name}/_py3.py %endif %py3_install %if 0%{?with_python3_other} %py3_other_install %endif %check %if 0%{?with_python2} %{__python2} setup.py test %endif %{__python3} setup.py test %if 0%{?with_python3_other} %{__python3_other} setup.py test %endif %if 0%{?with_python2} %files -n python2-%{pkg_name} %license LICENSE %doc README.rst %{python2_sitelib}/%{pypi_name} %{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %endif %files -n python%{python3_pkgversion}-%{pkg_name} %license LICENSE %doc README.rst %{python3_sitelib}/%{pypi_name} %{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %if 0%{?with_python3_other} %files -n python%{python3_other_pkgversion}-%{pkg_name} %license LICENSE %doc README.rst %{python3_other_sitelib}/%{pypi_name} %{python3_other_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %endif %files -n python-%{pkg_name}-doc %doc html %license LICENSE %changelog * Mon Oct 07 2019 Aurelien Bompard - 1.0.2-1 - Initial package.