B …v5­*ã@sLdZddlZddlZddlZddlmZddlmZdZ Gdd„deƒZ dS)zkdistutils.command.install_lib Implements the Distutils 'install_lib' command (install all Python modules).é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=Údzdirectory to install to)z build-dir=Úbz'build directory (where to install from))ÚforceÚfz-force installation (overwrite existing files))ÚcompileÚczcompile .py to .pyc [default])z no-compileNzdon't compile .py files)z optimize=ÚOzlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])z skip-buildNzskip the build stepsrr z skip-buildz no-compilecCs(d|_d|_d|_d|_d|_d|_dS)Nr)Ú install_dirÚ build_dirrr ÚoptimizeÚ skip_build)Úself©rú@/opt/alt/python37/lib/python3.7/distutils/command/install_lib.pyÚinitialize_options3s zinstall_lib.initialize_optionsc Cs†| ddddddd¡|jdkr&d|_|jdkr6d |_t|jtƒs‚yt|jƒ|_|jd kr^t‚Wn ttfk r€td ƒ‚YnXdS) NÚinstall)Ú build_libr )rr )rr)r r )rr)rrTF)réézoptimize must be 0, 1, or 2)Zset_undefined_optionsr rÚ isinstanceÚintÚAssertionErrorÚ ValueErrorr)rrrrÚfinalize_options<s$     zinstall_lib.finalize_optionscCs0| ¡| ¡}|dk r,|j ¡r,| |¡dS)N)ÚbuildrÚ distributionÚhas_pure_modulesÚ byte_compile)rÚoutfilesrrrÚrunVszinstall_lib.runcCs2|js.|j ¡r| d¡|j ¡r.| d¡dS)NÚbuild_pyÚ build_ext)rrrZ run_commandÚhas_ext_modules)rrrrrfs    zinstall_lib.buildcCs8tj |j¡r | |j|j¡}n| d|j¡dS|S)Nz3'%s' does not exist -- no Python modules to install)ÚosÚpathÚisdirr Z copy_treer Úwarn)rr!rrrrms  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)r r)rrÚprefixÚdry_run)rrr*Úverboser+) ÚsysÚdont_write_bytecoder)Zdistutils.utilr Úget_finalized_commandÚrootr rr+rr,)rÚfilesr Z install_rootrrrr vs     zinstall_lib.byte_compilec Csh|sgS| |¡}| ¡}t||ƒ}t|ƒttjƒ}g}x(|D] } | tj || |d…¡¡q@W|S)N) r/Ú get_outputsÚgetattrÚlenr&ÚsepÚappendr'Újoin) rZhas_anyZ build_cmdZ cmd_optionZ output_dirZ build_filesr Ú prefix_lenZoutputsÚfilerrrÚ_mutate_outputss    zinstall_lib._mutate_outputscCsvg}xl|D]d}tj tj |¡¡d}|tkr0q |jrL| tjj |dd¡|j dkr | tjj ||j d¡q W|S)NrÚ)Ú optimizationr) r&r'ÚsplitextÚnormcaseÚPYTHON_SOURCE_EXTENSIONr r6Ú importlibÚutilÚcache_from_sourcer)rZ py_filenamesZbytecode_filesZpy_fileZextrrrÚ_bytecode_filenamesžs     zinstall_lib._bytecode_filenamescCsR| |j ¡dd|j¡}|jr*| |¡}ng}| |j ¡dd|j¡}|||S)zÁReturn the list of files that would be installed if this command were actually run. Not affected by the "dry-run" flag or whether modules have actually been built yet. r#rr$)r:rrr r rCr%)rZ pure_outputsZbytecode_outputsZ ext_outputsrrrr2´s   zinstall_lib.get_outputscCsLg}|j ¡r&| d¡}| | ¡¡|j ¡rH| d¡}| | ¡¡|S)zþGet the list of files that are input to this command, ie. the files that get installed as they are named in the build tree. The files in this list correspond one-to-one to the output filenames returned by 'get_outputs()'. r#r$)rrr/Úextendr2r%)rZinputsr#r$rrrÚ get_inputsÉs    zinstall_lib.get_inputsN)Ú__name__Ú __module__Ú __qualname__Z descriptionZ user_optionsZboolean_optionsZ negative_optrrr"rrr r:rCr2rErrrrrs(   r) Ú__doc__r&Úimportlib.utilr@r-Zdistutils.corerZdistutils.errorsrr?rrrrrÚs