Backport to EPEL8 (close RHBZ#1974684)

This commit is contained in:
Benjamin A. Beasley 2021-12-23 11:44:58 -05:00
commit a9e0873869

View file

@ -1,8 +1,12 @@
# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a substitute.
%bcond_without doc_pdf
# We can generate PDF documentation as a substitute. However, most of the
# necessary dependencies are not packaged for EPEL8 and probably never will be.
%bcond_with doc_pdf
# Tests require pytest >= 3.8 but EPEL8 has 3.4.2.
%bcond_with tests
Name: python-OWSLib
Version: 0.25.0
@ -17,11 +21,39 @@ BuildArch: noarch
BuildRequires: python3-devel
# requirements.txt:
BuildRequires: python3dist(python-dateutil) >= 1.5
BuildRequires: python3dist(pytz)
BuildRequires: python3dist(requests) >= 1.0
BuildRequires: python3dist(pyproj) >= 2
BuildRequires: python3dist(pyyaml)
# python_version < '3.7':
BuildRequires: python3dist(dataclasses)
# requirements-dev.txt
# flake8
# pytest-cov
# twine
# wheel
# coverage
# coveralls
# tox
%if %{with tests}
BuildRequires: python3dist(pytest) >= 3.8
%endif
%if %{with doc_pdf}
BuildRequires: make
BuildRequires: python3-sphinx-latex
BuildRequires: latexmk
BuildRequires: pandoc
# requirements-dev.txt
BuildRequires: python3dist(sphinx)
BuildRequires: python3dist(Pillow)
BuildRequires: python3dist(nbsphinx)
BuildRequires: python3dist(ipykernel)
BuildRequires: python3dist(nbconvert)
BuildRequires: python3dist(pandoc)
%endif
%global common_description %{expand: \
@ -41,6 +73,9 @@ numerous OGC Web Service interfaces.}
%package -n python3-OWSLib
Summary: %{summary}
%py_provides python3-OWSLib
%py_provides python3-owslib
%description -n python3-OWSLib
%{common_description}
@ -55,18 +90,10 @@ Summary: Documentation and examples for OWSLib
%prep
%autosetup -n OWSLib-%{version}
%if %{with tests}
# Dont analyze/report test coverage
sed -r -i 's/[-]-cov[^[:blank:]]*[[:blank:]][^[[:blank:]]+//g' tox.ini
# Dont generate linting/coverage dependencies.
#
# We dont have python3dist(pandoc) packaged, and besides, we dont actually
# need python3dist(pandoc)—only the pandoc command-line tool, which we have
# manually BRd.
#
# Dont generate twine dependency, which is just for the upstream maintainer
# uploading to PyPI.
sed -r '/^(flake8|pytest-cov|pandoc|coverage|coveralls|twine)\b/d' \
requirements-dev.txt > requirements-dev-filtered.txt
%endif
# We dont need shebangs in the examples. The pattern of selecting files
# before modifying them with sed keeps us from unnecessarily discarding the
@ -82,12 +109,8 @@ chmod -v a-x examples/*.py
echo 'nbsphinx_allow_errors = True' >> docs/conf.py
%generate_buildrequires
%pyproject_buildrequires -r requirements-dev-filtered.txt
%build
%pyproject_wheel
%py3_build
%if %{with doc_pdf}
PYTHONPATH="${PWD}" %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}'
@ -96,11 +119,11 @@ PYTHONPATH="${PWD}" %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}'
%install
%pyproject_install
%pyproject_save_files owslib
%py3_install
%check
%if %{with tests}
# Otherwise, pytest finds the package twice in the Python path and complains.
rm -rf owslib
@ -137,16 +160,86 @@ k="${k-}${k+ and } not (TestOffline and test_wfs_200_remotemd_parse_single)"
k="${k-}${k+ and } not (TestOffline and test_wms_130_remotemd_parse_all)"
k="${k-}${k+ and } not (TestOffline and test_wms_130_remotemd_parse_single)"
%pytest -m 'not online' -k "${k-}"
PYTHONPATH='%{buildroot}%{python3_sitelib}' '%{python3}' -m pytest \
-m 'not online' -k "${k-}"
%else
%{py3_check_import owslib
owslib
owslib.coverage
owslib.coverage.wcs100
owslib.coverage.wcs110
owslib.coverage.wcs111
owslib.coverage.wcs200
owslib.coverage.wcs201
owslib.coverage.wcsBase
owslib.coverage.wcsdecoder
owslib.crs
owslib.csw
owslib.dif
owslib.etree
owslib.feature
owslib.feature.common
owslib.feature.postrequest
owslib.feature.schema
owslib.feature.wfs100
owslib.feature.wfs110
owslib.feature.wfs200
owslib.fes
owslib.fgdc
owslib.gm03
owslib.interfaces
owslib.iso
owslib.iso_che
owslib.map
owslib.map.common
owslib.map.wms111
owslib.map.wms130
owslib.namespaces
owslib.ogcapi
owslib.ogcapi.coverages
owslib.ogcapi.features
owslib.ogcapi.records
owslib.ows
owslib.owscontext
owslib.owscontext.atom
owslib.owscontext.common
owslib.owscontext.core
owslib.owscontext.geojson
owslib.sos
owslib.swe
owslib.swe.common
owslib.swe.observation
owslib.swe.observation.om
owslib.swe.observation.sos100
owslib.swe.observation.sos200
owslib.swe.observation.waterml2
owslib.swe.sensor
owslib.swe.sensor.sml
owslib.tms
owslib.util
owslib.waterml
owslib.waterml.wml
owslib.waterml.wml10
owslib.waterml.wml11
owslib.wcs
owslib.wfs
owslib.wmc
owslib.wms
owslib.wmts
owslib.wps}
%endif
%files -n python3-OWSLib -f %{pyproject_files}
# pyproject_files handles LICENSE; verify with “rpm -qL -p …”
%files -n python3-OWSLib
%license LICENSE
%doc AUTHORS.rst
%doc CHANGES.rst
%doc README.rst
%{python3_sitelib}/owslib
%{python3_sitelib}/OWSLib-%{version}-py%{python3_version}.egg-info
%files doc
%license LICENSE