%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/__pycache__/language_support_pkgs.cpython-312.pyc

�

k�!f�&��D�ddlZddlZddlZdZGd�d�Zdd�Zdd�Zy)�Nz-/usr/share/language-selector/data/pkg_dependsc�t�eZdZdZdd�Zd
d�Zd
d�Zd
d�Zd
d�Zd�Z	d�Z
ed	��Zed
��Z
ed��Zy)�LanguageSupportNc��|�tj�|_n||_|j|xst�|_y�N)�apt�Cache�	apt_cache�_parse_pkg_depends�DEFAULT_DEPENDS_FILE�pkg_depends)�selfr	�depends_files   �7/usr/lib/python3/dist-packages/language_support_pkgs.py�__init__zLanguageSupport.__init__s9���� �Y�Y�[�D�N�&�D�N��2�2�<�4%�$�&���c�2�g}|jj|i�}|j|j|�i�j�D])}|D]"}||jvs�|j|��$�+|jdi�j�D]@}|D]9}	|j
|	|�D]"}
|
|jvs�|j|
��$�;�B|s)|D�cgc]}|j|jr�|�� }}tjjd�}|rFd|jd�vr3t|�D]%}|jd�s�|j|��'dD]}d|z|vs�|jd|z�� |Scc}w)a�Get language support packages for a package and locale.

        Note that this does not include support packages which are not specific
        to a particular trigger package, e. g. general language packs. To get
        those, call this with package==''.

        By default, only return packages which are not installed. If installed
        is True, return all packages instead.
        ��XDG_CURRENT_DESKTOP�GNOME�:�fcitx)�de�at�chzhunspell-de-)r�get�_langcode_from_locale�valuesr	�append�_expand_pkg_pattern�	installed�os�environ�split�list�
startswith�remove)
r
�package�localer �packages�depmap�pkglist�p�pattern_list�pattern�
pkg_candidate�desktop�countrys
             r�by_package_and_localez%LanguageSupport.by_package_and_locales������!�!�%�%�g�r�2���z�z�$�"<�"<�V�"D�b�I�P�P�R�	'�G��
'������&��O�O�A�&�
'�	'�#�J�J�r�2�.�5�5�7�	7�L�'�
7��%)�%=�%=�g�v�%N�7�M�$����6� ���
�6�7�
7�	7��#+�O�a�4�>�>�!�3D�3N�3N��O�H�O��*�*�.�.�!6�7���w�'�-�-��"4�4��(�^�
'���<�<��(��O�O�A�&�
'�
*�	:�G���'�8�3������ 8�9�	:����Ps�#F�Fc��g}|jD]7}	|dk(s|j|jr||j|||�z
}�9|S#t$rY�GwxYw)a�Get language support packages for a locale.

        Return all packages which need to be installed in order to provide
        language support for the given locale for all already installed
        packages. This should be called after adding a new locale to the
        system.

        By default, only return packages which are not installed. If installed
        is True, return all packages instead.
        r)rr	r r2�KeyError)r
r(r r)�triggers     r�	by_localezLanguageSupport.by_localeAsp�����'�'�	�G�
��b�=�D�N�N�7�$;�$E�$E��� :� :�7�F�I� V�V�H��	�����
��
�s�4A�	A�Ac��t�}|j�D]$}|j|j|||���&|S)a:Get language support packages for a package.

        This will install language support for that package for all available
        system languages. This is a wrapper around available_languages() and
        by_package_and_locale().

        Note that this does not include support packages which are not specific
        to a particular trigger package, e. g. general language packs. To get
        those, call this with package==''.

        By default, only return packages which are not installed. If installed
        is True, return all packages instead.
        )�set�available_languages�updater2)r
r'r r)�langs     r�
by_packagezLanguageSupport.by_packageWsE���5���,�,�.�	R�D��O�O�D�6�6�w��i�P�Q�	R��rc��t�}|j�D]#}|j|j||���%|S)aLGet language support packages for current system.

        Return all packages which need to be installed in order to provide
        language support all system locales for all already installed
        packages. This should be called after installing the system without
        language support packages (perhaps because there was no network
        available to download them).

        This is a wrapper around available_languages() and by_locale().

        By default, only return packages which are not installed. If installed
        is True, return all packages instead.
        )r8r9r:r6)r
r r)r;s    r�missingzLanguageSupport.missingjsC���5���,�,�.�	A�D�������t�Y� ?�@�	A��rc�f�t�}tjdgd��}|j�D]H}|j	|�|jd�r�&|j	|jd�d��Jtjjd�dk(r|jd	�|S)
z�List available languages in the system.

        The list items can be passed as the "locale" argument of by_locale(),
        by_package_and_locale(), etc.
        z*/usr/share/language-tools/language-optionsT)�universal_newlines�zh_�_rz/usr/share/locale-langpack/enF�en)
r8�
subprocess�check_outputr#�addr%r!�path�isdir�discard)r
�	languages�lang_stringr;s    rr9z#LanguageSupport.available_languages~s����E�	� �-�-�
9�:�#�%�� �%�%�'�	2�D��M�M�$���?�?�5�)��
�
�d�j�j��o�a�0�1�	2��7�7�=�=�8�9�U�B����d�#��rc�R�i}t|�5}|D]}}|j�}|r|jd�r�'|jd�\}}}}|j	|i�j	|i�j	|g�j|��	ddd�|S#1swY|SxYw)zqParse pkg_depends file.

        Return trigger_package -> langcode -> category -> [dependency,...] map.
        �#rN)�open�stripr%r#�
setdefaultr)	r
�filename�map�f�line�cat�lcr5�deps	         rr
z"LanguageSupport._parse_pkg_depends�s���
��
�(�^�	(�q��
(���z�z�|���t���s�3��*.�*�*�S�/�'��b�'�3����w��+�6�6�r�2�>�I�I�#���"�F�3�K�
(�	(��
�	(��
�s�BB�B&c��|jd�s|jd�ry|jd�ry|jdd�dS)	z:Turn a locale name into a language code as in pkg_depends.�zh_CN�zh_SG�zh-hansrA�zh-hantrB�r)r%r#)�klassr(s  rrz%LanguageSupport._langcode_from_locale�sI�����W�%��):�):�7�)C�����U�#���|�|�C��#�A�&�&rc���|dk(rd}n|dk(rd}|jdd�dj�}d}d}	|jd	d�\}}d
|vr|jd
d�\}}||�|��g}|r0|j|�|�|���|j|�|�d|���nE|j	|�D]1}|j|�|�|���|j|�|�d|����3|r|j|�|�d|���|r|r|j|�|�d|�d|���|dk(r.|d
vr|j|dz�|S|j|dz�|S#t$r|}Y��wxYw)z9Return all possible suffixes for given pattern and localer[rYr\�zh_TW�.r]rNrB�@�-�zh)�cn�sg)r#�lower�
ValueErrorr�_countries_for_lang)r^r.r(�variantr1r;�pkgss       rrz#LanguageSupport._expand_pkg_pattern�s����Y���F�
�y�
 ��F����c�1�%�a�(�.�.�0������	�$�l�l�3��2�O�T�7��g�~�%,�]�]�3��%:�"��'��!�4�(�*����K�K�G�T�7�;�<��K�K�W�d�G�<�=� �4�4�T�:�
B�������w�?�@�����$��@�A�
B���K�K�W�d�G�<�=��w��K�K���w��H�I��4�<��,�&����G�i�/�0������G�i�/�0����7�	��D�	�s�.E�E!� E!c� �|j��i|_td�5}|D]�}|jdd�djd�d}|s�-|jdd�djd�d}	|jd	�\}}|j	�}|jj|t
��j|���	ddd�|jj|g�S#t$rY��wxYw#1swY�4xYw)
z-Return a list of countries for given languageNz/usr/share/i18n/SUPPORTEDrMr]r� rarbrB)	�lang_country_maprNr#rhrgrPr8rFr)r^r;rSrT�l�cs      rriz#LanguageSupport._countries_for_lang�s���!�!�)�%'�E�"��1�2�
G�a��
G�D��:�:�c�1�-�a�0�6�6�s�;�A�>�D�� ��:�:�c�1�-�a�0�6�6�s�;�A�>�D�!�!%���C����A����	�A��*�*�5�5�a���?�C�C�A�F�
G�
G��%�%�)�)�$��3�3��&�!� �!��
G�
G�s1�AD�7C5�AD�5	D�>D�D�D�D
)NN)F)�__name__�
__module__�__qualname__rnrr2r6r<r>r9r
�classmethodrrri�rrrr	si����&�*�X�,�&�(�*�$�'��'��,��,�\�4��4rrc��t||�}t�}|j�D]9}|js�|j	|j|j���;|D]}||jd���y)aCAdd language support for packages marked for installation.
    
    For all packages which are marked for installation in the given apt.Cache()
    object, mark the corresponding language packs and support packages for
    installation as well.

    This function can be used as an aptdaemon modify_cache_after plugin.
    F)�	from_userN)rr8�get_changes�marked_installr:r<�name�mark_install)�resolver�cacher�ls�support_pkgs�pkgs      r�apt_cache_add_language_packsr��sy��
���	-�B��5�L�� � �"�9���������
�
�c�h�h� 7�8�9��1��
�c�
���%��0�1rc���|jd�std|z��|jdd�ddd}t||�}|j	|d��}|D�cgc]}||��	c}Scc}w)	z,PackageKit WhatProvides plugin for locale().zlocale(zcannot handle query type �(r]N���T)r )r%�NotImplementedErrorr#rr6)r}�type�searchrr(r~rkr,s        r�packagekit_what_provides_localer�
su�����Y�'�!�"=��"F�G�G�
�\�\�#�q�
!�!�
$�S�b�
)�F�	���	-�B�
�<�<��$�<�/�D�"�#��E�!�H�#�#��#s�A*r)rr!rDrrr�r�rurr�<module>r�s-���	��D��m4�m4�^1�$	$r

Zerion Mini Shell 1.0