add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
�

��Vc&Ccs��	ddlZddlZddlZddlZddlmZddlTddlm	Z	m
Z
ddlmZGd�de��Z
Gd�d	e
e
��ZdS)
�N)�Command)Z*)�convert_path�	Mixin2to3)�logcs��eZdZdZgd�ZddgZddiZd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�ZdS)�build_pyz5"build" pure Python modules (copy to build directory)))z
build-lib=Zdzdirectory to "build" (copy) to)�compileZczcompile .py to .pyc)�
no-compileNz!don't compile .py files [default])z	optimize=ZOzlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])�force�fz2forcibly build everything (ignore file timestamps)rrrcsv�d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr)�	build_lib�
py_modules�package�package_data�package_dirr�optimizer��self� �3/usr/lib64/python3.11/distutils/command/build_py.py�initialize_optionszbuild_py.initialize_options s@����������� �����������
���
�
�
�cs�|�ddd��|jj|_|jj|_|jj|_i|_|jjr;|jj���D]\}}t|��|j|<�|���|_	t|jt��s@	t|j��|_dS#ttf$rtd���wxYwdS)NZbuild)r
r
)rrzoptimize must be 0, 1, or 2)Zset_undefined_options�distribution�packagesrr
rZitemsr�get_data_files�
data_files�
isinstancerZintZ
ValueErrorZAssertionErrorZDistutilsOptionError)rZname�path�   r�finalize_optionszbuild_py.finalize_options*s#���"�"�7�#=�#5�	7�	7�	7��)�2��
��+�6��� �-�:��������(�	<�"�/�;�A�A�C�C�
<�
<�
��d�)5�d�);�);�� ��&�&��-�-�/�/����$�-��-�-�	J�
J� #�D�M� 2� 2��
�
�
����/�
J�
J�
J�*�+H�I�I�I�
J����		J�	Js�
C(�(!D	cs��|jr|���|jr(|���|���|�|�d�����dS�Nr)�include_bytecode)r�
build_modulesr�build_packages�build_package_data�byte_compile�get_outputsrrr�runzbuild_py.runCsy��,�?�	!���� � � ��=�	&����!�!�!��#�#�%�%�%����$�*�*�A�*�>�>�?�?�?�?�?rcs^��	g}|js|S|jD]�}|�|��}tjj|jg|�d��z�}d�|rt|��dz��fd�|�||��D��}|�	||||f����|S)N�.r�cs$��g|]}|�d���
S�N�)�.0Zfile�plen�  �r�
<listcomp>z+build_py.get_data_files.<locals>.<listcomp>ss.������ $��T�U�U����r)
r�get_package_dir�osr�joinr
�splitZlen�find_data_files�append)rZdatar�src_dir�	build_dir�	filenamesr+�      @rrzbuild_py.get_data_filesas����M����}�	��K��}�	B�	B�G��*�*�7�3�3�G������'7�'�-�-��:L�:L�'L�N�I��D��
&��7�|�|�A�~������(,�(<�(<�W�g�(N�(N����I�
�K�K��'�9�i�@�A�A�A�A��rc	sj��	|j�dg��|j�|g��z}g�|D]t}tjtj�tj|��t|������}���fd�|D�����u�S)N�csZ��g|]'}|�v�tj�|���%|��(Sr))r/r�isfile)r*Zfn�filesr,rr-z,build_py.find_data_files.<locals>.<listcomp>�sF���(�(�(��2�U�?�(��G�N�N�2�&�&�(�"�(�(�(r)	r
�get�globr/rr0�escaper�extend)rrr4ZglobsZpatternZfilelistr:r7rr2zbuild_py.find_data_filesys����D��"�&�&�r�2�.�.��$�(�(��"�5�5�6�����	)�	)�G��y�����d�k�'�.B�.B�L�QX�DY�DY�!Z�!Z�[�[�H��L�L�(�(�(�(�x�(�(�(�
)�
)�
)�
)��rcsD�	d}|jD]�\}}}}|D]�}tj�||��}|�tj�|����|�tj�||��|d�������dS)NF�Z
preserve_mode)rr/rr0�mkpath�dirname�	copy_file)rZlastdirrr4r5r6�filenameZtarget�        rr"zbuild_py.build_package_data�s���2���6:�o�	4�	4�2�G�W�i��%�
4�
4������i��:�:�����B�G�O�O�F�3�3�4�4�4����r�w�|�|�G�X�>�>��-2��4�4�4�4�
4�	4�	4rcs��	|�d��}|js|rtjj|�SdSg}|r{	|jd�|��}|�d|��tjj|�S#t$r"|�d|d��|d=YnwxYw|�{|j�d��}|�|�d|��|rtjj|�SdS)Nr&r8r�����)r1rr/rr0Zinsert�KeyErrorr;)rrrZtailZpdir�     rr.zbuild_py.get_package_dir�s*��	H��}�}�S�!�!����	��
��w�|�T�*�*��r��D��
�/��+�C�H�H�T�N�N�;�D�
�K�K��4�(�(�(��7�<��.�.�� �!�!�!��K�K��4��8�,�,�,��R����!�����
�"�'�+�+�B�/�/���)��K�K��4�(�(�(����7�<��.�.��2s� B�)B/�.B/cs��|dkrbtj�|��std|z���tj�|��std|z���|rVtj�|d��}tj�|��r|Stjd|��dS)Nr8z%package directory '%s' does not existz>supposed package directory '%s' exists, but is not a directoryz__init__.pyz8package init file '%s' not found (or not a regular file))	r/rZexistsZDistutilsFileErrorZisdirr0r9r�warn)rrr�init_py�    r�
check_packagezbuild_py.check_package�s���
�"��	?��7�>�>�+�.�.�
M�(�=��K�M�M�M��7�=�=��-�-�
?�(�0�2=�>�?�?�?�
�	?��g�l�l�;�
�>�>�G��w�~�~�g�&�&�
?�����4�6=�?�?�?�
�trcst�tj�|��stjd||��dSdS)Nz!file %s (for module %s) not foundFT)r/rr9rrH)r�module�module_filerr�check_modulezbuild_py.check_module�s7���w�~�~�k�*�*�	��H�8�+�v�N�N�N��5��4rcsJ�|�||��tjtj�tj|��d����}g}tj�|jj��}|D]�}tj�|��}||kr[tj�	tj�
|����d}|�|||f����|�d|z����|S)Nz*.pyrzexcluding %s)
rKr<r/rr0r=ZabspathrZscript_nameZsplitextZbasenamer3Zdebug_print)	rrrZmodule_files�modulesZsetup_scriptr	Zabs_frLs	         r�find_package_moduleszbuild_py.find_package_modules�s������7�K�0�0�0��y�����d�k�+�.F�.F��!O�!O�P�P�����w���t�'8�'D�E�E���	@�	@�A��G�O�O�A�&�&�E���$�
@���)�)�"�'�*:�*:�1�*=�*=�>�>�q�A��������3�4�4�4�4�� � ��,�!>�?�?�?�?��rcs�	i}g}|jD]�}|�d��}d�|dd���}|d}	||\}}n'#t$r|�|��}d}YnwxYw|s7|�||��}	|df||<|	r|�|d|	f��tj�||dz��}
|�	||
��s��|�|||
f����|S)Nr&rrEr'Z__init__�.py)
rr1r0rFr.rKr3r/rrN)rrrOrLrrZmodule_baserZcheckedrIrMs           r�find_moduleszbuild_py.find_modules�sS��	������o�	@�	@�F��<�<��$�$�D��h�h�t�A�b�D�z�*�*�G��r�(�K�
�)1�'�):�&��g�g���
�
�
�"�2�2�7�;�;������
�����
C��,�,�W�k�B�B��%0�!�$4���!��C��N�N�G�Z��#A�B�B�B�
�'�,�,�{�K�%�4G�H�H�K��$�$�V�[�9�9�
���N�N�G�[�+�>�?�?�?�?��s�
A�!A:�9A:cs
�	g}|jr'|�|�����|jrJ|jD]B}|�|��}|�||��}|�|���C|Sr()rr>rRrr.rP)rrOrrZmrGr�find_all_moduleszbuild_py.find_all_moduless���	(�
���?�	0��N�N�4�,�,�.�.�/�/�/��=�	"��=�
"�
"��"�2�2�7�;�;���-�-�g�{�C�C�����q�!�!�!�!��rcs>�d�|���D��S)Ncs�g|]
}|d��S)rEr))r*rLs  rr-z-build_py.get_source_files.<locals>.<listcomp>-s��A�A�A�v��r�
�A�A�Ar)rSrrr�get_source_fileszbuild_py.get_source_files,s"��A�A��)>�)>�)@�)@�A�A�A�Arcs\�|gt|��z|dzgz}tjj|�S)NrQ)�listr/rr0)rr5rrLZoutfile_pathrGr�get_module_outfilezbuild_py.get_module_outfile/s/��!�{�T�'�]�]�2�f�u�n�5E�E���w�|�\�*�*rr'cs��|���}g}|D]�\}}}|�d��}|�|j||��}|�|��|r|jr4|�tj�|d�����|j	dkr9|�tj�||j	�������|d�|j
D��z
}|S)Nr&r8)Zoptimizationrcsb�g|],\}}}}|D]"}tj�||����#�-Sr))r/rr0)r*rr4r5r6rC�      rr-z(build_py.get_outputs.<locals>.<listcomp>BsW�����6���)�Y�%����
�G�L�L��H�-�-����r)rSr1rVr
r3r�	importlibZutilZcache_from_sourcerr)rrrOZoutputsrrLrMrCrDrr$zbuild_py.get_outputs3s)���'�'�)�)����.5�
	?�
	?�*�W�f�k��m�m�C�(�(�G��.�.�t�~�w��O�O�H��N�N�8�$�$�$��
?��<�4��N�N�9�>�#C�#C� �r�$D�$3�$3�4�4�4��=�1�$�?��N�N�9�>�#C�#C� �t�}�$D�$>�$>�?�?�?��	���:>�/����	���rcs~�t|t��r|�d��}n+t|ttf��std���|�|j||��}tj	�
|��}|�|��|�||d���S)Nr&z:'package' must be a string (dot-separated), list, or tuplerr?)
rZstrr1rUZtupleZ	TypeErrorrVr
r/rrAr@rB)rrLrMrZoutfileZdirrWr�build_modulezbuild_py.build_moduleJs����g�s�#�#�	P��m�m�C�(�(�G�G��G�d�E�]�3�3�	P��N�P�P�
P��)�)�$�.�'�6�J�J���g�o�o�g�&�&�����C�����~�~�k�7�!�~�D�D�Drcsn�|���}|D]\}}}|�|||���dSr()rRrY)rrOrrLrMrGrr zbuild_py.build_modulesYsP���#�#�%�%��.5�	<�	<�*�W�f�k�

���f�k�7�;�;�;�;�	<�	<rcs��|jD]M}|�|��}|�||��}|D]\}}}|�|||����NdSr()rr.rPrY)rrrrOZpackage_rLrMs       rr!zbuild_py.build_packagesbs����}�	@�	@�G��.�.�w�7�7�K��/�/���E�E�G�4;�
@�
@�/��6�;��!�!�&�+�w�?�?�?�?�
@�	@�	@rcsJ�tjr|�d��dSddlm}|j}|dtjkr|tjz}|jr||d|j	||j
���|jdkr!|||j|j	||j
���dSdS)Nz%byte-compiling is disabled, skipping.r)r#rE)rr�prefix�dry_run)�sysZdont_write_bytecoderH�distutils.utilr#r
r/Zseprrr[r)rr:r#rZrJrr#zbuild_py.byte_compilevs����"�	��I�I�=�>�>�>��F�/�/�/�/�/�/�����"�:����	%��b�f�_�F�
�<�	P��L���#�z�&�$�,�
P�
P�
P�
P��=�1��	P��L����#�z�&�$�,�
P�
P�
P�
P�
P�
P�	P�	PrN)r')�__name__�
__module__�__qualname__ZdescriptionZuser_optionsZboolean_optionsZnegative_optrrr%rr2r"r.rKrNrPrRrSrTrVr$rYr r!r#r)rrrrsx������K�K�
�
�
�L�!�'�*�O� �9�-�L����J�J�J�2@�@�@�<���0���4�4�4�%�%�%�N���6���
�
�
�2�2�2�h��� B�B�B�+�+�+�����.
E�
E�
E�<�<�<�@�@�@�(P�P�P�P�Prrcs�eZdZd�Zd�ZdS)�
build_py_2to3cs.�g|_|jr|���|jr(|���|���|�|j��|�|�d�����dSr)	�
updated_filesrr rr!r"Zrun_2to3r#r$rrrr%zbuild_py_2to3.run�s�������?�	!���� � � ��=�	&����!�!�!��#�#�%�%�%�	
�
�
�d�(�)�)�)�	
���$�*�*�A�*�>�>�?�?�?�?�?rcs��t�||||��}|dr |j�|d��|S)Nr'r)rrYrbr3)rrLrMrZresrGrrYzbuild_py_2to3.build_module�sG���#�#�D�&�+�w�G�G���q�6�	.���%�%�c�!�f�-�-�-��
rN)r^r_r`r%rYr)rrrara�s5������@�@�@� ����rra)r/Zimportlib.utilrXr\r<Zdistutils.corerZdistutils.errorsr]rrZ	distutilsrrrar)rr�<module>rcs���0�
�	�	�	�����
�
�
�
�����"�"�"�"�"�"�����2�2�2�2�2�2�2�2�������yP�yP�yP�yP�yP��yP�yP�yP�v�����H�i�����r