HOME


Mini Shell 1.0
DIR: /lib/python3/dist-packages/landscape/lib/apt/package/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/landscape/lib/apt/package/__pycache__/skeleton.cpython-312.pyc
�

�~�e�����ddlZddlmZddlmZddlmZdZdZdZdZ	d	Z
d
ezZdezZdezZ
d
ezZdezZde	zZde
zZGd�de�ZGd�d�Zd�Z	dd�Zdd�Zy)�N)�_PY3)�unicode)�sha1�����iiiiiiic��eZdZdZy)�PackageTypeErrorzDRaised when an unsupported package type is passed to build_skeleton.N)�__name__�
__module__�__qualname__�__doc__���D/usr/lib/python3/dist-packages/landscape/lib/apt/package/skeleton.pyrrs��Nrrc�<�eZdZdZdZdZdZdZdZd�Z	d�Z
d�Zd�Zy)�PackageSkeletonNc�<�||_||_||_g|_y�N)�type�name�version�	relations)�selfrrrs    r�__init__zPackageSkeleton.__init__$s����	���	������rc�>�|jj||f�yr)r�append)rr�infos   r�add_relationzPackageSkeleton.add_relation*s�������t�T�l�+rc��|j�|jSd|jd�d|j�d|j�d�j	d�}t|�}|jj�|jD]0}|jd|dd�d|d�d�j	d���2|j�S)z�Calculate the package hash.

        If C{set_hash} has been used, that hash will be returned and the
        hash won't be the calculated value.
        �[�d� �]�asciirr)
�_hashrrr�encoderr�sort�update�digest)r�package_infor,�pairs    r�get_hashzPackageSkeleton.get_hash-s����:�:�!��:�:���D�I�I�a�=��$�)�)��A�d�l�l�^�1�E�M�M��
���l�#���������N�N�	H�D��M�M�Q�t�A�w�q�k��4��7�)�1�5�=�=�g�F�G�	H��}�}��rc��||_y)aZSet the hash to an explicit value.

        This should be used when the hash is previously known and can't
        be calculated from the relations anymore.

        The only use case for this is package resurrection. We're
        planning on getting rid of package resurrection, and this code
        can be removed when that is done.
        N)r()r�package_hashs  r�set_hashzPackageSkeleton.set_hash@s��"��
r)
r
rr�section�summary�description�size�installed_sizer(rr!r/r2rrrrrs4���G��G��K��D��N��E��,��&
"rrc�0�|\}}}|}|r|d|�d|��z
}|S)aConvert an apt relation to a string representation.

    @param relation_tuple: A tuple, (name, version, relation). version
        and relation can be the empty string, if the relation is on a
        name only.

    Returns something like "name > 1.0"
    r%r)�relation_tuplerr�
relation_type�relation_strings     r�relation_to_stringr<Ms5��$2� �D�'�=��O���Q�}�o�Q�w�i�8�8���rc��t�}|D]�}g}t|tjj�r:|D]4}|j|j|j|jf��6n|j|ddf�|D�cgc]
}t|���}}|}	t|�dkDr|}	dj|�}
|j|	|
f���|Scc}w)a�Parse an apt C{Dependency} list and return skeleton relations

    @param dependencies: list of dependencies returned by get_dependencies()
        this function also accepts the special case for version.provides which
        is a list of string
    @param relation_type: The deb relation that can be passed to
        C{skeleton.add_relation()}
    @param or_relation_type: The deb relation that should be used if
        there is more than one value in a relation.
    �rz | )
�set�
isinstance�apt�package�
Dependencyrrr�relationr<�len�join�add)�dependenciesr:�or_relation_typer�
dependency�depend�basedependencyrD�
value_strings�value_relation_typer;s           r�parse_record_dependenciesrO]s���"��I�"�>�
����j�#�+�+�"8�"8�9�",�
���
�
�&�+�+�&�.�.�&�/�/���
�
�M�M�:�r�2�.�/�GM�M�(�+�H�5�M�
�M�+���}���!�"2���*�*�]�3���
�
�*�O�<�=�->�0���Ns�Cc�^�|jj|j}}|rt|�t|�}}t	t
||�}t
�}|jt|jt��|jt|jj�d|j��f�|jt|jd�tt��|jt|jd�tt��|jt |jj�d|j��f�|jt|jd�t"��|jt|jd�t"��t%|�|_|r�|j(|_|j*|_|j,|_|j.|_|j0dkDr|j0|_|r�t2sz|j(j5d�|_|j*j5d�|_t7|j,t�s |j,j5d�|_|S)	aSBuild a package skeleton from an apt package.

    @param version: An instance of C{apt.package.Version}
    @param with_info: Whether to extract extra information about the
        package, like description, summary, size.
    @param with_unicode: Whether the C{name} and C{version} of the
        skeleton should be unicode strings.
    z = �
PreDepends�Dependsz < �	Conflicts�Breaksrzutf-8)rBrrrr�DEB_PACKAGEr?r+rO�provides�DEB_PROVIDESrG�DEB_NAME_PROVIDES�get_dependencies�DEB_REQUIRES�DEB_OR_REQUIRES�DEB_UPGRADES�
DEB_CONFLICTS�sortedrr3r4r5r6r7r�decoder@)r�	with_info�with_unicoder�version_string�skeletonrs       r�build_skeleton_aptrd�s4��#�?�?�/�/����.�D��&�t�}�g�n�.E�n���{�D�.�A�H���I�
���.�w�/?�/?��N�O�
�M�M�����#�#�$�C����'8�9�	
�����!��$�$�\�2���	
�����!��$�$�Y�/���	
���M�M�	�'�/�/�.�.�/�s�7�?�?�2C�D�E�����!��$�$�[�1��	
�����!��$�$�X�.��	
�� �	�*�H���"�?�?���"�?�?���&�2�2�������
��!�!�A�%�&-�&<�&<�H�#���'�/�/�6�6�w�?�H��'�/�/�6�6�w�?�H���h�2�2�G�<�'/�';�';�'B�'B�7�'K��$��Orr)FF)rA�landscape.lib.compatrr�landscape.lib.hashlibr�PACKAGE�PROVIDES�REQUIRES�UPGRADES�	CONFLICTSrUrWrXrZr[r\r]�	Exceptionrrr<rOrdrrr�<module>rms���
�%�(�&����������	�������!���h�&����!���H�$����!���)�#�
�O�y�O�/"�/"�d
�&�*�ZEr