B \@snddlZddlZddlZddlZddlZddlmZddlmZddl m Z m Z ddgdfddZ dd Z dS) N) check_call)TarFile) METADATA_FN ZONEFILENAMEgzc sLttjd}tjt}zt|v}x|D]}| |q8Wfdd|D} yt dd|g| Wn,t k r} zt | Wdd} ~ XYnXWdQRXttj|t d} tj|| dd d WdQRXtj|t} t| d |6}x.t|D] } tj|| }||| q WWdQRXWdtXdS) 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)tmpdirrD/tmp/pip-build-uw_ogi45/python-dateutil/dateutil/zoneinfo/rebuild.py szrebuild..Zzicz-dNwT)indent sort_keyszw:%s)tempfilemkdtemprr r dirname__file__ropenextractrOSError_print_on_nosuchfilerjsondumprlistdiraddshutilrmtree)filenametagformatZ zonegroupsmetadataZzonedirZ moduledirtfnameZ filepathseftargetentryZ entrypathr)r rrebuild s*    r,cCs|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)r(rrrr+s r)r/rrr r subprocessrtarfilerZdateutil.zoneinforrr,rrrrrs