diff options
author | Giancarlo Dessi <slack@giand.it> | 2024-05-06 07:45:06 +0900 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-05-11 06:51:51 +0700 |
commit | 507cdeb2816c22ee38fd882411c2ab338d00772f (patch) | |
tree | 42fe734a881f2b917cea2c8f686f261d4bc24c62 | |
parent | fa0e263c94277381cd7f97677e10c18d28f4fbf1 (diff) |
gis/OWSLib: Updates.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | gis/OWSLib/OWSLib.SlackBuild | 9 | ||||
-rw-r--r-- | gis/OWSLib/pytz-not-required.patch | 13 | ||||
-rw-r--r-- | gis/OWSLib/remove_dependency_on_pytz.patch | 103 |
3 files changed, 109 insertions, 16 deletions
diff --git a/gis/OWSLib/OWSLib.SlackBuild b/gis/OWSLib/OWSLib.SlackBuild index afdb8084e951..2386de2d2299 100644 --- a/gis/OWSLib/OWSLib.SlackBuild +++ b/gis/OWSLib/OWSLib.SlackBuild @@ -27,7 +27,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=OWSLib VERSION=${VERSION:-0.30.0} -BUILD=${BUILD:-2} +BUILD=${BUILD:-3} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -76,9 +76,12 @@ find -L . \ -o -perm 511 \) -exec chmod 755 {} \; -o \ \( -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/pytz-not-required.patch + patch -p1 < $CWD/remove_dependency_on_pytz.patch fi python3 setup.py install --root=$PKG diff --git a/gis/OWSLib/pytz-not-required.patch b/gis/OWSLib/pytz-not-required.patch deleted file mode 100644 index 03471b2d4d63..000000000000 --- a/gis/OWSLib/pytz-not-required.patch +++ /dev/null @@ -1,13 +0,0 @@ -python-pytz has been removed from Slackware -current because -not needed with Python 3.11 -This patch prevents pip check from indicating the lack of -pytz as dependency required by OWSLib in -current ---- ./requirements.txt 2024-04-05 23:42:52.864498274 +0200 -+++ ./requirements.txt 2024-04-05 23:43:13.322499915 +0200 -@@ -1,6 +1,5 @@ - dataclasses; python_version < '3.7' - lxml - python-dateutil>=1.5 --pytz - pyyaml - requests>=1.0 diff --git a/gis/OWSLib/remove_dependency_on_pytz.patch b/gis/OWSLib/remove_dependency_on_pytz.patch new file mode 100644 index 000000000000..85d4f6ad4319 --- /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' |