Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/Tools/i18n/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/Tools/i18n/__pycache__/makelocalealias.cpython-35.opt-1.pyc



��Yf��@s�dZddlZddlZeZdZdZdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zedkr�ddl
Z
e
j�Zejddedde�ejddedde�ej�Zejj�Zejeej��ejeej��x/ee�Ze
e�Zee�ekr Pq We	eej�e�ed�ee�ed�dS)z�
    Convert the X11 locale.alias file into a mapping dictionary suitable
    for locale.py.

    Written by Marc-Andre Lemburg <mal@genix.com>, 2004-12-10.

�Nz"/usr/share/X11/locale/locale.aliasz/usr/share/i18n/SUPPORTEDc
Cs�t|dd��}t|�}WdQRXi}x`|D]X}|j�}|sPq5|dd�dkriq5|j�\}}d|kr�|jd�\}}}	d|	kr�|	jd�\}	}}
|d|
d|	}|d
dkr�|dd�}|j�}t|�dkr&|dkr&q5d|kr�|jd�dd	�\}}|jd
d�}|jdd�}|d|}|||<q5W|S)N�encoding�latin1��#�@�.�:�c��-��_���r)�open�list�strip�split�	partition�lower�len�replace)
�filename�f�lines�data�line�locale�aliasZ
alias_langr
Z	alias_modZ	alias_enc�langr�r�?/opt/alt/python35/lib64/python3.5/Tools/i18n/makelocalealias.py�parses6
r!c
Cs�t|dd��}t|�}WdQRXi}x`|D]X}|j�}|sPq5|dd�dkriq5|jdd�j�}|jd�j�}|j�}t|�dkr�q5|\}}|j�}d	|kr,|jd	�dd�\}	}
|
jd
d�}
|
jdd�}
|	d	|
}|jd
�\}}}t	j
||�}|r�|dkoq|dkr�|d
|7}|||<q5W|S)Nrrrr�/� �\r
rrrr
rZeurozISO-8859-15)rrrr�rstriprrrr�_localeZ_replace_encoding)
rrrrrZwordsrZalias_encodingrrrr
Zmodifierrrr �parse_glibc_supported5s6
r'cCsEt|j��}x,|D]$\}}tdd||f�qWdS)Nz    %-40s%a,z%a:)�sorted�items�print)rr)�k�vrrr �pprintVsr-cCs}t|j��}xd|D]\\}}||krBtd|�q||||krtd|||||f�qWdS)Nz#    removed %az#    updated %a -> %a to %a)r(r)r*)rZolddatar)r+r,rrr �print_differences[sr.cCs�tj}|j�t_xF|j�D]8\}}tj|=tj|�|kr%|tj|<q%Wtj}t|�}|t_|r�tjd�|S)Nr)r�locale_alias�copyr)�	normalize�check�sys�exit)rr/r+r,�newdata�errorsrrr �optimizees	
		
r7cCsod}xb|j�D]T\}}tj|�|krtd|tj|�|fdtj�|d7}qW|S)NrzERROR: %a -> %a != %a�filer)r)rr1r*r3�stderr)rr6r+r,rrr r2ss
r2�__main__z--locale-alias�default�helpz,location of the X11 alias file (default: %a)z--glibc-supportedz:location of the glibc SUPPORTED locales file (default: %a)zlocale_alias = {�})�__doc__rr3r&ZLOCALE_ALIASZ	SUPPORTEDr!r'r-r.r7r2�__name__�argparse�ArgumentParser�parser�add_argument�
parse_args�argsr/r0r�updateZglibc_supportedr�nr*rrrr �<module>sD#!