Skip to content

Commit 3000594

Browse files
authored
gh-84683: Check <prefix>/share/zoneinfo for zoneinfo files on Windows (GH-28495)
1 parent c653fba commit 3000594

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Lib/sysconfig/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,13 @@ def _init_non_posix(vars):
412412
vars['EXE'] = '.exe'
413413
vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
414414
vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
415-
vars['TZPATH'] = ''
415+
# No standard path exists on Windows for this, but we'll check
416+
# whether someone is imitating a POSIX-like layout
417+
check_tzpath = os.path.join(vars['prefix'], 'share', 'zoneinfo')
418+
if os.path.exists(check_tzpath):
419+
vars['TZPATH'] = check_tzpath
420+
else:
421+
vars['TZPATH'] = ''
416422

417423
#
418424
# public APIs
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:mod:`zoneinfo`: Check in ``<prefix>/share/zoneinfo`` for data files on Windows

0 commit comments

Comments
 (0)