python-OWSLib/python-OWSLib.spec

208 lines
6.8 KiB
RPMSpec

# Works with either ElementTree or python-lxml
# No pyproj for Python 3 in EPEL7
%bcond_with python3
Name: python-OWSLib
Version: 0.9.2
Release: %autorelease
Summary: Client library for OGC web services
License: BSD-3-Clause
URL: http://geopython.github.io/OWSLib
%global forgeurl https://github.com/geopython/OWSLib
Source0: %{forgeurl}/archive/%{version}/OWSLib-%{version}.tar.gz
# use only lxml for XML handling
# Backport of PR#863 (https://github.com/geopython/OWSLib/pull/863) to 0.9.2
# Fixes: CVE-2023-27476 https://nvd.nist.gov/vuln/detail/CVE-2023-27476
# GHSA-8h9c-r582-mggc https://github.com/geopython/OWSLib/security/advisories/GHSA-8h9c-r582-mggc
# RHBZ#2176417 https://bugzilla.redhat.com/show_bug.cgi?id=2176417
Patch0: 0001-use-only-lxml-for-XML-handling.patch
BuildArch: noarch
%global common_description %{expand:
Package for client programming with Open Geospatial Consortium (OGC) web
service (hence OWS) interface standards, and their related content models.}
%description %{common_description}
%package -n python2-OWSLib
Summary: %{summary}
%{?python_provide:%python_provide python2-OWSLib}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-pytest
BuildRequires: python2-dateutil >= 1.5
BuildRequires: python2-requests >= 1.0
BuildRequires: python2-pytz
BuildRequires: pyproj
BuildRequires: python-lxml
Requires: python2-dateutil >= 1.5
Requires: python2-requests >= 1.0
Requires: python2-pytz
Requires: python2-pyproj
Requires: python-lxml
%description -n python2-OWSLib %{common_description}
%if %{with python3}
%package -n python%{python3_pkgversion}-OWSLib
Summary: %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-OWSLib}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-dateutil >= 1.5
BuildRequires: python%{python3_pkgversion}-requests >= 1.0
BuildRequires: python%{python3_pkgversion}-pytz
BuildRequires: python%{python3_pkgversion}-pyproj
BuildRequires: python%{python3_pkgversion}-lxml
Requires: python%{python3_pkgversion}-dateutil >= 1.5
Requires: python%{python3_pkgversion}-requests >= 1.0
Requires: python%{python3_pkgversion}-pytz
Requires: python%{python3_pkgversion}-pyproj
Requires: python%{python3_pkgversion}-lxml
%description -n python%{python3_pkgversion}-OWSLib %{common_description}
%endif
%prep
%autosetup -n OWSLib-%{version} -p1
rm -rf OWSLib.egg-info
# Remove shebangs from non-script sources. The find-then-modify pattern
# preserves mtimes on sources that did not need to be modified.
find 'owslib' -type f -name '*.py' \
-exec gawk '/^#!/ { print FILENAME }; { nextfile }' '{}' '+' |
xargs -r sed -r -i '1{/^#!/d}'
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
sed -r -i 's/--cov[^[:blank:]=]*([=[:blank:]][^-][^[:blank:]]+)?//g' tox.ini
%build
%py2_build
%if %{with python3}
%py3_build
%endif
%install
%py2_install
%if %{with python3}
%py3_install
%endif
%check
# Otherwise, pytest finds the package twice in the Python path and complains.
rm -rf owslib
# In recent versions, 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 and txt)"
k="${k-}${k+ and }not (wfs_MapServerWFSFeature and txt)"
k="${k-}${k+ and }not (wfs_MapServerWFSCapabilities and txt)"
k="${k-}${k+ and }not (wfs2_storedqueries and txt)"
k="${k-}${k+ and }not (wfs1_generic and txt)"
k="${k-}${k+ and }not (wcs_thredds and txt)"
k="${k-}${k+ and }not (test_wmts_example_informatievlaanderen and txt)"
# These require network access, and would be covered by the “online” mark:
k="${k-}${k+ and }not (WebMapService and getmap)"
k="${k-}${k+ and }not (WebMapTileService and buildTileRequest)"
k="${k-}${k+ and }not (WebMapTileService and gettile)"
k="${k-}${k+ and }not (csw_gdp and txt)"
k="${k-}${k+ and }not (csw_geonetwork and txt)"
k="${k-}${k+ and }not (csw_geoserver and txt)"
k="${k-}${k+ and }not (csw_linz and txt)"
k="${k-}${k+ and }not (csw_ngdc and txt)"
k="${k-}${k+ and }not (csw_nlr and txt)"
k="${k-}${k+ and }not (csw_pycsw and txt)"
k="${k-}${k+ and }not (csw_pycsw_skip_caps and txt)"
k="${k-}${k+ and }not (csw_skgeodsy and txt)"
k="${k-}${k+ and }not (csw_uuid_constrain and txt)"
k="${k-}${k+ and }not (ows_interfaces and txt)"
k="${k-}${k+ and }not (sos_10_ndbc_getobservation and txt)"
k="${k-}${k+ and }not (tms and txt)"
k="${k-}${k+ and }not (wcs_idee and txt)"
k="${k-}${k+ and }not (wfs_USDASSURGO and txt)"
k="${k-}${k+ and }not (wms_JPLCapabilities and txt)"
k="${k-}${k+ and }not (wms_getfeatureinfo and txt)"
k="${k-}${k+ and }not (wmts and txt)"
k="${k-}${k+ and }not (wps_execute and txt)"
k="${k-}${k+ and }not (wps_execute_invalid_request and 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_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)"
# ____________ [doctest] tests/doctests/wms_GeoServerCapabilities.txt ____________
# 062 >>> x = wms['opengeo:poi'].styles
# 063 >>> x == {'point': {'legend': 'http://localhost:8080/geoserver/wms?request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=poi', 'title': 'A boring default style'}}
# 064 True
# 065
# 066 Test nested layer
# 067
# 068 >>> wms['parent_layer'].title
# 069 'Parent Layer'
# 070
# 071 >>> wms['parent_layer'].queryable
# Expected:
# 1
# Got:
# 0
k="${k-}${k+ and } not (wms_GeoServerCapabilities and txt)"
PYTHONPATH='%{buildroot}%{python2_sitelib}' PYTHONDONTWRITEBYTECODE=1 \
%{python2} -m pytest -m 'not online' -k "${k-}"
%if %{with python3}
PYTHONPATH='%{buildroot}%{python3_sitelib}' PYTHONDONTWRITEBYTECODE=1 \
%{python3} -m pytest -m 'not online' -k "${k-}"
%endif
%files -n python2-OWSLib
%license LICENSE.txt
%doc CHANGES.txt
%doc CREDITS.txt
%doc FAQ.txt
%doc HISTORY.txt
%doc README.txt
%{python2_sitelib}/owslib/
%{python2_sitelib}/OWSLib-%{version}-py%{python2_version}.egg-info
%if %{with python3}
%files -n python%{python3_pkgversion}-OWSLib
%license LICENSE.txt
%doc CHANGES.txt
%doc CREDITS.txt
%doc FAQ.txt
%doc HISTORY.txt
%doc README.txt
%{python3_sitelib}/owslib/
%{python3_sitelib}/OWSLib-%{version}-py%{python3_version}.egg-info
%endif
%changelog
%autochangelog