[packages/python-pytz] - updated to 2018.4 - updated zoneinfo patch - run unit tests

qboosh qboosh at pld-linux.org
Sat May 26 19:47:50 CEST 2018


commit db98e45dfa87a07bfb7b19474b3951917d4297a0
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat May 26 19:48:47 2018 +0200

    - updated to 2018.4
    - updated zoneinfo patch
    - run unit tests

 python-pytz.spec | 38 +++++++++++++++++++++++++------------
 zoneinfo.patch   | 57 ++++++++++++++++++++++++++++++--------------------------
 2 files changed, 57 insertions(+), 38 deletions(-)
---
diff --git a/python-pytz.spec b/python-pytz.spec
index 9c5a0ce..e77e103 100644
--- a/python-pytz.spec
+++ b/python-pytz.spec
@@ -2,6 +2,7 @@
 # Conditional build:
 %bcond_without	python2	# Python 2.x modules
 %bcond_without	python3	# Python 3.x modules
+%bcond_without	tests	# unit tests
 #
 # NOTE
 # - as we use system tzdata package, keeping this pkg up to the latest is
@@ -9,18 +10,20 @@
 #   newer version anyway, through egg dependencies
 %define 	module		pytz
 %define 	pypi_name	pytz
-%define 	olsonver	2016g
+%define 	olsonver	2018d
 Summary:	pytz - Olson timezone database in Python
 Summary(pl.UTF-8):	pytz - baza stref czasowych Olsona w Pythonie
 Name:		python-%{module}
-Version:	2016.7
-Release:	2
+Version:	2018.4
+Release:	1
 License:	MIT or ZPL v2.1
 Group:		Libraries/Python
-Source0:	https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.bz2
-# Source0-md5:	8d8121d619a43cf0b38a4195de1cb8a5
+#Source0Download: https://pypi.org/simple/pytz/
+Source0:	https://files.pythonhosted.org/packages/source/p/pytz/%{pypi_name}-%{version}.tar.gz
+# Source0-md5:	f054437920c895dd14a4509fabafe029
 Patch0:		zoneinfo.patch
 URL:		http://pytz.sourceforge.net/
+BuildRequires:	rpmbuild(macros) >= 1.714
 BuildRequires:	sed >= 4.0
 %if %{with python2}
 BuildRequires:	python >= 1:2.3
@@ -28,13 +31,10 @@ BuildRequires:	python-devel >= 1:2.3
 BuildRequires:	python-setuptools
 %endif
 %if %{with python3}
-BuildRequires:	python3-devel
+BuildRequires:	python3-devel >= 1:3.2
 BuildRequires:	python3-setuptools
 %endif
-BuildRequires:	rpmbuild(macros) >= 1.710
-%if %{with python2}
-Requires:	python >= 1:2.3
-%endif
+Requires:	python-modules >= 1:2.3
 Requires:	tzdata-zoneinfo >= %{olsonver}
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -54,6 +54,7 @@ przy użyciu Pythona w wersji co najmniej 2.3.
 Summary:	pytz - Olson timezone database in Python 3.x
 Summary(pl.UTF-8):	pytz - baza stref czasowych Olsona w Pythonie 3.x
 Group:		Libraries/Python
+Requires:	python3-modules >= 1:3.2
 Requires:	tzdata-zoneinfo >= %{olsonver}
 
 %description -n python3-%{module}
@@ -82,21 +83,34 @@ test "$v" = "%{olsonver}"
 %if %{with python2}
 %py_build
 %py_lint
+
+%if %{with tests}
+%{__python} -munittest discover -s pytz/tests
 %endif
+%endif
+
 %if %{with python3}
 %py3_build
+
+%if %{with tests}
+%{__python3} -munittest discover -s pytz/tests
+%endif
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
+
 %if %{with python2}
 %py_install
+
 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/pytz/zoneinfo
 %py_postclean
 %endif
 
 %if %{with python3}
 %py3_install
+
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/pytz/zoneinfo
 %endif
 
 %clean
@@ -105,7 +119,7 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %files
 %defattr(644,root,root,755)
-%doc CHANGES.txt LICENSE.txt README.txt
+%doc LICENSE.txt README.txt
 %{py_sitescriptdir}/pytz
 %{py_sitescriptdir}/pytz-%{version}-py*.egg-info
 %endif
@@ -113,7 +127,7 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python3}
 %files -n python3-%{module}
 %defattr(644,root,root,755)
-%doc CHANGES.txt LICENSE.txt README.txt
+%doc LICENSE.txt README.txt
 %{py3_sitescriptdir}/pytz
 %{py3_sitescriptdir}/pytz-%{version}-py*.egg-info
 %endif
diff --git a/zoneinfo.patch b/zoneinfo.patch
index 22b62d0..7661d4b 100644
--- a/zoneinfo.patch
+++ b/zoneinfo.patch
@@ -1,46 +1,51 @@
---- pytz-2016.7/pytz/__init__.py~	2016-10-17 23:41:37.000000000 +0300
-+++ pytz-2016.7/pytz/__init__.py	2016-10-17 23:44:26.782524661 +0300
-@@ -70,30 +70,18 @@
-         """
+--- pytz-2018.4/pytz/__init__.py.orig	2018-05-26 18:14:11.777750792 +0200
++++ pytz-2018.4/pytz/__init__.py	2018-05-26 19:37:10.177693947 +0200
+@@ -74,12 +74,13 @@
          return s.encode('ASCII')
  
+ 
 +_tzinfo_dir = os.getenv("TZDIR") or "/usr/share/zoneinfo"
 +if _tzinfo_dir.endswith(os.sep):
 +    _tzinfo_dir = _tzinfo_dir[:-1]
- 
++
  def open_resource(name):
      """Open a resource from the zoneinfo subdir for reading.
--
+ 
 -    Uses the pkg_resources module if available and no standard file
 -    found at the calculated location.
+-
+     It is possible to specify different location for zoneinfo
+     subdir by using the PYTZ_TZDATADIR environment variable.
      """
-     name_parts = name.lstrip('/').split('/')
-     for part in name_parts:
-         if part == os.path.pardir or os.path.sep in part:
-             raise ValueError('Bad path segment: %r' % part)
--    filename = os.path.join(os.path.dirname(__file__),
--                            'zoneinfo', *name_parts)
--    if not os.path.exists(filename):
--        # http://bugs.launchpad.net/bugs/383171 - we avoid using this
--        # unless absolutely necessary to help when a broken version of
--        # pkg_resources is installed.
--        try:
--            from pkg_resources import resource_stream
--        except ImportError:
--            resource_stream = None
+@@ -91,19 +92,7 @@
+     if zoneinfo_dir is not None:
+         filename = os.path.join(zoneinfo_dir, *name_parts)
+     else:
+-        filename = os.path.join(os.path.dirname(__file__),
+-                                'zoneinfo', *name_parts)
+-        if not os.path.exists(filename):
+-            # http://bugs.launchpad.net/bugs/383171 - we avoid using this
+-            # unless absolutely necessary to help when a broken version of
+-            # pkg_resources is installed.
+-            try:
+-                from pkg_resources import resource_stream
+-            except ImportError:
+-                resource_stream = None
 -
--        if resource_stream is not None:
--            return resource_stream(__name__, 'zoneinfo/' + name)
-+    filename = os.path.join(_tzinfo_dir, *name_parts)
+-            if resource_stream is not None:
+-                return resource_stream(__name__, 'zoneinfo/' + name)
++        filename = os.path.join(_tzinfo_dir, *name_parts)
      return open(filename, 'rb')
  
  
-@@ -489,11 +484,32 @@
+@@ -484,11 +473,33 @@
+ 
  if __name__ == '__main__':
      _test()
- 
 -all_timezones = LazyList(
 -        tz for tz in all_timezones if resource_exists(tz))
+-        
++
 +all_timezones = []
 +for root, dirs, files in os.walk(_tzinfo_dir):
 +    for exclude in "posix", "right":
@@ -52,7 +57,7 @@
 +                         if file != "README" and file != "Theory"
 +                         and "." not in file)
 +all_timezones.sort()
-         
++
  all_timezones_set = LazySet(all_timezones)
 -common_timezones = LazyList(
 -            tz for tz in common_timezones if tz in all_timezones)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-pytz.git/commitdiff/db98e45dfa87a07bfb7b19474b3951917d4297a0



More information about the pld-cvs-commit mailing list