]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-84683: Check `<prefix>/share/zoneinfo` for zoneinfo files on Windows (GH-28495)
authorIsuru Fernando <isuruf@gmail.com>
Wed, 6 Aug 2025 22:05:41 +0000 (17:05 -0500)
committerGitHub <noreply@github.com>
Wed, 6 Aug 2025 22:05:41 +0000 (23:05 +0100)
Lib/sysconfig/__init__.py
Misc/NEWS.d/next/Library/2021-09-21-17-17-29.gh-issue-84683.wDSRsG.rst [new file with mode: 0644]

index 49e0986517ce975bf9ede347cd735b8ebc382b96..c583b74ce54fc68e9b54a30f647f3fa35cf8457c 100644 (file)
@@ -412,7 +412,13 @@ def _init_non_posix(vars):
     vars['EXE'] = '.exe'
     vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
     vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
-    vars['TZPATH'] = ''
+    # No standard path exists on Windows for this, but we'll check
+    # whether someone is imitating a POSIX-like layout
+    check_tzpath = os.path.join(vars['prefix'], 'share', 'zoneinfo')
+    if os.path.exists(check_tzpath):
+        vars['TZPATH'] = check_tzpath
+    else:
+        vars['TZPATH'] = ''
 
 #
 # public APIs
diff --git a/Misc/NEWS.d/next/Library/2021-09-21-17-17-29.gh-issue-84683.wDSRsG.rst b/Misc/NEWS.d/next/Library/2021-09-21-17-17-29.gh-issue-84683.wDSRsG.rst
new file mode 100644 (file)
index 0000000..66f76bd
--- /dev/null
@@ -0,0 +1 @@
+:mod:`zoneinfo`: Check in ``<prefix>/share/zoneinfo`` for data files on Windows