
    es                         d Z ddlZddlZddlZddlZddlmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ  G d d	ej        ej        ej        ej                  Zed
k    r ej                     dS dS )z)Tests for distutils.command.install_data.    N)install_lib)	Extension)support)DistutilsOptionError)requires_subprocessc                       e Zd Zd Z ej        ej        d           e            d                         Z	d Z
d Z e            d             ZdS )InstallLibTestCasec                    |                                  d         }t          |          }|                                 |                     |j        d           |                     |j        d           d|_        |                     t          |j                   d|_        |                     t          |j                   d|_        |                                 |                     |j        d           d S )N   r   foo42   )create_distr   finalize_optionsassertEqualcompileoptimizeassertRaisesr   )selfdistcmds      2  /home/conda/feedstock_root/build_artifacts/python-split_1708115622739/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.11/distutils/tests/test_install_lib.pytest_finalize_optionsz(InstallLibTestCase.test_finalize_options   s    !!!$$a(((q))) .0DEEE.0DEEEq)))))    zbyte-compile disabledc                    |                                  \  }}t          j        |           t          |          }dx|_        |_        t          j                            |d          }|                     |d           |	                    |g           t          j                            dd          }t          j                            d|j                  }|                     t          j                            |                     |                     t          j                            |                     d S )Nr   zfoo.pyz# python file )optimization)r   oschdirr   r   r   pathjoin
write_filebyte_compile	importlibutilcache_from_source
assertTrueexists)r   project_dirr   r   fpyc_filepyc_opt_files          r   test_byte_compilez$InstallLibTestCase.test_byte_compile%   s	    !,,..T
$%&&clGLLh//?+++!>33H23NN ~77AD 8 O Ox00111|4455555r   c                 8   |                                  \  }}t          j        |           t          j        d           t	          |          }dx|_        |_        |                                 |_        t          j	        
                    |dd          }|                     |d           t          ddg          g|j        _        dg|j        _        d|j        _        |                                }|                     t'          |          d|           d S )	Nspamr   __init__.py# python packager   xxxsetup.py   )r   r   r    mkdirr   r   r   mkdtempinstall_dirr!   r"   r#   r   distributionext_modulespackagesscript_nameget_outputsr   len)r   r*   r   r   r+   outputss         r   test_get_outputsz#InstallLibTestCase.test_get_outputs6   s     ,,..T

$ &'&cl,,..GLLfm<<-...(1%%(A(A'B$%+H!'1$ //##Wq'22222r   c                 8   |                                  \  }}t          j        |           t          j        d           t	          |          }dx|_        |_        |                                 |_        t          j	        
                    |dd          }|                     |d           t          ddg          g|j        _        dg|j        _        d|j        _        |                                }|                     t'          |          d|           d S )	Nr0   r   r1   r2   r   r3   r4   r   )r   r   r    r6   r   r   r   r7   r8   r!   r"   r#   r   r9   r:   r;   r<   
get_inputsr   r>   )r   r*   r   r   r+   inputss         r   test_get_inputsz"InstallLibTestCase.test_get_inputsJ   s     ,,..T

$ &'&cl,,..GLLfm<<-...(1%%(A(A'B$%+H!'1$ !!Va00000r   c                    |                                  d         }t          |          }d|_        d|_        t          j        }dt          _        	 |                    g            |t          _        n# |t          _        w xY w|                     d| j        d         d         | j        d         d         z             d S )Nr   Tzbyte-compiling is disabledr   r   )	r   r   r   r   sysdont_write_bytecoder$   assertInlogs)r   r   r   old_dont_write_bytecodes       r   test_dont_write_bytecodez+InstallLibTestCase.test_dont_write_bytecode^   s     !!!$$"%"9"&	>R   &=C##&=C#====2il1o	!Q7	9 	9 	9 	9 	9s   A3 3BN)__name__
__module____qualname__r   unittestskipIfrF   rG   r   r.   r@   rD   rK    r   r   r	   r	      s        
* * *$ X_S,.EFF6 6  GF63 3 3(1 1 1( 9 9 9 9 9r   r	   __main__)__doc__rF   r   importlib.utilr%   rO   distutils.command.install_libr   distutils.extensionr   distutils.testsr   distutils.errorsr   test.supportr   TempdirManagerLoggingSilencerEnvironGuardTestCaser	   rL   mainrQ   r   r   <module>r_      s    / / 



 				      5 5 5 5 5 5 ) ) ) ) ) ) # # # # # # 1 1 1 1 1 1 , , , , , ,`9 `9 `9 `9 `9/ 0 -!*`9 `9 `9F zHMOOOOO r   