\bgdZddlZddlZddlmZddlmZddlmZddl m Z ddl Z ddl Z e jGdde jZdS) z%Tests for distutils.command.build_py.N)build_py) Distribution)DistutilsFileError)supportceZdZdZdZejddZejddZ dZ dZ dZ d S) TestBuildPyc|}tjddd||}t dgd|id}t j|d|_tj d||j d <dg|_ dd gi|_ d|i|_ t|}d |_||j |j ksJ|t%|d ksJt j|d}t j|}t j|d }d|vsJd |vsJt*jr#t j|rJdSt j|}dt*jjd|vsJdS)Nz# Pretend this is a package.zInfo about this package) __init__.py README.txtpkg)packages package_dirsetup.pyF)force build_libbuildr T __pycache__r z __init__..pyc)mkdtempjaracopathrrosjoin script_namer DummyCommand command_objr package_datarrcompileensure_finalizedrunlen get_outputslistdirsysdont_write_bytecodeexistsimplementation cache_tag) selfsources destinationdistcmdpkgdestfiles pycache_dir pyc_filess z/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/_distutils/tests/test_build_py.pytest_package_datazTestBuildPy.test_package_datas,,.. =7       llnn %%AQRRSS7<<<<$+$8;% % % ! "\N3!7+tnn  4#44444  3??$$%%****',,{E22 7##gll7M:: %%%%u$$$$  " Ow~~k22 2 22 2 2 ;//IAs1;AAAYNNNNNNc|}tjdddid|t j|t dgddiddgid}tj|d|_dg|_ |  | dS#t$r| d YdSwxYw) Ntestfiler docr doc/*)r rrrrz/failed package_data test when package_dir is ''rrrrrchdirrrr script_argsparse_command_line run_commandsrfailr*r+r-s r3test_empty_package_dirz"TestBuildPy.test_empty_package_dir<s,,.. "j"5EFFPPP !2;"WI.     7<<<<#9 !!! I        ! I I I IIG H H H H H H I)B??C"!C"zsys.dont_write_bytecodec|dg\}}tj||ddt |}d|_d|_||tj |j}t|ddgksJtj tj |jd}|dtjjd gksJdS) N boiledeggs py_modules boiledeggs.pyimport antigravityTherer boiledeggs.r) create_distrr= write_filerrrfinalize_optionsr!r$sortedrrr%r(r))r* project_dirr-r.founds r3test_byte_compilezTestBuildPy.test_byte_compileQs ,,,GG T  )=>>>tnn      3=))e}} @@@@@ 27<< }EEFFIs'9'CIIIJJJJJJJr5cJ|dg\}}tj||ddt |}d|_d|_d|_|| tj |j}t|ddgksJtj tj |jd}d tjjd }t||gksJdS) NrFrGrIrJFrKrrLz .opt-1.pyc)rMrr=rNrroptimizerrOr!r$rPrrr%r(r))r*rQr-r.rRexpects r3test_byte_compile_optimizedz'TestBuildPy.test_byte_compile_optimizedas ,,,GG T  )=>>>tnn       3=))e}} @@@@@ 27<< }EEFFGs1;GGGe}}((((((r5c|}tjdddiddi|t j|t dgddgid}tj|d|_dg|_ |  | d S#t$r| d Yd SwxYw) zR A directory in package_data should not be added to the filelist. r r7)r8otherdirr9r;)r rrrz0failed package_data when data dir includes a dirNr<rBs r3test_dir_in_package_dataz$TestBuildPy.test_dir_in_package_datass ,,.. #%$&$&    %57)BTUUVV7<<<<#9 !!! J        ! J J J IIH I I I I I I JrDc8|d}t|}d|_d|_tj}dt_ |g|t_n#|t_wxYwd|jdjvsJdS)NrUTzbyte-compiling is disabledr) rMrrrVr%r& byte_compilerecordsmessage)r*caplogr-r.old_dont_write_bytecodes r3test_dont_write_bytecodez$TestBuildPy.test_dont_write_bytecodes!!!$tnn  "%"9"& >   R &=C # #&=C # = = = =+v~a/@/HHHHHHHs A33BcD|}tjddddiii|t j|dddgdd}t |}|d}|| }t|d ksJ|d d }| tj d d ksJ| td|jDrJdS)aU Originally distutils implementation did not account for PEP 420 and included warns for package directories that did not contain ``__init__.py`` files. After the acceptance of PEP 420, these warnings don't make more sense so we want to ensure there are not displayed to not confuse the users. nsr z module.pyr7zns.pkgr)namer rrrUr/zns/pkg/module.pyc3&K|] }d|vod|vV dS)zpackage init filez not foundN).0msgs r3 zCTestBuildPy.test_namespace_package_does_not_warn..sC  BE 3 & =;#+=      r5N)rrrrrr=rget_command_objrOfind_all_modulesr"replacesepr!anymessages)r*r`tmpattrsr-r.modules module_paths r3$test_namespace_package_does_not_warnz0TestBuildPy.test_namespace_package_does_not_warnsAllnn 4%+r):!;rs++ //////''''''//////######  u u u u u '(u u u u u r5