B ㊇cX @szddlZddlZddlZddlZddlZddlmZmZddlm Z ddl m Z m Z ddgdfddZ dd Zd d ZdS) N) check_call check_output)TarFile) METADATA_FN ZONEFILENAMEgzc sttjd}tjt}zt|<}x|D]}| |q6Wfdd|D} t || WdQRXttj|t d} t j || dddWdQRXtj|t} t| d |4}x,t|D]} tj|| } || | qWWdQRXWdtXdS) zRebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar* filename is the timezone tarball from ``ftp.iana.org/tz``. Zzoneinfocsg|]}tj|qS)ospathjoin).0n)tmpdirrt/private/var/folders/8c/hx9_v10d5x38qmnzt13b7b8j1k3n5b/T/pip-target-x6xd5gna/lib/python/dateutil/zoneinfo/rebuild.py szrebuild..NwT)indent sort_keyszw:%s)tempfilemkdtempr r r dirname__file__ropenextract_run_zicrjsondumprlistdiraddshutilrmtree)filenametagformatZ zonegroupsmetadatazonedirZ moduledirtfname filepathsftargetentryZ entrypathr)rrrebuild s"   r-c Csrytddg}Wn,tk r<}zt|Wdd}~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 rr r subprocessrrtarfilerZdateutil.zoneinforrr-rr0rrrrs