mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] python3-pytz: use system timezone data
@ 2018-09-11  8:22 Artur Wiebe
  0 siblings, 0 replies; only message in thread
From: Artur Wiebe @ 2018-09-11  8:22 UTC (permalink / raw)
  To: ptxdist; +Cc: Artur Wiebe

Signed-off-by: Artur Wiebe <artur@4wiebe.de>
---
 .../0001-use-system-timezone-data.patch       | 40 +++++++++++++++++++
 patches/pytz-2018.5/series                    |  1 +
 rules/python3-pytz.in                         |  1 +
 rules/python3-pytz.make                       |  2 +-
 4 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 patches/pytz-2018.5/0001-use-system-timezone-data.patch
 create mode 100644 patches/pytz-2018.5/series

diff --git a/patches/pytz-2018.5/0001-use-system-timezone-data.patch b/patches/pytz-2018.5/0001-use-system-timezone-data.patch
new file mode 100644
index 000000000..def117ee7
--- /dev/null
+++ b/patches/pytz-2018.5/0001-use-system-timezone-data.patch
@@ -0,0 +1,40 @@
+From 09acc56fe52e53042c8d2dcb458b017de55a626d Mon Sep 17 00:00:00 2001
+From: Artur Wiebe <artur@4wiebe.de>
+Date: Tue, 11 Sep 2018 10:07:27 +0200
+Subject: [PATCH] use system timezone data
+
+---
+ pytz/__init__.py | 2 +-
+ pytz/tzfile.py   | 3 ++-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/pytz/__init__.py b/pytz/__init__.py
+index 120fab4..006db4d 100644
+--- a/pytz/__init__.py
++++ b/pytz/__init__.py
+@@ -91,7 +91,7 @@ def open_resource(name):
+     if zoneinfo_dir is not None:
+         filename = os.path.join(zoneinfo_dir, *name_parts)
+     else:
+-        filename = os.path.join(os.path.dirname(__file__),
++        filename = os.path.join('/usr','share',
+                                 'zoneinfo', *name_parts)
+         if not os.path.exists(filename):
+             # http://bugs.launchpad.net/bugs/383171 - we avoid using this
+diff --git a/pytz/tzfile.py b/pytz/tzfile.py
+index 25117f3..e06ce77 100644
+--- a/pytz/tzfile.py
++++ b/pytz/tzfile.py
+@@ -126,7 +126,8 @@ def build_tzinfo(zone, fp):
+ if __name__ == '__main__':
+     import os.path
+     from pprint import pprint
+-    base = os.path.join(os.path.dirname(__file__), 'zoneinfo')
++    # use system timezone data
++    base = '/usr/share/zoneinfo'
+     tz = build_tzinfo('Australia/Melbourne',
+                       open(os.path.join(base, 'Australia', 'Melbourne'), 'rb'))
+     tz = build_tzinfo('US/Eastern',
+-- 
+2.18.0
+
diff --git a/patches/pytz-2018.5/series b/patches/pytz-2018.5/series
new file mode 100644
index 000000000..f205d3297
--- /dev/null
+++ b/patches/pytz-2018.5/series
@@ -0,0 +1 @@
+0001-use-system-timezone-data.patch
diff --git a/rules/python3-pytz.in b/rules/python3-pytz.in
index d2aff7acf..24146309c 100644
--- a/rules/python3-pytz.in
+++ b/rules/python3-pytz.in
@@ -4,6 +4,7 @@ config PYTHON3_PYTZ
 	tristate
 	select PYTHON3
 	select HOST_PYTHON3_SETUPTOOLS
+	select TIMEZONE if RUNTIME
 	prompt "pytz"
 	help
 	  pytz brings the Olson tz database into Python.
diff --git a/rules/python3-pytz.make b/rules/python3-pytz.make
index c054ab850..538bc7a46 100644
--- a/rules/python3-pytz.make
+++ b/rules/python3-pytz.make
@@ -42,7 +42,7 @@ $(STATEDIR)/python3-pytz.targetinstall:
 	@$(call install_fixup,python3-pytz,DESCRIPTION,missing)
 
 	@$(call install_glob, python3-pytz, 0, 0, -, \
-		/usr/lib/python$(PYTHON3_MAJORMINOR)/site-packages/pytz,, *.py)
+		/usr/lib/python$(PYTHON3_MAJORMINOR)/site-packages/pytz,, *.py */zoneinfo*)
 
 	@$(call install_finish,python3-pytz)
 
-- 
2.18.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-09-11  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-11  8:22 [ptxdist] [PATCH] python3-pytz: use system timezone data Artur Wiebe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox