diff --git a/.gitignore b/.gitignore index 45464ab..7c7afe7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,39 +6,4 @@ /OWSLib-0.8.12.tar.gz /OWSLib-0.8.13.tar.gz /OWSLib-0.9.0.tar.gz -/OWSLib-0.9.1.tar.gz /OWSLib-0.9.2.tar.gz -/OWSLib-0.10.0.tar.gz -/OWSLib-0.10.1.tar.gz -/OWSLib-0.10.3.tar.gz -/OWSLib-0.11.0.tar.gz -/OWSLib-0.11.1.tar.gz -/OWSLib-0.11.2.tar.gz -/OWSLib-0.12.0.tar.gz -/OWSLib-0.13.0.tar.gz -/OWSLib-0.14.0.tar.gz -/OWSLib-0.15.0.tar.gz -/OWSLib-0.16.0.tar.gz -/OWSLib-0.17.0.tar.gz -/OWSLib-0.18.0.tar.gz -/OWSLib-0.19.0.tar.gz -/OWSLib-0.19.1.tar.gz -/OWSLib-0.20.0.tar.gz -/OWSLib-0.21.0.tar.gz -/OWSLib-0.25.0.tar.gz -/OWSLib-0.26.0.tar.gz -/OWSLib-0.27.2.tar.gz -/OWSLib-0.28.0.tar.gz -/OWSLib-0.28.1.tar.gz -/OWSLib-0.29.0.tar.gz -/OWSLib-0.29.1.tar.gz -/OWSLib-0.29.2.tar.gz -/OWSLib-0.29.3.tar.gz -/OWSLib-0.30.0.tar.gz -/OWSLib-0.30.0-filtered.tar.zst -/OWSLib-0.31.0-filtered.tar.zst -/OWSLib-0.32.0-filtered.tar.zst -/OWSLib-0.33.0-filtered.tar.zst -/OWSLib-0.34.0-filtered.tar.zst -/OWSLib-0.34.1-filtered.tar.zst -/OWSLib-0.35.0-filtered.tar.zst diff --git a/0001-use-only-lxml-for-XML-handling.patch b/0001-use-only-lxml-for-XML-handling.patch new file mode 100644 index 0000000..0e5e450 --- /dev/null +++ b/0001-use-only-lxml-for-XML-handling.patch @@ -0,0 +1,232 @@ +From 2f81f2b36c01b2a32e8dcf6b2c695b36b1eb0b8f Mon Sep 17 00:00:00 2001 +From: Tom Kralidis +Date: Fri, 24 Feb 2023 10:15:35 -0500 +Subject: [PATCH] use only lxml for XML handling + +Backport of PR#863 (https://github.com/geopython/OWSLib/pull/863) to 0.9.2 +--- + owslib/etree.py | 58 ++++++++--------------------- + owslib/util.py | 96 ++++++++++++++++++------------------------------ + requirements.txt | 1 + + 3 files changed, 52 insertions(+), 103 deletions(-) + +diff --git a/owslib/etree.py b/owslib/etree.py +index b8babe8..88ae7ab 100644 +--- a/owslib/etree.py ++++ b/owslib/etree.py +@@ -6,9 +6,15 @@ + + from __future__ import (absolute_import, division, print_function) + import six +-import inspect + +-def patch_well_known_namespaces(etree_module): ++from lxml import etree ++from lxml.etree import ParseError ++ElementType = etree._Element ++ ++from owslib.namespaces import Namespaces ++ ++def patch_well_known_namespaces(): ++ """Monkey patches lxml.etree to add some well-known namespaces.""" + + import warnings + from owslib.namespaces import Namespaces +@@ -17,50 +23,18 @@ def patch_well_known_namespaces(etree_module): + """Monkey patches the etree module to add some well-known namespaces.""" + + try: +- register_namespace = etree_module.register_namespace ++ register_namespace = etree.register_namespace + except AttributeError: +- try: +- etree_module._namespace_map ++ etree._namespace_map + +- def register_namespace(prefix, uri): +- etree_module._namespace_map[uri] = prefix +- except AttributeError: +- def register_namespace(prefix, uri): +- pass +- warnings.warn("Only 'lxml.etree' >= 2.3 and 'xml.etree.ElementTree' >= 1.3 are fully supported!") ++ def register_namespace(prefix, uri): ++ etree._namespace_map[uri] = prefix + + for k, v in six.iteritems(ns.get_namespaces()): + register_namespace(k, v) + +-# try to find lxml or elementtree +-try: +- from lxml import etree +- from lxml.etree import ParseError +- ElementType = etree._Element +-except ImportError: +- try: +- # Python 2.x/3.x with ElementTree included +- import xml.etree.ElementTree as etree +- +- try: +- from xml.etree.ElementTree import ParseError +- except ImportError: +- from xml.parsers.expat import ExpatError as ParseError +- +- if hasattr(etree, 'Element') and inspect.isclass(etree.Element): +- # python 3.4, 3.3, 2.7 +- ElementType = etree.Element +- else: +- # python 2.6 +- ElementType = etree._ElementInterface +- +- except ImportError: +- try: +- # Python < 2.5 with ElementTree installed +- import elementtree.ElementTree as etree +- ParseError = StandardError # i can't find a ParseError related item in elementtree docs! +- ElementType = etree.Element +- except ImportError: +- raise RuntimeError('You need either lxml or ElementTree to use OWSLib!') ++ etree.set_default_parser( ++ parser=etree.XMLParser(resolve_entities=False) ++ ) + +-patch_well_known_namespaces(etree) ++patch_well_known_namespaces() +diff --git a/owslib/util.py b/owslib/util.py +index 22bcaa7..51ce6d0 100644 +--- a/owslib/util.py ++++ b/owslib/util.py +@@ -239,11 +239,8 @@ def nspath_eval(xpath, namespaces): + + def cleanup_namespaces(element): + """ Remove unused namespaces from an element """ +- if etree.__name__ == 'lxml.etree': +- etree.cleanup_namespaces(element) +- return element +- else: +- return etree.fromstring(etree.tostring(element)) ++ etree.cleanup_namespaces(element) ++ return element + + + def add_namespaces(root, ns_keys): +@@ -254,35 +251,34 @@ def add_namespaces(root, ns_keys): + + ns_keys = [(x, namespaces.get_namespace(x)) for x in ns_keys] + +- if etree.__name__ != 'lxml.etree': +- # We can just add more namespaces when not using lxml. +- # We can't re-add an existing namespaces. Get a list of current +- # namespaces in use +- existing_namespaces = set() +- for elem in root.getiterator(): +- if elem.tag[0] == "{": +- uri, tag = elem.tag[1:].split("}") +- existing_namespaces.add(namespaces.get_namespace_from_url(uri)) +- for key, link in ns_keys: +- if link is not None and key not in existing_namespaces: +- root.set("xmlns:%s" % key, link) +- return root +- else: +- # lxml does not support setting xmlns attributes +- # Update the elements nsmap with new namespaces +- new_map = root.nsmap +- for key, link in ns_keys: +- if link is not None: +- new_map[key] = link +- # Recreate the root element with updated nsmap +- new_root = etree.Element(root.tag, nsmap=new_map) +- # Carry over attributes +- for a, v in list(root.items()): +- new_root.set(a, v) +- # Carry over children +- for child in root: +- new_root.append(deepcopy(child)) +- return new_root ++ # lxml does not support setting xmlns attributes ++ # Update the elements nsmap with new namespaces ++ new_map = root.nsmap ++ for key, link in ns_keys: ++ if link is not None: ++ new_map[key] = link ++ # Recreate the root element with updated nsmap ++ new_root = etree.Element(root.tag, nsmap=new_map) ++ # Carry over attributes ++ for a, v in list(root.items()): ++ new_root.set(a, v) ++ # Carry over children ++ for child in root: ++ new_root.append(deepcopy(child)) ++ return new_root ++ ++ # We can just add more namespaces when not using lxml. ++ # We can't re-add an existing namespaces. Get a list of current ++ # namespaces in use ++ existing_namespaces = set() ++ for elem in root.iter(): ++ if elem.tag[0] == "{": ++ uri, tag = elem.tag[1:].split("}") ++ existing_namespaces.add(namespaces.get_namespace_from_url(uri)) ++ for key, link in ns_keys: ++ if link is not None and key not in existing_namespaces: ++ root.set("xmlns:%s" % key, link) ++ return root + + + def getXMLInteger(elem, tag): +@@ -401,20 +397,13 @@ def element_to_string(element, encoding=None, xml_declaration=False): + if encoding is None: + encoding = "ISO-8859-1" + +- if etree.__name__ == 'lxml.etree': +- if xml_declaration: +- if encoding in ['unicode', 'utf-8']: +- output = '\n%s' % \ +- etree.tostring(element, encoding='unicode') +- else: +- output = etree.tostring(element, encoding=encoding, xml_declaration=True) ++ if xml_declaration: ++ if encoding in ['unicode', 'utf-8']: ++ output = '\n%s' % \ ++ etree.tostring(element, encoding='unicode') + else: +- output = etree.tostring(element) ++ output = etree.tostring(element, encoding=encoding, xml_declaration=True) + else: +- if xml_declaration: +- output = '\n%s' % (encoding, +- etree.tostring(element, encoding=encoding)) +- else: + output = etree.tostring(element) + + return output +@@ -581,18 +570,3 @@ try: # 2.7 + from collections import OrderedDict + except: # 2.6 + from ordereddict import OrderedDict +- +- +-def which_etree(): +- """decipher which etree library is being used by OWSLib""" +- +- which_etree = None +- +- if 'lxml' in etree.__file__: +- which_etree = 'lxml.etree' +- elif 'xml/etree' in etree.__file__: +- which_etree = 'xml.etree' +- elif 'elementree' in etree.__file__: +- which_etree = 'elementtree.ElementTree' +- +- return which_etree +diff --git a/requirements.txt b/requirements.txt +index 7689a61..10ad5db 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,3 +1,4 @@ ++lxml + python-dateutil>=1.5 + pytz + requests>=1.0 +-- +2.39.2 + diff --git a/changelog b/changelog index 0daa747..f72eb58 100644 --- a/changelog +++ b/changelog @@ -1,142 +1,10 @@ -* Fri Jul 23 2021 Fedora Release Engineering - 0.21.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Fri Jun 04 2021 Python Maint - 0.21.0-3 -- Rebuilt for Python 3.10 - -* Wed Jan 27 2021 Fedora Release Engineering - 0.21.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Wed Dec 09 2020 Volker Fröhlich - 0.21.0-1 -- New upstream release - -* Tue Jul 28 2020 Fedora Release Engineering - 0.20.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Fri Jun 05 2020 Volker Fröhlich - 0.20.0-1 -- New upstream release - -* Tue May 26 2020 Miro Hrončok - 0.19.1-2 -- Rebuilt for Python 3.9 - -* Sun Feb 02 2020 Volker Fröhlich - 0.19.1-1 -- New upstream release - -* Thu Jan 30 2020 Fedora Release Engineering - 0.19.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Sun Jan 19 2020 Volker Fröhlich - 0.19.0-1 -- New upstream release - -* Thu Oct 03 2019 Miro Hrončok - 0.18.0-4 -- Rebuilt for Python 3.8.0rc1 (#1748018) - -* Mon Aug 19 2019 Miro Hrončok - 0.18.0-3 -- Rebuilt for Python 3.8 - -* Fri Jul 26 2019 Fedora Release Engineering - 0.18.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Wed Jun 26 2019 Volker Fröhlich - 0.18.0-1 -- New upstream release - -* Mon Feb 11 2019 Miro Hrončok - 0.17.0-3 -- Subpackage python2-owslib has been removed - See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal - -* Sat Feb 02 2019 Fedora Release Engineering - 0.17.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Wed Sep 19 2018 Volker Fröhlich - 0.17.0-1 -- New upstream release -- Update names of documentation files - -* Fri Jul 13 2018 Fedora Release Engineering - 0.16.0-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Tue Jun 19 2018 Miro Hrončok - 0.16.0-4 -- Rebuilt for Python 3.7 - -* Wed Feb 21 2018 Iryna Shcherbina - 0.16.0-3 -- Update Python 2 dependency declarations to new packaging standards - (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) - -* Fri Feb 09 2018 Fedora Release Engineering - 0.16.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Fri Dec 22 2017 Volker Fröhlich - 0.16.0-1 -- New upstream release - -* Thu Sep 14 2017 Volker Fröhlich - 0.15.0-1 -- New upstream release - -* Tue Aug 29 2017 Zbigniew Jędrzejewski-Szmek - 0.14.0-5 -- Add Provides for the old name - -* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 0.14.0-4 -- Python 2 binary package renamed to python2-owslib - See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 - -* Thu Jul 27 2017 Fedora Release Engineering - 0.14.0-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Sat Feb 11 2017 Fedora Release Engineering - 0.14.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Thu Jan 12 2017 Volker Fröhlich - 0.14.0-1 -- New upstream release - -* Mon Dec 19 2016 Miro Hrončok - 0.13.0-2 -- Rebuild for Python 3.6 - -* Sun Sep 25 2016 Volker Fröhlich - 0.13.0-1 -- New upstream release - -* Tue Sep 13 2016 Volker Fröhlich - 0.12.0-1 -- New upstream release -- Update URL and Source - -* Tue Jul 19 2016 Fedora Release Engineering - 0.11.2-2 -- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages - -* Mon May 16 2016 Volker Fröhlich - 0.11.2-1 -- New upstream release - -* Sat May 14 2016 Volker Fröhlich - 0.11.1-1 -- New upstream release - -* Fri Apr 1 2016 Volker Fröhlich - 0.11.0-1 -- New upstream release - -* Thu Feb 04 2016 Fedora Release Engineering - 0.10.3-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Mon Nov 23 2015 Volker Fröhlich - 0.10.3-1 -- New upstream release - -* Sun Nov 22 2015 Volker Fröhlich - 0.10.1-1 -- New upstream release - -* Thu Nov 12 2015 Fedora Release Engineering - 0.10.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 - -* Wed Nov 11 2015 Volker Fröhlich - 0.10.0-1 -- New upstream release - -* Tue Nov 10 2015 Fedora Release Engineering - 0.9.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 - -* Fri Sep 25 2015 Volker Fröhlich - 0.9.2-1 -- New upstream release - -* Sun Sep 6 2015 Volker Fröhlich - 0.9.1-2 -- Add pyproj dependency - -* Sun Sep 6 2015 Volker Fröhlich - 0.9.1-1 -- New upstream release - -* Thu Jun 18 2015 Fedora Release Engineering - 0.9.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild +* Wed Mar 08 2023 Benjamin A. Beasley - 0.9.0-2 +- Generally “modernize” packaging (by EPEL7 standards) +- Update License to SPDX +- Build the Python 3 sub-package on EPEL7 +- Switch to the GitHub source archive and run the offline tests +- Install more text documentation files +- Add dependency version bounds * Sat Jun 13 2015 Volker Fröhlich - 0.9.0-1 - New upstream release diff --git a/get_source b/get_source deleted file mode 100755 index 085fbb8..0000000 --- a/get_source +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -set -o nounset -set -o errexit - -FORGEURL='https://github.com/geopython/OWSLib' - -print_help() -{ - cat <&2 - print_help "${0}" - exit 1 -elif [ "${1-}" = '-h' ] || [ "${1-}" = '--help' ] -then - print_help "${0}" - exit 0 -fi - -VERSION="${1}" -SOURCE0="${FORGEURL}/archive/${VERSION}/OWSLib-${VERSION}.tar.gz" -TARNAME="$(basename "${SOURCE0}")" -TARDIR="$(basename "${SOURCE0}" '.tar.gz')" -NEWTAR="${TARDIR}-filtered.tar.zst" - -SAVEDIR="${PWD}" -XDIR="$(mktemp -d)" -trap "rm -rf '${XDIR}'" INT TERM EXIT - -cd "${XDIR}" -curl -L -O "${SOURCE0}" -echo "Extracting ${TARNAME}…" 1>&2 -tar -xzf "${TARNAME}" -MTIME="$(stat -c '%Y' "${TARDIR}")" -rm -rvf "${TARDIR}/tests/resources" -echo "Re-compressing as ${NEWTAR}…" 1>&2 -# https://www.gnu.org/software/tar/manual/html_section/Reproducibility.html -# We reset all mtimes to that of the top-level extracted directory; since git -# archives don’t have meaningful per-file mtimes, nothing useful is lost. -TZ=UTC LC_ALL=C tar \ - --create \ - --sort=name \ - --format=posix \ - --numeric-owner --owner=0 --group=0 \ - --mode=go+u,go-w \ - --pax-option='delete=atime,delete=ctime' \ - --clamp-mtime --mtime="@${MTIME}" \ - "${TARDIR}/" | - zstdmt --ultra -22 > "${NEWTAR}" -touch -d @"${MTIME}" "${NEWTAR}" - -cd "${SAVEDIR}" -mv -v "${XDIR}/${NEWTAR}" . diff --git a/python-OWSLib.rpmlintrc b/python-OWSLib.rpmlintrc deleted file mode 100644 index 694038d..0000000 --- a/python-OWSLib.rpmlintrc +++ /dev/null @@ -1,7 +0,0 @@ -# The source cannot be a URL because we have to filter out files before -# uploading to the lookaside cache. -addFilter(r" invalid-url .* OWSLib-.*-filtered\.tar\.zst") -# There is nothing wrong with .tar.zst, but rpmlint does not know that. -addFilter(r" inconsistent-file-extension .*\.tar\.zst") -# Removed without replacement in Fedora 42 -addFilter(r" obsolete-not-provided python-OWSLIB-doc") diff --git a/python-OWSLib.spec b/python-OWSLib.spec index a44a326..6f40df5 100644 --- a/python-OWSLib.spec +++ b/python-OWSLib.spec @@ -1,142 +1,207 @@ +# Works with either ElementTree or python-lxml + +# No pyproj for Python 3 in EPEL7 +%bcond_with python3 + Name: python-OWSLib -Version: 0.35.0 +Version: 0.9.2 Release: %autorelease -Summary: OGC Web Service utility library +Summary: Client library for OGC web services 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.zst -Source1: get_source +URL: http://geopython.github.io/OWSLib +%global forgeurl https://github.com/geopython/OWSLib +Source0: %{forgeurl}/archive/%{version}/OWSLib-%{version}.tar.gz -BuildSystem: pyproject -BuildOption(install): -l owslib +# 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 -# Tests; dependencies are in requirements-dev.txt. -BuildRequires: %{py3_dist pytest} -BuildRequires: %{py3_dist pytest_httpserver} -BuildRequires: %{py3_dist Pillow} -# We don’t have pytest-socket packaged, and we can get by without it. -# - pytest-socket -# We don’t use tox to run the tests. It would run "python3 setup.py develop", -# which is unwanted. -# - tox -# Unwanted linting/coverage dependencies: -# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters -# - coverage -# - coveralls -# - flake8 -# - pytest-cov -# These are just for the maintainer to upload to PyPI. -# - build -# - twine - %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.} +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 python3-OWSLib +%package -n python2-OWSLib Summary: %{summary} -%py_provides python3-owslib +%{?python_provide:%python_provide python2-OWSLib} -# The -doc subpackage was removed for Fedora 42; we can remove this Obsoletes -# after Fedora 44. (EPEL10 never had a -doc subpackage.) -Obsoletes: python-OWSLIB-doc < 0.32.0-1 +BuildRequires: python2-devel +BuildRequires: python2-setuptools +BuildRequires: python2-pytest -%description -n python3-OWSLib %{common_description} +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: pyproj +Requires: python-lxml + +%description -n python2-OWSLib %{common_description} -%prep -a -# Don’t analyze/report test coverage -sed -r -i 's/^([[:blank:]]*)(--cov\b)/\1# \2/' tox.ini +%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 -%check -a +%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 -# 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" -k="${k-}${k+ and }not test_metadata" -k="${k-}${k+ and }not test_responsibility" -k="${k-}${k+ and }not test_distributor" -k="${k-}${k+ and }not test_online_distribution" -k="${k-}${k+ and }not test_identification" -k="${k-}${k+ and }not test_identification_contact" -k="${k-}${k+ and }not test_identification_date" -k="${k-}${k+ and }not test_identification_extent" -k="${k-}${k+ and }not test_identification_keywords" -k="${k-}${k+ and }not test_get_all_contacts" -k="${k-}${k+ and }not test_aus" -k="${k-}${k+ and }not test_service" -k="${k-}${k+ and }not test_md_featurecataloguedesc" -k="${k-}${k+ and }not test_md_imagedescription" -k="${k-}${k+ and }not test_dq_dataquality" -k="${k-}${k+ and }not test_md_reference_system" -k="${k-}${k+ and }not test_service2" -k="${k-}${k+ and }not test_md_distribution" +# 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)" -%pytest -m 'not online' -k "${k-}" ${ignore-} -v -rs +# 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 python3-OWSLib -f %{pyproject_files} -%doc README.md +%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 diff --git a/sources b/sources index da0ff49..e64051e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (OWSLib-0.35.0-filtered.tar.zst) = be1eb52fa09049b720c1ebd476363e01c6442c9905c9adf0d35ccc11f39b228b9f3e64ed882a7c04987f2f38f9c8500a61aeef61e48a41602098ff22df0ed526 +SHA512 (OWSLib-0.9.2.tar.gz) = 1818299d702053b344edd435417785c8dd1c4d811a8bff7919c04624cf62a9324c856604965706f0416bea827dab3e5650b1f1cf6730b1b424535673f90e4cf0