%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/lib/python3/dist-packages/NvidiaDetector/__pycache__/
Upload File :
Create Path :
Current File : //proc/self/root/lib/python3/dist-packages/NvidiaDetector/__pycache__/alternatives.cpython-312.pyc

�

-.�f���T�ddlZddlZddlmZmZmZGd�de�ZGd�de�Zy)�N)�Popen�PIPE�CalledProcessErrorc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�MultiArchUtilsc��ddd�|_|j�|_t|jj	��tt|jj	��j
|j��|_tjjd�sdtjd<yy)N�i386�x86_64)r	�amd64�PATH�/sbin:/usr/sbin:/bin:/usr/bin)�_supported_architectures�_get_architecture�
_main_arch�list�values�int�index�_other_arch�os�environ�get��selfs �=/usr/lib/python3/dist-packages/NvidiaDetector/alternatives.py�__init__zMultiArchUtils.__init__s���17�(�(K��%��0�0�2����� =� =� D� D� F�G��$�t�'D�'D�'K�'K�'M�"N�"T�"T�UY�Ud�Ud�"e�e�f�h����z�z�~�~�f�%�!@�B�J�J�v��&�c���tdd�}tddgt|d��}|j�d}|j	�|j�}|jj|�S)N�	/dev/null�w�dpkgz--print-architectureT��stdout�stderr�universal_newlinesr)�openrr�communicate�close�striprr)r�dev_null�p1�p�architectures     rrz MultiArchUtils._get_architecture(sd����S�)��
�F�2�3�D�"�t�=���N�N��Q��������w�w�y���,�,�0�0��>�>rc��d|z}|S)Nz%s-linux-gnu_gl_conf�)rr-�alternatives   r�_get_alternative_name_from_archz.MultiArchUtils._get_alternative_name_from_arch1s��,�|�;���rc�8�|j|j�S�N)r1rrs r�get_main_alternative_namez(MultiArchUtils.get_main_alternative_name5s���3�3�D�O�O�D�Drc�8�|j|j�Sr3)r1rrs r�get_other_alternative_namez)MultiArchUtils.get_other_alternative_name8s���3�3�D�4D�4D�E�ErN)�__name__�
__module__�__qualname__rrr1r4r6r/rrrrs��	A�?��E�Frrc�J�eZdZd�Zd�Zd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zy)
�Alternativesc��d|_d|_d|_||_tj
j
d�sdtj
d<yy)Nzmesa/ld.so.confzmesa-egl/ld.so.confzupdate-alternativesrr
)�_open_drivers_alternative�_open_egl_drivers_alternative�_command�_master_linkrrr)r�master_links  rrzAlternatives.__init__>sF��):��&�-B��*�-��
�'����z�z�~�~�f�%�!@�B�J�J�v��&rc�N�tdd�}g}t|jd|jgt|d��}|j�d}|j
�|jd�}|D]3}|j�xr|j|j���5|S)z0Get the list of alternatives for the master linkrr z--listTr"r�
)
r&rr?r@rr'r(�splitr)�append)rr*�alternativesr+r,�c�lines       r�list_alternativeszAlternatives.list_alternativesHs�����S�)����
�D�M�M�8�T�->�->�?��x�D�J���N�N��Q�������
�G�G�D�M���	?�D��J�J�L�>�\�0�0�����>��	?��rc�h�tdd�}t|jd|jgt|d��}|j�d}|j
�|jd�}|D]C}|j�jd�s�#|jdd	�j�cSy
)zGet the alternative in userr z--queryTr"rrCzValue:�N)r&rr?r@rr'r(rDr)�
startswith�replace)rr*r+r,rGrHs      r�get_current_alternativez$Alternatives.get_current_alternativeVs�����S�)��
�D�M�M�9�d�.?�.?�@��x�D�J���N�N��Q�������
�G�G�D�M���	:�D��z�z�|�&�&�x�0��|�|�H�b�1�7�7�9�9�	:�rNc��|r|j|d�}|j�}|D]}|jd�d|k(s�|cSy)zuGet the alternative link by providing the driver name

        ignore_pattern allows ignoring a substring in the namerK�/���N)rMrIrD)r�name�ignore_patternrFr0s     r�get_alternative_by_namez$Alternatives.get_alternative_by_namecsW����<�<���3�D��-�-�/��'�	#�K�� � ��%�b�)�T�1�"�"�	#�rc�8�|j|j�S)z)Get the alternative link for open drivers)rTr=rs r�get_open_drivers_alternativez)Alternatives.get_open_drivers_alternativeqs���+�+�D�,J�,J�K�Krc�8�|j|j�S)z2Get the alternative link for open EGL/GLES drivers)rTr>rs r� get_open_egl_drivers_alternativez-Alternatives.get_open_egl_drivers_alternativeus���+�+�D�,N�,N�O�Orc��	tjgd��tjgd��y#ttf$rYywxYw)z8Trigger gmenu so that the icons will show up in the menu)zdpkg-triggerz--by-package=fakepackage�
gmenucache)r!z--configurez-aN)�
subprocess�
check_call�OSErrorrrs r�update_gmenuzAlternatives.update_gmenuysA��	��!�!�#1�
2��!�!�"?�@���+�,�	��	�s�.1�A�Ac��	tj|jd|j|g�|j	�|j
�y#t
$rYywxYw)z?Tries to set an alternative and returns the boolean exit statusz--setFT)r[r\r?r@�ldconfigrr^)r�paths  r�set_alternativezAlternatives.set_alternative�s[��	��!�!�4�=�=�'�#'�#4�#4�d�#<�
=��M�M�O�	
������"�	��	�s�=A�	A�Ac�P�	tjdg�y#t$rYywxYw)z
Call ldconfigr`FT)r[r\rrs rr`zAlternatives.ldconfig�s0��	��!�!�:�,�/���"�	��	�s��	%�%c�"�tdd�}tdd|gt|d��}|j�d}|j	�|jd�}|D]4}|j
�jd	�ry
|j
�cSy
)z0Get the 1st kernel module name matching an aliasrr �modprobez--resolve-aliasTr"rrCzUsage:N)r&rrr'r(rDr)rL)r�aliasr*r+r,rGrHs       r�resolve_module_aliasz!Alternatives.resolve_module_alias�s�����S�)��
�J� 1�5�9�$�"�t�=���N�N��Q�������
�G�G�D�M���	 �D��z�z�|�&�&�x�0���:�:�<��	 �rr3)
r7r8r9rrIrNrTrVrXr^rbr`rgr/rrr;r;<s7��A����L�P����rr;)rr[rrr�objectrr;r/rr�<module>ris0��,
��6�6�F�V�F�Bg�6�gr

Zerion Mini Shell 1.0