File: //opt/cppython/lib/python3.8/site-packages/dateutil/zoneinfo/__pycache__/rebuild.cpython-38.pyc
U
JD�gX � @ sz d dl Z d dlZd dlZd dlZd dlZd dlmZmZ d dlm Z d dl
mZmZ ddg dfdd�Z
dd � Zd
d� ZdS )� N)�
check_call�check_output)�TarFile)�METADATA_FN�ZONEFILENAME�gzc s t �� � tj�� d�}tj�t�}z�t �
| ��8}|D ]}|�|� � q4� fdd�|D �} t|| � W 5 Q R X t
tj�|t
�d��}
tj||
ddd� W 5 Q R X tj�|t�}t �
|d| ��0}t�|�D ]}tj�||�}
|�|
|� q�W 5 Q R X W 5 t�� � X d S )
z�Rebuild 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 � )�os�path�join)�.0�n�Ztmpdirr �F/opt/cppython/lib/python3.8/site-packages/dateutil/zoneinfo/rebuild.py�
<listcomp> s zrebuild.<locals>.<listcomp>�w� T)�indent� sort_keyszw:%sN)�tempfile�mkdtempr r
r �dirname�__file__�shutil�rmtreer �open�extract�_run_zicr �json�dumpr �listdir�add)�filename�tag�formatZ
zonegroups�metadata�zonedirZ moduledir�tf�name� filepaths�f�target�entryZ entrypathr r r �rebuild s"