%PDF- %PDF-
Mini Shell

Mini Shell

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

�

u�a���j�ddlmZddlZddlZddlZddlZddlZddlZddlZ	ddl
Z	Gd�d�Zd�Zy)�)�globNc�R�eZdZd
d�Zd�Zd�Zd�Zd�Zdd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)�QuirkCheckerc��||_||_g|_|j�|j	�|_d|_y)Nz/usr/share/X11/xorg.conf.d)�_handler�quirks_path�_quirks�get_quirks_from_path�get_system_info�_system_info�_xorg_conf_d_path)�self�handler�paths   �5/usr/lib/python3/dist-packages/Quirks/quirkapplier.py�__init__zQuirkChecker.__init__!s=����
��������!�!�#� �0�0�2���!=���c��g|_tjj|j�r�ttjj
|jd��D]`}tjj|�s�#tjd|z�|j|�}|xj|z
c_�b|jStjd|jz�|jS)�5check all the files in a directory looking for quirks�*z
Parsing %sz%s does not exist)r	�osr�isdirrr�join�isfile�logging�debug�get_quirks_from_file)r�f�quirkss   rr
z!QuirkChecker.get_quirks_from_path)s������
�7�7�=�=��)�)�*��"�'�'�,�,�t�'7�'7��=�>�
+���7�7�>�>�!�$��M�M�,��"2�3�!�6�6�q�9�F��L�L�F�*�L�	
+��|�|��
�M�M�-��0@�0@�@�A��|�|�rc�`�tjj|�}|j�S)r)�Quirks�quirkreader�	ReadQuirk�
get_quirks)r�
quirk_files  rrz!QuirkChecker.get_quirks_from_file7s)���'�'�1�1�*�=�
��$�$�&�&rc�^�tjj�}|j�S)zGet system info for the quirk)r!�	quirkinfo�	QuirkInfo�get_dmi_info)r�
quirk_infos  rrzQuirkChecker.get_system_info=s%���%�%�/�/�1�
��&�&�(�(rc��d}|jj�D]�}|j|D]�}|jj|�s�|jj|�|k7s�>t	|j|�dks�Ztjd|jj|��d|���y��tjd�|S)zSee if tags match system infoT�zFailure to match z with F�Success)�
match_tags�keysr�get�lenrr)r�quirk�result�tag�vals     r�matches_tagszQuirkChecker.matches_tagsBs������#�#�(�(�*�	!�C��'�'��,�
!���%�%�)�)�#�.�4�3D�3D�3H�3H��3M�QT�3T���(�(��-�.�!�3��M�M�#'�#4�#4�#8�#8��#=�s�#D�E� �
!�	!�	�
�
�i� ��
rc�:�|jD�]}|jj�|jD�cgc] }|j�j	���"c}vs�Utjd|jz�|j|�rj|r4tjd|jz�|j|���tjd|jz�|j|���tjd���	ycc}w)z)Process quirks and do something with themzProcessing quirk %szApplying quirk %szUnapplying quirk %szQuirk doesn't matchN)r	r�lowerr�striprr�idr6�info�_apply_quirk�_unapply_quirk)r�enabler2�xs    r�
_check_quirkszQuirkChecker._check_quirksOs����\�\�	:�E��}�}�"�"�$�E�M�M�(R�q�������):�(R�R��
�
�3�e�h�h�>�?��$�$�U�+�����%8�5�8�8�%C�D��)�)�%�0����%:�U�X�X�%E�F��+�+�E�2��M�M�"8�9�	:��(Rs�%Dc�&�|jd�y)zEnable all quirks for a handlerTN�r@�rs r�
enable_quirkszQuirkChecker.enable_quirks_s�����4� rc�&�|jd�y)z Disable all quirks for a handlerFNrBrCs r�disable_quirkszQuirkChecker.disable_quirkscs�����5�!rc��|j�d|j�d|jj�j	dd��d�S)z$Return the path to the X config filez/10-�-� z.conf)r
rr:r8�replace)rr2s  r�_get_destination_pathz"QuirkChecker._get_destination_pathgs8��%)�%;�%;��
�
�u�x�x�~�~�/�7�7��S�A�C�	Crc��|j|�}tjdd��}|j|j�|j�tjj|j�}tj|j�tj|j�	tjd|z�|j|�y#t$rtj d�YywxYw)z!Get the xorg snippet and apply it�wF)�mode�deletezCreating %szError during write()T)rK�tempfile�NamedTemporaryFile�write�	x_snippet�close�xkit�
xorgparser�Parser�namerr�
globaldictr�unlink�IOError�	exception)rr2�destination�tmp_file�tmp_xkits     rr<zQuirkChecker._apply_quirkls����0�0��7���.�.�C��F�����u���'������?�?�)�)�(�-�-�8���
�
�h�)�)�*�
�	�	�(�-�-� �	��M�M�-�+�5�6��N�N�;�'����	����4�5��	�s�<)C&�&D�Dc���|j|�}tjd|z�	tj|�y#t
tf$rtjd�YywxYw)z%Remove the file with the xorg snippetzRemoving %s ...zCannot unlink destinationFT)rKrrrrZ�OSErrorr[r\)rr2r]s   rr=zQuirkChecker._unapply_quirk�sd���0�0��7���
�
�'�+�5�6�	��I�I�k�"�����!�	����9�:��	�s�A�$A(�'A(N)z/usr/share/jockey/quirks)T)�__name__�
__module__�__qualname__rr
rrr6r@rDrFrKr<r=�rrrr s:��>��'�)�
�:� !�"�C�
�(rrc��tdd��}|j�|j�ttj
j
t��y)N�nvidiaz/home/alberto/oem/jockey/quirks)rr)rrDrF�printrr�abspath�__file__)�as r�mainrl�s?���X�$E�F�A��O�O������	�"�'�'�/�/�8�
%�&�$
r)
rr�sysrPr�xkit.xutilsrU�xkit.xorgparser�Quirks.quirkreaderr!�Quirks.quirkinforrlrerr�<module>rrs4��(�	�
�������k�k�\
r

Zerion Mini Shell 1.0