U viX @szddlZddlZddlZddlZddlZddlmZmZddlm Z ddl m Z m Z ddgdfddZ dd Zd d ZdS) N) check_call check_output)TarFile) METADATA_FN ZONEFILENAMEgzc sttjd}tjt}zt |8}|D]}| |q4fdd|D} t || W5QRXt tj|t d} tj|| dddW5QRXtj|t} t | d|0}t|D]} tj|| } || | qW5QRXW5tXd S) zRebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar* filename is the timezone tarball from ``ftp.iana.org/tz``. Zzoneinfocsg|]}tj|qS)ospathjoin).0nZtmpdirrJ/opt/alt/python38/lib/python3.8/site-packages/dateutil/zoneinfo/rebuild.py szrebuild..wT)indent sort_keyszw:%sN)tempfilemkdtempr r r dirname__file__shutilrmtreeropenextract_run_zicrjsondumprlistdiradd)filenametagformatZ zonegroupsmetadatazonedirZ moduledirtfname filepathsftargetentryZ entrypathrrrrebuild s"  r-c Csrztddg}Wn,tk r<}zt|W5d}~XYnXd|krPddg}ng}tdg|d|g|dS)aCalls 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-bfatz-d)rOSError_print_on_nosuchfiler)r&r) help_texteZ bloat_argsrrrr)s  rcCs|jdkrtddS)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)r2rrrr0As r0)r5r rrr subprocessrrtarfilerZdateutil.zoneinforrr-rr0rrrrs