diff options
Diffstat (limited to 'gis/OWSLib')
-rw-r--r-- | gis/OWSLib/OWSLib.SlackBuild | 17 | ||||
-rw-r--r-- | gis/OWSLib/OWSLib.info | 12 | ||||
-rw-r--r-- | gis/OWSLib/remove_dependency_on_pytz.patch | 103 |
3 files changed, 120 insertions, 12 deletions
diff --git a/gis/OWSLib/OWSLib.SlackBuild b/gis/OWSLib/OWSLib.SlackBuild index fdc27f9965..2386de2d22 100644 --- a/gis/OWSLib/OWSLib.SlackBuild +++ b/gis/OWSLib/OWSLib.SlackBuild @@ -2,6 +2,7 @@ # Slackware build script for OWSLib +# Copyright 2023-2024 Giancarlo Dessi, Cagliari, IT # Copyright 2013-2021 Benjamin Trigona-Harany <slackbuilds@jaxartes.net> # All rights reserved. # @@ -25,8 +26,8 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=OWSLib -VERSION=${VERSION:-0.24.1} -BUILD=${BUILD:-1} +VERSION=${VERSION:-0.30.0} +BUILD=${BUILD:-3} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -38,9 +39,6 @@ if [ -z "$ARCH" ]; then esac fi -# If the variable PRINT_PACKAGE_NAME is set, then this script will report what -# the name of the created package would be, and then exit. This information -# could be useful to other scripts. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 @@ -79,13 +77,20 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +# This removes code fragments depending on pytz, not required in -current +# thanks to Brent Spillner +# https://github.com/spillner/OWSLib/commit/1848bea97a9af6e2e5a69dad46af606c73cffb0c +if [ -x /usr/bin/python3.11 ]; then + patch -p1 < $CWD/remove_dependency_on_pytz.patch +fi + python3 setup.py install --root=$PKG find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a CHANGES.rst LICENSE README.rst $PKG/usr/doc/$PRGNAM-$VERSION +cp -a AUTHORS.rst LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/gis/OWSLib/OWSLib.info b/gis/OWSLib/OWSLib.info index e907627074..09f5fb5be7 100644 --- a/gis/OWSLib/OWSLib.info +++ b/gis/OWSLib/OWSLib.info @@ -1,10 +1,10 @@ PRGNAM="OWSLib" -VERSION="0.24.1" +VERSION="0.30.0" HOMEPAGE="https://pypi.python.org/pypi/OWSLib/" -DOWNLOAD="https://github.com/geopython/OWSLib/archive/0.24.1/OWSLib-0.24.1.tar.gz" -MD5SUM="f1ebd84931da238128a1245f24de3a39" +DOWNLOAD="https://github.com/geopython/OWSLib/archive/0.30.0/OWSLib-0.30.0.tar.gz" +MD5SUM="c2ba9d5fd13b4c8795153e89c0c65322" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="python3-dateutil pytz lxml" -MAINTAINER="Benjamin Trigona-Harany" -EMAIL="slackbuilds@jaxartes.net" +REQUIRES="python3-dateutil pytz python3-lxml" +MAINTAINER="Giancarlo Dessi" +EMAIL="slack@giand.it" diff --git a/gis/OWSLib/remove_dependency_on_pytz.patch b/gis/OWSLib/remove_dependency_on_pytz.patch new file mode 100644 index 0000000000..85d4f6ad43 --- /dev/null +++ b/gis/OWSLib/remove_dependency_on_pytz.patch @@ -0,0 +1,103 @@ +diff --git a/etc/RPM/python-owslib.spec b/etc/RPM/python-owslib.spec +index 96f8599de..8dfad75df 100644 +--- a/etc/RPM/python-owslib.spec ++++ b/etc/RPM/python-owslib.spec +@@ -25,7 +25,7 @@ BuildRequires: python-devel + BuildRequires: python-setuptools + BuildRequires: fdupes + Requires: python +-Requires: python-dateutil python-pytz ++Requires: python-dateutil + + %description + OWSLib is a Python package for client programming with Open Geospatial Consortium (OGC) web service (hence OWS) interface standards, and their related content models. +diff --git a/owslib/util.py b/owslib/util.py +index 7894aa729..c715b3ce0 100644 +--- a/owslib/util.py ++++ b/owslib/util.py +@@ -12,8 +12,7 @@ + import sys + from collections import OrderedDict + from dateutil import parser +-from datetime import datetime, timedelta +-import pytz ++from datetime import datetime, timedelta, tzinfo + from owslib.etree import etree, ParseError + from owslib.namespaces import Namespaces + from urllib.parse import urlsplit, urlencode, urlparse, parse_qs, urlunparse, parse_qsl +@@ -38,6 +37,20 @@ class ServiceException(Exception): + pass + + ++# Allows marking timestamps as UTC without pulling in all of Pytz ++class TimeZone_UTC(tzinfo): ++ def tzname(self, dt): ++ return "UTC" ++ ++ def utcoffset(self, dt): ++ return timedelta(0) ++ ++ def dst(self, dt): ++ return timedelta(0) ++ ++tz_utc = TimeZone_UTC() ++ ++ + # http://stackoverflow.com/questions/6256183/combine-two-dictionaries-of-dictionaries-python + def dict_union(d1, d2): + return dict((x, (dict_union(d1.get(x, {}), d2[x]) if isinstance(d2.get(x), dict) else d2.get(x, d1.get(x)))) +@@ -649,8 +662,7 @@ def extract_time(element): + except Exception: + att = testXMLValue(element.attrib.get('indeterminatePosition'), True) + if att and att == 'now': +- dt = datetime.utcnow() +- dt.replace(tzinfo=pytz.utc) ++ dt = datetime.utcnow().replace(tzinfo=tz_utc) + else: + dt = None + return dt +diff --git a/requirements.txt b/requirements.txt +index c1b2c09bd..1531aa42f 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,6 +1,5 @@ + dataclasses; python_version < '3.7' + lxml + python-dateutil>=1.5 +-pytz + pyyaml + requests>=1.0 +diff --git a/tests/doctests/sml_52n_network.txt b/tests/doctests/sml_52n_network.txt +index 010fbb6b5..94add7ddc 100644 +--- a/tests/doctests/sml_52n_network.txt ++++ b/tests/doctests/sml_52n_network.txt +@@ -3,7 +3,6 @@ Imports + >>> from tests.utils import resource_file + >>> from owslib.swe.sensor.sml import SensorML + >>> from dateutil import parser +- >>> import pytz + + Initialize + +diff --git a/tests/doctests/sml_ndbc_station.txt b/tests/doctests/sml_ndbc_station.txt +index bd2ecf3af..bda0e559a 100644 +--- a/tests/doctests/sml_ndbc_station.txt ++++ b/tests/doctests/sml_ndbc_station.txt +@@ -3,7 +3,7 @@ Imports + >>> from tests.utils import resource_file + >>> from owslib.swe.sensor.sml import SensorML + >>> from dateutil import parser +- >>> import pytz ++ >>> from owslib.util import TimeZone_UTC + + Initialize + +@@ -104,7 +104,7 @@ History + 2 + + >>> event = his[0] +- >>> parser.parse(event.date).replace(tzinfo=pytz.utc).isoformat() ++ >>> parser.parse(event.date).replace(tzinfo=TimeZone_UTC()).isoformat() + '2010-01-12T00:00:00+00:00' + >>> event.description + 'Deployment start event' |