File: 0029-No-need-to-use-tzdata-module-on-Unix.patch

package info (click to toggle)
calibre 8.16.2%2Bds%2B~0.10.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 446,080 kB
  • sloc: python: 456,775; cpp: 151,500; ansic: 85,816; javascript: 57,787; xml: 1,247; sh: 957; sql: 735; objc: 330; makefile: 77; sed: 3
file content (51 lines) | stat: -rw-r--r-- 1,516 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Date: Fri, 5 Dec 2025 15:34:17 +0900
Subject: No need to use tzdata module on Unix

Forwarded: https://github.com/kovidgoyal/calibre/pull/2920

Windows uses tzdata module for zoneinfo, but Unix uses system's zoneinfo
data.

See also:
  https://docs.python.org/3/library/zoneinfo.html#module-zoneinfo
---
 pyproject.toml            |  2 +-
 src/calibre/test_build.py | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 4c9e4b3..23ec7c6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -54,7 +54,7 @@ dependencies = [
 	"PyQt6_WebEngine == 6.8.0",
 	"MacFSEvents == 0.8.4; sys_platform == 'darwin'",
 	"xxhash == 3.3.0",
-    "tzdata == 2025.2",
+    "tzdata == 2025.2; platform_system == 'Windows'",
     "tzlocal == 5.3.1",
 ]
 
diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py
index 9773188..dc62e5a 100644
--- a/src/calibre/test_build.py
+++ b/src/calibre/test_build.py
@@ -86,9 +86,14 @@ class BuildTest(unittest.TestCase):
         del CHMFile, chmlib
 
     def test_tzdata(self):
-        import tzdata
-        import tzlocal
-        del tzlocal, tzdata
+        if iswindows:
+            # Windows uses tzdata module for zoneinfo
+            import tzdata
+            import tzlocal
+            del tzlocal, tzdata
+        else:
+            import tzlocal
+            del tzlocal
 
     def test_chardet(self):
         from calibre_extensions.uchardet import detect