a
&iX @ sz d dl Z d dlZd dlZd dlZd dlZd dlmZmZ d dlm Z d dl
mZmZ ddg dfddZ
dd Zd
d ZdS ) N)
check_callcheck_output)TarFile)METADATA_FNZONEFILENAMEgzc sP t tj d}tjt}zt| B}|D ]}| | q6 fdd|D } t
|| W d n1 sx0 Y ttj|td"}
tj
||
ddd W d n1 s0 Y tj|t}t|d | :}t|D ]}tj||}
||
| qW d n1 s(0 Y W t nt 0 dS )
zRebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar*
filename is the timezone tarball from ``ftp.iana.org/tz``.
Zzoneinfoc s g | ]}t j |qS )ospathjoin).0nZtmpdirr =/usr/lib/python3.9/site-packages/dateutil/zoneinfo/rebuild.py
zrebuild..Nw T)indentZ sort_keyszw:%s)tempfileZmkdtempr r
r dirname__file__r openextract_run_zicr jsondumpr listdiraddshutilrmtree)filenametagformatZ
zonegroupsmetadatazonedirZ moduledirZtfname filepathsftargetentryZ entrypathr r r rebuild s" (00r+ c
C st zt ddg}W n. ty> } zt| W Y d}~n
d}~0 0 d|v rRddg}ng }tdg| d| g | dS )a Calls the ``zic`` compiler in a compatible way to get a "fat" binary.
Recent versions of ``zic`` default to ``-b slim``, while older versions
don't even have the ``-b`` option (but default to "fat" binaries). The
current version of dateutil does not support Version 2+ TZif files, which
causes problems when used in conjunction with "slim" binaries, so this
function is used to ensure that we always get a "fat" binary.
Zzicz--helpNs -b z-bZfatz-d)r OSError_print_on_nosuchfiler )r% r' help_texteZ
bloat_argsr r r r ) s
r c C s | j dkrtd dS )zdPrint helpful troubleshooting message
e is an exception raised by subprocess.check_call()
zzCould not find zic. Perhaps you need to install libc-bin or some other package that provides it, or it's not in your PATH?N)errnologgingerror)r/ r r r r- A s
r- )r2 r r r r
subprocessr r tarfiler Zdateutil.zoneinfor r r+ r r- r r r r s