3  f @sLdZddlZddlZddlZddlmZddlmZdZ GdddeZ dS)zkdistutils.command.install_lib Implements the Distutils 'install_lib' command (install all Python modules).N)Command)DistutilsOptionErrorz.pyc @seZdZdZd*d+d,d-d.d/d0gZdd dgZdd iZddZddZddZ ddZ ddZ 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=ddirectory to install to build-dir=b'build directory (where to install from)forcef-force installation (overwrite existing files)compileccompile .py to .pyc [default] no-compileNdon't compile .py files optimize=Olalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0] skip-buildskip the build stepscCs(d|_d|_d|_d|_d|_d|_dS)Nr) install_dir build_dirr roptimize skip_build)selfrB/opt/alt/python36/lib64/python3.6/distutils/command/install_lib.pyinitialize_options3s zinstall_lib.initialize_optionsc Cs|jddddddd|jdkr&d |_|jdkr6d |_t|jtsyt|j|_|jdkr^tWn ttfk rtdYnXdS)Ninstall build_librrrr rrrTFrzoptimize must be 0, 1, or 2)r!r)rr)r r )rr)rr)rr)rr"r#)Zset_undefined_optionsrr isinstanceintAssertionError ValueErrorr)rrrrfinalize_options<s$     zinstall_lib.finalize_optionscCs0|j|j}|dk r,|jjr,|j|dS)N)buildr distributionhas_pure_modules byte_compile)routfilesrrrrunVszinstall_lib.runcCs2|js.|jjr|jd|jjr.|jddS)Nbuild_py build_ext)rr*r+Z run_commandhas_ext_modules)rrrrr)fs    zinstall_lib.buildcCs8tjj|jr |j|j|j}n|jd|jdS|S)Nz3'%s' does not exist -- no Python modules to install)ospathisdirrZ copy_treerwarn)rr-rrrr ms  zinstall_lib.installcCsrtjr|jddSddlm}|jdj}|jrH||d|j||j d|j dkrn|||j |j||j |j ddS)Nz%byte-compiling is disabled, skipping.r)r,r )rr prefixdry_run)rr r6verboser7) sysdont_write_bytecoder5Zdistutils.utilr,get_finalized_commandrootrr r7rr8)rfilesr,Z install_rootrrrr,vs     zinstall_lib.byte_compilec Csh|sgS|j|}|j}t||}t|ttj}g}x(|D] } |jtjj|| |dq@W|S)N) r; get_outputsgetattrlenr2sepappendr3join) rZhas_anyZ build_cmdZ cmd_optionZ output_dirZ build_filesrZ prefix_lenZoutputsfilerrr_mutate_outputss    zinstall_lib._mutate_outputscCsvg}xl|D]d}tjjtjj|d}|tkr0q |jrL|jtjj |dd|j dkr |jtjj ||j dq W|S)Nr") optimizationr) r2r3splitextnormcasePYTHON_SOURCE_EXTENSIONrrB importlibutilcache_from_sourcer)rZ py_filenamesZbytecode_filesZpy_fileZextrrr_bytecode_filenamess     zinstall_lib._bytecode_filenamescCsR|j|jjdd|j}|jr*|j|}ng}|j|jjdd|j}|||S)zReturn 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/r!r0)rEr*r+rrrNr1)rZ pure_outputsZbytecode_outputsZ ext_outputsrrrr>s   zinstall_lib.get_outputscCsLg}|jjr&|jd}|j|j|jjrH|jd}|j|j|S)zGet 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/r0)r*r+r;extendr>r1)rZinputsr/r0rrr get_inputss    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) __doc__r2importlib.utilrKr9Zdistutils.corerZdistutils.errorsrrJrrrrrs