add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
�

��Vc�'cs��dZddlZddlZddlmZddlmZgd�ZiZdZ	gd�Z
d�Zdd
�Zd�Z
d�ZGd
�d��Zdd�Zeefd�Zd�Zd�Zedkre��dSdS)z�Utilities for comparing files and directories.

Classes:
    dircmp

Functions:
    cmp(f1, f2, shallow=True) -> int
    cmpfiles(a, b, common) -> ([], [], [])
    clear_cache()

�N)�filterfalse)�GenericAlias)�clear_cache�cmp�dircmp�cmpfiles�DEFAULT_IGNORESi )ZRCSZCVSZtagsz.gitz.hgz.bzrZ_darcsZ__pycache__cs8�t���dS)zClear the filecmp cache.N)�_cacheZclear��� /usr/lib64/python3.11/filecmp.pyrrs��
�L�L�N�N�N�N�Nr
Tcs��ttj|����}ttj|����}|dtjks|dtjkrdS|r||krdS|d|dkrdSt�||||f��}|�Dt
||��}tt��dkrt��|t||||f<|S)aMCompare two files.

    Arguments:

    f1 -- First file name

    f2 -- Second file name

    shallow -- treat files as identical if their stat signatures (type, size,
               mtime) are identical. Otherwise, files are considered different
               if their sizes or contents differ.  [default: True]

    Return value:

    True if the files are the same, False otherwise.

    This function uses a cache for past comparisons and the results,
    with cache entries invalidated if their stat information
    changes.  The cache may be cleared by calling clear_cache().

    rFT�Nid)	�_sig�os�statZS_IFREGrZget�_do_cmp�lenr)�f1�f2�shallowZs1Zs2Zoutcomes      rrrs���.
�b�g�b�k�k�	�	�B�	
�b�g�b�k�k�	�	�B�	�!�u������1���� 5���u���2��8���t�	�!�u��1��~���u��j�j�"�b�"�b�)�*�*�G��)��"�b�/�/���v�;�;���	��M�M�M�!(��r�2�r�2�~���Nr
csN�tj|j��|j|jfS�N)r�S_IFMT�st_modeZst_sizeZst_mtime)Zst� rr
r
Fs%���K��
�#�#��J��K��r
csj�t}t|d��5}t|d��5}	|�|��}|�|��}||kr	ddd��ddd��dS|s	ddd��ddd��dS�e#1swxYwYddd��dS#1swxYwYdS)NZrbTF)�BUFSIZEZopenZread)rrZbufsizeZfp1Zfp2Zb1Zb2s       rrrKs����G�	
�b�$����3��R�����#�	����'�"�"�B����'�"�"�B��R�x�
�����������������
����������������	��������������������������������sF�B(�3B�B(�4B�7B(�B�B	�B(�B	�B(�(B,�/B,cs��eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
ee	eeeeeeeeeee�
��Zd�Zee��ZdS)ra�A class that manages the comparison of 2 directories.

    dircmp(a, b, ignore=None, hide=None)
      A and B are directories.
      IGNORE is a list of names to ignore,
        defaults to DEFAULT_IGNORES.
      HIDE is a list of names to hide,
        defaults to [os.curdir, os.pardir].

    High level usage:
      x = dircmp(dir1, dir2)
      x.report() -> prints a report on the differences between dir1 and dir2
       or
      x.report_partial_closure() -> prints report on differences between dir1
            and dir2, and reports on common immediate subdirectories.
      x.report_full_closure() -> like report_partial_closure,
            but fully recursive.

    Attributes:
     left_list, right_list: The files in dir1 and dir2,
        filtered by hide and ignore.
     common: a list of names in both dir1 and dir2.
     left_only, right_only: names only in dir1, dir2.
     common_dirs: subdirectories in both dir1 and dir2.
     common_files: files in both dir1 and dir2.
     common_funny: names in both dir1 and dir2 where the type differs between
        dir1 and dir2, or the name is not stat-able.
     same_files: list of identical files.
     diff_files: list of filenames which differ.
     funny_files: list of files which could not be compared.
     subdirs: a dictionary of dircmp instances (or MyDirCmp instances if this
       object is of type MyDirCmp, a subclass of dircmp), keyed by names
       in common_dirs.
     Ncs��||_||_|�tjtjg|_n||_|�t|_dS||_dSr)�left�rightrZcurdirZpardir�hider�ignore)�self�a�brr�     r�__init__zdircmp.__init__|sO����	���
��	���B�I�.�D�I�I��D�I��	!�)�D�K�K�K� �D�K�K�Kr
csN�ttj|j��|j|jz��|_ttj|j��|j|jz��|_|j�	��|j�	��dSr)
�_filterrZlistdirrrr�	left_listr�
right_list�sort�rrr�phase0z
dircmp.phase0�s��� ���D�I�!6�!6�!%��4�;�!6�8�8���!�"�*�T�Z�"8�"8�"&�)�D�K�"7�9�9������������������r
c	sr�ttttjj|j��|j����}ttttjj|j��|j����}tt|j	t|j|������|_tt|j	t|j|������|_tt|j	t|j|������|_dSr)�dictZzipZmapr�pathZnormcaser$r%�listZ__getitem__Zfilter�__contains__�commonr�	left_only�
right_only)rrr s   r�phase1z
dircmp.phase1�s�����S���)�4�>�:�:�D�N�K�K�L�L����S���)�4�?�;�;�T�_�M�M�N�N���3�q�}�f�Q�^�Q�.G�.G�H�H�I�I����c�!�-��Q�^�Q�1O�1O�P�P�Q�Q����s�1�=�+�a�n�a�2P�2P�Q�Q�R�R����r
csV�g|_g|_g|_|jD�]�}tj�|j|��}tj�|j|��}d}	t	j	|��}n#t$rd}YnwxYw	t	j	|��}n#t$rd}YnwxYw|r�tj|j��}tj|j��}||kr|j�
|����tj|��r|j�
|����$tj|��r|j�
|����T|j�
|����p|j�
|�����dS)Nrr)�common_dirs�common_files�common_funnyr-rr*�joinrrr�OSErrorrr�appendZS_ISDIRZS_ISREG)	r�xZa_pathZb_pathZokZa_statZb_statZa_typeZb_types	         r�phase2z
dircmp.phase2�s��������������	,�	,�A��W�\�\�$�)�Q�/�/�F��W�\�\�$�*�a�0�0�F��B�
����������
�
�
�����
����
����������
�
�
�����
�����
,���V�^�4�4����V�^�4�4���V�#�0��%�,�,�Q�/�/�/�/��\�&�)�)�0��$�+�+�A�.�.�.�.��\�&�)�)�0��%�,�,�Q�/�/�/�/��%�,�,�Q�/�/�/�/��!�(�(��+�+�+�+�9	,�	,s$�-B�B�B�B*�*B9�8B9csp�t|j|j|j��}|\|_|_|_dSr)rrrr2�
same_files�
diff_files�funny_files)rZxx�  r�phase3z
dircmp.phase3�s3��
�d�i���T�->�
?�
?��=?�:�����$�*:�*:�*:r
cs�i|_|jD]v}tj�|j|��}tj�|j|��}|�|||j|j	��|j|<�wdSr)
�subdirsr1rr*r4rrZ	__class__rr)rr7Za_xZb_xs    r�phase4z
dircmp.phase4�s|��
����!�	P�	P�A��'�,�,�t�y�!�,�,�C��'�,�,�t�z�1�-�-�C�#�~�~�c�3���T�Y�O�O�D�L��O�O�	P�	Pr
cs��|���|j���D]}|����dSr)r?r>�values�phase4_closure�rZsdr<rrAzdircmp.phase4_closure�sK�����
�
�
��,�%�%�'�'�	 �	 �B��������	 �	 r
csB�td|j|j��|jr5|j���td|jd|j��|jr5|j���td|jd|j��|jr.|j���td|j��|jr.|j���td|j��|jr.|j���td|j��|j	r.|j	���td|j	��|j
r0|j
���td|j
��dSdS)	NZdiffzOnly inz:zIdentical files :zDiffering files :zTrouble with common files :zCommon subdirectories :zCommon funny cases :)�printrrr.r&r/r9r:r;r1r3r'rr�reportz
dircmp.report�s���
�f�d�i���,�,�,��>�	=��N���!�!�!��)�T�Y��T�^�<�<�<��?�	?��O� � �"�"�"��)�T�Z��d�o�>�>�>��?�	8��O� � �"�"�"��%�t��7�7�7��?�	8��O� � �"�"�"��%�t��7�7�7���	C���!�!�#�#�#��/��1A�B�B�B���	?���!�!�#�#�#��+�T�-=�>�>�>���	=���"�"�$�$�$��(�$�*;�<�<�<�<�<�	=�	=r
cs��|���|j���D]$}t��|����%dSr)rDr>r@rCrBr<r�report_partial_closurezdircmp.report_partial_closure�sN�����
�
�
��,�%�%�'�'�	�	�B��G�G�G��I�I�K�K�K�K�	�	r
cs��|���|j���D]$}t��|����%dSr)rDr>r@rC�report_full_closurerBr<rrFzdircmp.report_full_closure�sT�����
�
�
��,�%�%�'�'�	%�	%�B��G�G�G��"�"�$�$�$�$�	%�	%r
)r>r9r:r;r1r2r3r-r.r/r$r%cs~�||jvrt|���|j||��t||��Sr)�	methodmapZAttributeErrorZgetattr)rZattrr<r�__getattr__zdircmp.__getattr__�sF���t�~�%�	'� ��&�&�&����t��T�"�"�"��t�T�"�"�"r
)NN)�__name__Z
__module__Z__qualname__�__doc__r"r(r0r8r=r?rArDrErFr)rGrHZclassmethodrZ__class_getitem__r	r
rrrXs������!	�!	�F
!�
!�
!�
!����S�S�S�!,�!,�!,�F@�@�@�	P�	P�	P� � � �
=�=�=�2���%�%�%���V� &�6�v�#)��V�"�f��%�&�	:�:�:�I�#�#�#�$��L�1�1���r
rcs��gggf}|D]l}tj�||��}tj�||��}|t|||���|���m|S)a]Compare common files in two directories.

    a, b -- directory names
    common -- list of file names found in both directories
    shallow -- if true, do comparison based solely on stat() information

    Returns a tuple of three lists:
      files that compare equal
      files that are different
      filenames that aren't regular files.

    )rr*r4�_cmpr6)rr r-rZresr7ZaxZbxs        rrrsu���r�2�,�C�
�-�-��
�W�\�\�!�Q�
�
��
�W�\�\�!�Q�
�
���D��R��!�!�"�)�)�!�,�,�,�,��Jr
csT�	|||||����S#t$rYdSwxYw)N�)r5)rr Zsh�absrr!rrKrKsH����3�s�s�1�a��}�}�%�%�%�%�������q�q����s��
'�'csF�tt|j|����Sr)r+rr,)ZflistZskipr<rr#r#&s����D�-�u�5�5�6�6�6r
csH�ddl}ddl}|�|jdd�d��\}}t|��dkr|�dd���t|d|d��}d|vr|���dS|���dS)NrrZrrLzneed exactly two args)z-rZ)�sys�getoptZargvrZGetoptErrorrrFrD)rNrOZoptionsZargsZddr!r�demorP,s����J�J�J��M�M�M��M�M�#�(�1�2�2�,��4�4�M�G�T�
�4�y�y�A�~�@�� � �!8�$�?�?�?�	��Q���a��	!�	!�B��W���
��� � � � � �
�	�	�����r
Z__main__)T)rJrrZ	itertoolsrZtypesrZ__all__rrrrrr
rrrrMrKr#rPrIr	r
r�<module>rQsX��
�
�
�	�	�	�����!�!�!�!�!�!�������
I�
I�
I��	��
��J�J�J�����&�&�&�&�P���
	�	�	�g2�g2�g2�g2�g2�g2�g2�g2�T����6������7�7�7�
�
�
��z����D�F�F�F�F�F��r