<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>As part of the implementation of IANA time zone support in the
Python standard library (which is <a moz-do-not-send="true"
href="https://www.python.org/dev/peps/pep-0615/">now accepted</a>
for inclusion in Python 3.9 — many thanks to those who commented
on the original proposal), I realized that likely a common feature
request is to get the list of time zones installed in the system.
I have a <a moz-do-not-send="true"
href="https://github.com/pganssle/zoneinfo/pull/60">candidate
implementation</a> for this, which basically walks each
potential install directory (there's a "time zone search path"
equivalent to PATH) and populates a list of every file installed
there which starts with the `TZif` magic string.</p>
<p>The problem I'm running into is that tzcode installs `posix/` and
`right/` folders, so for each entry in zoneinfo, I get three
entries: "Africa/Abidjan", "posix/Africa/Abidjan" and
"right/Africa/Abidjan". I'm also seeing a `posixrules` zone in the
zoneinfo root.<br>
<br>
My questions are:<br>
<br>
1. Is there a better source for the list of installed time zones
(leaving aside `tzdata.zi`, which I don't think I can count on to
exist in all environments).<br>
2. Is there any stable and standard way to distinguish between
proper zones and other things that are also zone files like
posixrules and right/ and posix/?<br>
<br>
In my own redistribution of the data, I populate a list of zones
from `make zonenames`, which I note does <i>not</i> include
posix/, right/ or posixrules, but I don't think that information
is included in standard distributions of zoneinfo. The closest I
can find is `zone1970.tab` and `zone.tab` (which I think is not
even always included), and that appears to be only a subset of the
output of `make zonenames`.<br>
<br>
Thanks,<br>
Paul<br>
</p>
</body>
</html>