From: Isuru Fernando Date: Wed, 6 Aug 2025 22:05:41 +0000 (-0500) Subject: gh-84683: Check `/share/zoneinfo` for zoneinfo files on Windows (GH-28495) X-Git-Tag: v3.15.0a1~755 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3000594e929aea768fe0dd2437e0722ecfa2dbdc;p=thirdparty%2FPython%2Fcpython.git gh-84683: Check `/share/zoneinfo` for zoneinfo files on Windows (GH-28495) --- diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 49e0986517ce..c583b74ce54f 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -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 index 000000000000..66f76bda6ad7 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-09-21-17-17-29.gh-issue-84683.wDSRsG.rst @@ -0,0 +1 @@ +:mod:`zoneinfo`: Check in ``/share/zoneinfo`` for data files on Windows