3 \Í ã@sHddlZddlZddlZddlmZddlmZdZGdd„deƒZ dS)éN)ÚCommand)ÚDistutilsOptionErrorz.pyc @s„eZdZdZd*d+d,d-d.d/d0gZdd dgZdd iZdd„Zdd„Zdd„Z dd„Z dd„Z d d!„Z d"d#„Z d$d%„Zd&d'„Zd(d)„ZdS)1Ú install_libz7install all Python modules (extensions and pure Python)ú install-dir=Údúdirectory to install toú build-dir=Úbú'build directory (where to install from)ÚforceÚfú-force installation (overwrite existing files)ÚcompileÚcúcompile .py to .pyc [default]ú no-compileNúdon't compile .py filesú optimize=ÚOúlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]ú skip-buildúskip the build stepscCs(d|_d|_d|_d|_d|_d|_dS)Nr)Ú install_dirÚ build_dirr rÚoptimizeÚ skip_build)Úself©rú5/usr/lib64/python3.6/distutils/command/install_lib.pyÚinitialize_options3s zinstall_lib.initialize_optionsc Cs†|jdddddddƒ|jdkr&d |_|jdkr6d |_t|jtƒs‚yt|jƒ|_|jdkr^t‚Wn ttfk r€tdƒ‚YnXdS)NÚinstallÚ build_librrrr rrrTFréézoptimize must be 0, 1, or 2)r!r)rr)r r )rr)rr)rr)rr"r#)Zset_undefined_optionsrrÚ isinstanceÚintÚAssertionErrorÚ ValueErrorr)rrrrÚfinalize_options<s$     zinstall_lib.finalize_optionscCs0|jƒ|jƒ}|dk r,|jjƒr,|j|ƒdS)N)Úbuildr Ú distributionÚhas_pure_modulesÚ byte_compile)rÚoutfilesrrrÚrunVszinstall_lib.runcCs2|js.|jjƒr|jdƒ|jjƒr.|jdƒdS)NÚbuild_pyÚ build_ext)rr*r+Z run_commandÚhas_ext_modules)rrrrr)fs    zinstall_lib.buildcCs8tjj|jƒr |j|j|jƒ}n|jd|jƒdS|S)Nz3'%s' does not exist -- no Python modules to install)ÚosÚpathÚisdirrZ copy_treerÚwarn)rr-rrrr ms  zinstall_lib.installcCsrtjr|jdƒdSddlm}|jdƒj}|jrH||d|j||j d�|j dkrn|||j |j||j |j d�dS)Nz%byte-compiling is disabled, skipping.r)r,r )rr ÚprefixÚdry_run)rr r6Úverboser7) ÚsysÚdont_write_bytecoder5Zdistutils.utilr,Úget_finalized_commandÚrootrr r7rr8)rÚfilesr,Z install_rootrrrr,vs     zinstall_lib.byte_compilec Csh|sgS|j|ƒ}|jƒ}t||ƒ}t|ƒttjƒ}g}x(|D] } |jtjj|| |d…ƒƒq@W|S)N) r;Ú get_outputsÚgetattrÚlenr2ÚsepÚappendr3Újoin) rZhas_anyZ build_cmdZ cmd_optionZ output_dirZ build_filesrZ prefix_lenZoutputsÚfilerrrÚ_mutate_outputs�s    zinstall_lib._mutate_outputscCsvg}xl|D]d}tjjtjj|ƒƒd}|tkr0q |jrL|jtjj |dd�ƒ|j dkr |jtjj ||j d�ƒq W|S)Nr"Ú)Ú optimizationr) r2r3ÚsplitextÚnormcaseÚPYTHON_SOURCE_EXTENSIONrrBÚ importlibÚutilÚcache_from_sourcer)rZ py_filenamesZbytecode_filesZpy_fileZextrrrÚ_bytecode_filenamesžs     zinstall_lib._bytecode_filenamescCsR|j|jjƒdd|jƒ}|jr*|j|ƒ}ng}|j|jjƒdd|jƒ}|||S)Nr/r!r0)rEr*r+rrrNr1)rZ pure_outputsZbytecode_outputsZ ext_outputsrrrr>´s   zinstall_lib.get_outputscCsLg}|jjƒr&|jdƒ}|j|jƒƒ|jjƒrH|jdƒ}|j|jƒƒ|S)Nr/r0)r*r+r;Úextendr>r1)rZinputsr/r0rrrÚ get_inputsÉs    zinstall_lib.get_inputs)rrr)rr r )r r r )rrr)rNr)rrr)rNr)Ú__name__Ú __module__Ú __qualname__Z descriptionZ user_optionsZboolean_optionsZ negative_optrr(r.r)r r,rErNr>rPrrrrrs*   r) r2Úimportlib.utilrKr9Zdistutils.corerZdistutils.errorsrrJrrrrrÚs