PSARC 2013/318 pytz - Python timezone database module s11-update
authorDanek Duvall <danek.duvall@oracle.com>
Mon, 06 Jan 2014 13:28:34 -0800
branchs11-update
changeset 2884 9ad800ee0577
parent 2882 09270bc18a9e
child 2887 07e16b692d34
PSARC 2013/318 pytz - Python timezone database module 17643680 pytz should be added to userland
components/python/pytz/Makefile
components/python/pytz/patches/zoneinfopath.patch
components/python/pytz/patches/zones.patch
components/python/pytz/pytz-PYVER.p5m
components/python/pytz/resolve.deps
components/python/pytz/runtests.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/pytz/Makefile	Mon Jan 06 13:28:34 2014 -0800
@@ -0,0 +1,57 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+#
+include ../../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		pytz
+COMPONENT_VERSION=	2013d
+HUMAN_VERSION=		$(COMPONENT_VERSION)
+IPS_COMPONENT_VERSION=	2013.4
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC).tar.gz
+COMPONENT_ARCHIVE_HASH=	\
+    sha256:4eee447b2102141dfc7d92b0536608616f152811a8adee2f120460f368ecc4c6
+COMPONENT_ARCHIVE_URL=	$(call pypi_url)
+COMPONENT_PROJECT_URL=	http://pytz.sourceforge.net/
+COMPONENT_BUGDB=	python-mod/pytz
+
+include $(WS_TOP)/make-rules/prep.mk
+include $(WS_TOP)/make-rules/setup.py.mk
+include $(WS_TOP)/make-rules/ips.mk
+
+ASLR_MODE = $(ASLR_NOT_APPLICABLE)
+
+COMPONENT_TEST_ARGS=	../runtests.sh
+COMPONENT_TEST_CMD=	/bin/sh
+COMPONENT_TEST_DIR=	$(SOURCE_DIR)
+COMPONENT_TEST_ENV+=	PYTHON=$(PYTHON)
+
+# common targets
+build:		$(BUILD_NO_ARCH)
+
+install:	$(INSTALL_NO_ARCH)
+
+test:		$(TEST_NO_ARCH)
+
+BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
+
+include $(WS_TOP)/make-rules/depend.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/pytz/patches/zoneinfopath.patch	Mon Jan 06 13:28:34 2014 -0800
@@ -0,0 +1,53 @@
+pytz by default ships a private copy of the Olson timezone database, for
+operating systems that don't ship their own.  Since Solaris does, we should
+point at that copy.  The extra table files are in different places between
+the two, so we adjust those paths as well.
+
+--- pytz-2013d/pytz/__init__.py	Thu Sep  5 06:42:03 2013
++++ pytz-2013d/pytz/__init__.py	Tue Oct 22 15:10:47 2013
+@@ -88,8 +88,7 @@
+     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)
++    filename = os.path.join('/usr/share/lib/zoneinfo', *name_parts)
+     if not os.path.exists(filename) and resource_stream is not None:
+         # http://bugs.launchpad.net/bugs/383171 - we avoid using this
+         # unless absolutely necessary to help when a broken version of
+@@ -328,7 +327,7 @@
+ 
+     def _fill(self):
+         data = {}
+-        zone_tab = open_resource('zone.tab')
++        zone_tab = open_resource('tab/zone_sun.tab')
+         try:
+             for line in zone_tab:
+                 line = line.decode('US-ASCII')
+@@ -335,6 +334,8 @@
+                 if line.startswith('#'):
+                     continue
+                 code, coordinates, zone = line.split(None, 4)[:3]
++                if not code.isupper():
++                    continue
+                 if zone not in all_timezones_set:
+                     continue
+                 try:
+@@ -356,7 +357,7 @@
+     '''
+     def _fill(self):
+         data = {}
+-        zone_tab = open_resource('iso3166.tab')
++        zone_tab = open_resource('tab/country.tab')
+         try:
+             for line in zone_tab.readlines():
+                 line = line.decode('US-ASCII')
+@@ -363,6 +364,8 @@
+                 if line.startswith('#'):
+                     continue
+                 code, name = line.split(None, 1)
++                if not code.isupper():
++                    continue
+                 data[code] = name.strip()
+             self.data = data
+         finally:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/pytz/patches/zones.patch	Mon Jan 06 13:28:34 2014 -0800
@@ -0,0 +1,63 @@
+At the time of the integration of pytz 2013d, Solaris ships version 2012j
+of the Olson database.  While there are other changes in the database, a
+few zoneinfo files have been introduced since the version we ship, so we
+remove those from the hard-coded list in pytz.
+
+--- pytz-2013d/pytz/__init__.py	Tue Oct 22 14:37:28 2013
++++ pytz-2013d/pytz/__init__.py	Tue Oct 22 14:39:58 2013
+@@ -762,7 +762,6 @@
+  'Asia/Kashgar',
+  'Asia/Kathmandu',
+  'Asia/Katmandu',
+- 'Asia/Khandyga',
+  'Asia/Kolkata',
+  'Asia/Krasnoyarsk',
+  'Asia/Kuala_Lumpur',
+@@ -804,7 +803,6 @@
+  'Asia/Ulaanbaatar',
+  'Asia/Ulan_Bator',
+  'Asia/Urumqi',
+- 'Asia/Ust-Nera',
+  'Asia/Vientiane',
+  'Asia/Vladivostok',
+  'Asia/Yakutsk',
+@@ -913,7 +911,6 @@
+  'Europe/Brussels',
+  'Europe/Bucharest',
+  'Europe/Budapest',
+- 'Europe/Busingen',
+  'Europe/Chisinau',
+  'Europe/Copenhagen',
+  'Europe/Dublin',
+@@ -1044,7 +1041,6 @@
+  'Pacific/Yap',
+  'Poland',
+  'Portugal',
+- 'ROC',
+  'ROK',
+  'Singapore',
+  'Turkey',
+@@ -1321,7 +1317,6 @@
+  'Asia/Karachi',
+  'Asia/Kashgar',
+  'Asia/Kathmandu',
+- 'Asia/Khandyga',
+  'Asia/Kolkata',
+  'Asia/Krasnoyarsk',
+  'Asia/Kuala_Lumpur',
+@@ -1357,7 +1352,6 @@
+  'Asia/Tokyo',
+  'Asia/Ulaanbaatar',
+  'Asia/Urumqi',
+- 'Asia/Ust-Nera',
+  'Asia/Vientiane',
+  'Asia/Vladivostok',
+  'Asia/Yakutsk',
+@@ -1400,7 +1394,6 @@
+  'Europe/Brussels',
+  'Europe/Bucharest',
+  'Europe/Budapest',
+- 'Europe/Busingen',
+  'Europe/Chisinau',
+  'Europe/Copenhagen',
+  'Europe/Dublin',
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/pytz/pytz-PYVER.p5m	Mon Jan 06 13:28:34 2014 -0800
@@ -0,0 +1,63 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+#
+
+set name=pkg.fmri \
+    value=pkg:/library/python-2/pytz-$(PYV)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary value="Python time zone library"
+set name=pkg.description \
+    value="This library allows accurate and cross-platform timezone calculations using Python 2.4 or higher and provides access to the Olson timezone database.  It also solves the issue of ambiguous times at the end of daylight savings."
+set name=pkg.human-version value=$(HUMAN_VERSION)
+set name=com.oracle.info.description value="the Python time zone library"
+set name=com.oracle.info.tpno value=15417
+set name=info.classification \
+    value=org.opensolaris.category.2008:Development/Python
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream value="Stuart Bishop <[email protected]>"
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2013/318
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+#
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz-$(COMPONENT_VERSION)-py$(PYVER).egg-info/PKG-INFO
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz-$(COMPONENT_VERSION)-py$(PYVER).egg-info/SOURCES.txt
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz-$(COMPONENT_VERSION)-py$(PYVER).egg-info/dependency_links.txt
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz-$(COMPONENT_VERSION)-py$(PYVER).egg-info/top_level.txt
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz-$(COMPONENT_VERSION)-py$(PYVER).egg-info/zip-safe
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz/__init__.py
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz/exceptions.py
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz/lazy.py
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz/reference.py
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz/tzfile.py
+file path=usr/lib/python$(PYVER)/vendor-packages/pytz/tzinfo.py
+#
+license LICENSE.txt license=MIT
+
+# force a dependency on the Python runtime
+depend type=require fmri=__TBD pkg.debug.depend.file=python$(PYVER) \
+    pkg.debug.depend.path=usr/bin
+
+# force a dependency on the pytz package
+depend type=require \
+    fmri=library/python-2/pytz@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+
+# Pull in the timezone database
+depend type=require fmri=system/data/timezone
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/pytz/resolve.deps	Mon Jan 06 13:28:34 2014 -0800
@@ -0,0 +1,2 @@
+runtime/python-26
+runtime/python-27
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/pytz/runtests.sh	Mon Jan 06 13:28:34 2014 -0800
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+for test in \
+    test_docs \
+    test_tzinfo \
+    ; do
+	${PYTHON} pytz/tests/${test}.py
+done