U ÙAT^Í c@sHddlZddlZddlZddlmZddlmZdZGdd„deƒZ dS)éN)ÚCommand)ÚDistutilsOptionErrorz.pyc@s„eZdZdZdddddddgZd d d gZd d iZd d„Zdd„Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd „Zd!S)"Ú install_libz7install all Python modules (extensions and pure Python))z install-dir=Zdzdirectory to install to)z build-dir=Zbz'build directory (where to install from))ÚforceZfz-force installation (overwrite existing files))ÚcompileZczcompile .py to .pyc [default])ú no-compileNzdon't compile .py files)z optimize=ZOzlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])ú skip-buildNzskip the build stepsrrrrcCs(d|_d|_d|_d|_d|_d|_dS)Nr)Ú install_dirÚ build_dirrrÚoptimizeÚ skip_build©Úself©rú5/usr/lib64/python3.8/distutils/command/install_lib.pyÚinitialize_options3s zinstall_lib.initialize_optionsc Cs†| ddddddd¡|jdkr&d|_|jdkr6d |_t|jtƒs‚zt|jƒ|_|jd kr^t‚Wn ttfk r€td ƒ‚YnXdS) NÚinstall)Ú build_libr )rr)rr)rr)r r )r r TF)réizoptimize must be 0, 1, or 2)Zset_undefined_optionsrr Z isinstanceZintZAssertionErrorZ ValueErrorrr rrrÚfinalize_options<s&ú     zinstall_lib.finalize_optionscCs0| ¡| ¡}|dk r,|j ¡r,| |¡dS©N)ÚbuildrÚ distributionÚhas_pure_modulesÚ byte_compile©r ZoutfilesrrrÚrunVszinstall_lib.runcCs2|js.|j ¡r| d¡|j ¡r.| d¡dS©NÚbuild_pyÚ build_ext)r rrZ run_commandÚhas_ext_modulesr rrrrfs    zinstall_lib.buildcCs8tj |j¡r | |j|j¡}n| d|j¡dS|S)Nz3'%s' does not exist -- no Python modules to install)ÚosÚpathZisdirr Z copy_treerÚwarnrrrrrmsÿzinstall_lib.installcCsrtjr| d¡dSddlm}| d¡j}|jrH||d|j||j d|j dkrn|||j |j||j |j ddS)Nz%byte-compiling is disabled, skipping.r)rr)r rÚprefixÚdry_run)r rr#Úverboser$) ÚsysZdont_write_bytecoder"Zdistutils.utilrÚget_finalized_commandZrootrrr$r r%)r ZfilesrZ install_rootrrrrvs$   þ þzinstall_lib.byte_compilec Csd|sgS| |¡}| ¡}t||ƒ}t|ƒttjƒ}g}|D] } | tj || |d…¡¡q>|Sr) r'Ú get_outputsZgetattrZlenr ZsepÚappendr!Zjoin) r Zhas_anyZ build_cmdZ cmd_optionZ output_dirZ build_filesr Z prefix_lenZoutputsZfilerrrÚ_mutate_outputss  zinstall_lib._mutate_outputscCsrg}|D]d}tj tj |¡¡d}|tkr.q|jrJ| tjj |dd¡|j dkr| tjj ||j d¡q|S)NrZ)Z optimizationr) r r!ZsplitextZnormcaseÚPYTHON_SOURCE_EXTENSIONrr)Ú importlibZutilZcache_from_sourcer )r Z py_filenamesZbytecode_filesZpy_fileZextrrrÚ_bytecode_filenamesžs  ÿ  ÿ zinstall_lib._bytecode_filenamescCsR| |j ¡dd|j¡}|jr*| |¡}ng}| |j ¡dd|j¡}|||S)Nrrr)r*rrrrr-r)r Z pure_outputsZbytecode_outputsZ ext_outputsrrrr(´s  þÿ  þÿzinstall_lib.get_outputscCsLg}|j ¡r&| d¡}| | ¡¡|j ¡rH| d¡}| | ¡¡|Sr)rrr'Zextendr(r)r ZinputsrrrrrÚ get_inputsÉs    zinstall_lib.get_inputsN)Z__name__Z __module__Z __qualname__Z descriptionZ user_optionsZboolean_optionsZ negative_optrrrrrrr*r-r(r.rrrrrs*÷   r) r Zimportlib.utilr,r&Zdistutils.corerZdistutils.errorsrr+rrrrrZs