mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Artur Wiebe <artur@4wiebe.de>
To: ptxdist@pengutronix.de
Cc: Artur Wiebe <artur@4wiebe.de>
Subject: [ptxdist] [PATCH] python3-pytz: use system timezone data
Date: Tue, 11 Sep 2018 10:22:25 +0200	[thread overview]
Message-ID: <20180911082225.30541-1-artur@4wiebe.de> (raw)

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

                 reply	other threads:[~2018-09-11  8:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180911082225.30541-1-artur@4wiebe.de \
    --to=artur@4wiebe.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox