o dX @szddlZddlZddlZddlZddlZddlmZmZddlm Z ddl m Z m Z ddgdfddZ dd Zd d ZdS) N) check_call check_output)TarFile) METADATA_FN ZONEFILENAMEgzc sZttjd}tjt}zt|!}|D]}| |qfdd|D} t || Wdn1s;wYttj|t d} t j || dddWdn1s^wYtj|t} t| d |}t|D]} tj|| } || | qxWdn1swYWtdSWtdStw) zRebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar* filename is the timezone tarball from ``ftp.iana.org/tz``. Zzoneinfocsg|] }tj|qS)ospathjoin).0nZtmpdirrt/private/var/folders/v1/_jykv66s6qd26_69j1njbrl80000gr/T/pip-target-p1gutpg6/lib/python/dateutil/zoneinfo/rebuild.py szrebuild..NwT)indent sort_keyszw:%s)tempfilemkdtempr r r dirname__file__ropenextract_run_zicrjsondumprlistdiraddshutilrmtree)filenametagformatZ zonegroupsmetadatazonedirZ moduledirtfname filepathsftargetentryZ entrypathrrrrebuild s.   r-c Cshztddg}Wnty}zt|d}~wwd|vr#ddg}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|jdkr tddSdS)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