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

253 lines
7.2 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: Client library for OGC web services
License: BSD-3-Clause
URL: https://geopython.github.io/OWSLib
Source0: https://github.com/geopython/OWSLib/archive/%{version}/OWSLib-%{version}.tar.gz
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
# There is a convenient “online” mark for deselecting tests that require
# Internet access, but we still have to manually deselect doctests that try to
# make network requests.
k="${k-}${k+ and }not wms_geoserver_mass_gis.txt"
k="${k-}${k+ and }not wfs_MapServerWFSFeature.txt"
k="${k-}${k+ and }not wfs_MapServerWFSCapabilities.txt"
k="${k-}${k+ and }not wfs2_storedqueries.txt"
k="${k-}${k+ and }not wfs1_generic.txt"
k="${k-}${k+ and }not wcs_thredds.txt"
k="${k-}${k+ and }not test_wmts_example_informatievlaanderen"
# This is a trivial error where the representation of the expected TypeError
# has changed over time:
# Differences (unified diff with -expected +actual):
# @@ -1,3 +1,6 @@
# Traceback (most recent call last):
# -...
# -TypeError: get_namespace() ...
# + File "/usr/lib64/python3.10/doctest.py", line 1346, in __run
# + exec(compile(example.source, filename, "single",
# + File "<doctest namespaces.txt[15]>", line 1, in <module>
# + ns.get_namespace()
# +TypeError: Namespaces.get_namespace() missing 1 required positional argument: 'key'
k="${k-}${k+ and }not namespaces.txt"
# Unknown problem—check if it is fixed in a later version:
k="${k-}${k+ and } not (TestOffline and test_wfs_110_remotemd_parse_all)"
k="${k-}${k+ and } not (TestOffline and test_wfs_110_remotemd_parse_single)"
k="${k-}${k+ and } not (TestOffline and test_wfs_200_remotemd_parse_all)"
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)"
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 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