python-OWSLib/python-OWSLib.spec
2024-11-13 11:45:47 -05:00

271 lines
8 KiB
RPMSpec
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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. 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.28.1
Release: %autorelease
Summary: OGC Web Service utility library
License: BSD-3-Clause
URL: https://geopython.github.io/OWSLib
# A filtered source archive, obtained by (see Source1):
#
# ./get_source %%{version}
#
# is required because tests/resources/ contains XML data files that appear to
# have been pulled from various GIS databases, and the license terms for these
# files are unclear.
#
# The unfiltered base source URL would be:
#
# https://github.com/geopython/OWSLib/archive/%%{version}/OWSLib-%%{version}.tar.gz
#
# We *could* use the PyPI sdist, which does not contain tests/resources/, but
# it also does not contain any tests at all. We can still run some tests
# without the XML files, and we would like to do so.
Source0: OWSLib-%{version}-filtered.tar.xz
Source1: get_source
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
# requirements.txt:
BuildRequires: python%{python3_pkgversion}-dateutil >= 1.5
BuildRequires: python%{python3_pkgversion}-pytz
BuildRequires: python%{python3_pkgversion}-requests >= 1.0
BuildRequires: python%{python3_pkgversion}-pyproj >= 2
BuildRequires: python%{python3_pkgversion}-pyyaml
BuildRequires: python%{python3_pkgversion}-lxml
# python_version < '3.7':
BuildRequires: python%{python3_pkgversion}-dataclasses
# requirements-dev.txt
# flake8
# pytest-cov
# twine
# wheel
# coverage
# coveralls
# tox
%if %{with tests}
BuildRequires: python%{python3_pkgversion}-pytest >= 3.8
%endif
%if %{with doc_pdf}
BuildRequires: make
BuildRequires: python%{python3_pkgversion}-sphinx-latex
BuildRequires: latexmk
BuildRequires: pandoc
# requirements-dev.txt
BuildRequires: python%{python3_pkgversion}-sphinx
BuildRequires: python%{python3_pkgversion}-Pillow
BuildRequires: python%{python3_pkgversion}-nbsphinx
BuildRequires: python%{python3_pkgversion}-ipykernel
BuildRequires: python%{python3_pkgversion}-nbconvert
BuildRequires: python%{python3_pkgversion}-pandoc
%endif
%global common_description %{expand:
OWSLib is a Python package for client programming with Open Geospatial
Consortium (OGC) web service (hence OWS) interface standards, and their related
content models.
Full documentation is available at http://geopython.github.io/OWSLib
OWSLib provides a common API for accessing service metadata and wrappers for
numerous OGC Web Service interfaces.}
%description %{common_description}
%package -n python%{python3_pkgversion}-OWSLib
Summary: %{summary}
%py_provides python%{python3_pkgversion}-OWSLib
%py_provides python%{python3_pkgversion}-owslib
%description -n python%{python3_pkgversion}-OWSLib %{common_description}
%package doc
Summary: Documentation and examples for OWSLib
%description doc %{common_description}
This package contains 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
%endif
# We dont need shebangs in the examples. The pattern of selecting files
# before modifying them with sed keeps us from unnecessarily discarding the
# original mtimes on unmodified files.
find 'examples' -type f -name '*.py' \
-exec gawk '/^#!/ { print FILENAME }; { nextfile }' '{}' '+' |
xargs -r sed -r -i '1{/^#!/d}'
# Some of them, but not all of them, were executable.
chmod -v a-x examples/*.py
# Because at least one notebook requires Internet access, we must continue past
# notebook errors when building documentation.
echo 'nbsphinx_allow_errors = True' >> docs/conf.py
%build
%py3_build
%if %{with doc_pdf}
PYTHONPATH="${PWD}" %make_build -C docs latex \
SPHINXOPTS='-j%{?_smp_build_ncpus}'
%make_build -C docs/build/latex/en LATEXMKOPTS='-quiet'
%endif
%install
%py3_install
%check
%if %{with tests}
# Otherwise, pytest finds the package twice in the Python path and complains.
rm -rf owslib
# These require test data files from tests/resources/, which we have removed:
ignore="${ignore-} --ignore-glob=tests/doctests/*.txt"
k="${k-}${k+ and }not test_gm03"
ignore="${ignore-} --ignore=tests/test_iso_parsing.py"
ignore="${ignore-} --ignore=tests/test_ows_interfaces.py"
ignore="${ignore-} --ignore=tests/test_owscontext_atomxml.py"
k="${k-}${k+ and }not test_decode_single_json"
k="${k-}${k+ and }not test_load_parse"
k="${k-}${k+ and }not test_decode_full_json"
k="${k-}${k+ and }not test_load_bulk"
ignore="${ignore-} --ignore=tests/test_remote_metadata.py"
k="${k-}${k+ and }not TestOffline"
ignore="${ignore-} --ignore=tests/test_wfs_generic.py"
ignore="${ignore-} --ignore=tests/test_wms_datageo_130.py"
ignore="${ignore-} --ignore=tests/test_wms_jpl_capabilities.py"
k="${k-}${k+ and }not test_wps_getOperationByName"
k="${k-}${k+ and }not test_wps_checkStatus"
k="${k-}${k+ and }not test_wps_process_representation"
k="${k-}${k+ and }not test_wps_process_properties"
k="${k-}${k+ and }not test_wps_literal_data_input_parsing_references"
k="${k-}${k+ and }not test_wps_response_with_lineage"
ignore="${ignore-} --ignore=tests/test_wps_describeprocess_bbox.py"
ignore="${ignore-} --ignore=tests/test_wps_describeprocess_ceda.py"
ignore="${ignore-} --ignore=tests/test_wps_describeprocess_emu_all.py"
ignore="${ignore-} --ignore=tests/test_wps_describeprocess_usgs.py"
ignore="${ignore-} --ignore=tests/test_wps_execute.py"
ignore="${ignore-} --ignore=tests/test_wps_execute_invalid_request.py"
ignore="${ignore-} --ignore=tests/test_wps_getcapabilities_52n.py"
ignore="${ignore-} --ignore=tests/test_wps_getcapabilities_ceda.py"
ignore="${ignore-} --ignore=tests/test_wps_getcapabilities_usgs.py"
ignore="${ignore-} --ignore-glob=tests/test_wps_request*.py"
ignore="${ignore-} --ignore-glob=tests/test_wps_response*.py"
# Not in 0.30.0:
k="${k-}${k+ and }not test_wmts_example_informatievlaanderen"
PYTHONPATH='%{buildroot}%{python3_sitelib}' '%{python3}' -m pytest \
-m 'not online' -k "${k-}" ${ignore-} -v -rs
%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 python%{python3_pkgversion}-OWSLib
%license LICENSE
%{python3_sitelib}/owslib
%{python3_sitelib}/OWSLib-%{version}-py%{python3_version}.egg-info
%files doc
%license LICENSE
%doc AUTHORS.rst
%doc CHANGES.rst
%doc README.rst
%doc examples
%if %{with doc_pdf}
%doc docs/build/latex/en/OWSLib.pdf
%endif
%changelog
%autochangelog