] @sdddlZddlZddlZddlmZddlmZdZGdddeZ dS)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)selfr0/opt/alt/python35/lib64/python3.5/install_lib.pyinitialize_options3s      zinstall_lib.initialize_optionsc Cs|jddddddd|jdkr7d |_|jdkrOd |_t|jtsy+t|j|_|jdkrtWn$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_optionscCsB|j|j}|dk r>|jjr>|j|dS)N)buildr distributionhas_pure_modules byte_compile)routfilesrrrrunVs  zinstall_lib.runcCsE|jsA|jjr%|jd|jjrA|jddS)Nbuild_py build_ext)rr*r+Z run_commandhas_ext_modules)rrrrr)fs   zinstall_lib.buildcCsLtjj|jr0|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.installc Cstjr|jddSddlm}|jdj}|jrm||ddd|jd|d|j |j dkr||d|j d|jd|d |j d|j dS) Nz%byte-compiling is disabled, skipping.r)r,r rr prefixdry_runverbose) sysdont_write_bytecoder5Zdistutils.utilr,get_finalized_commandrootrr r7rr8)rfilesr,Z install_rootrrrr,vs    zinstall_lib.byte_compilec Cs|s gS|j|}|j}t||}t|ttj}g}x4|D],} |jtjj|| |dqZW|S)N) r; get_outputsgetattrlenr2sepappendr3join) rZhas_anyZ build_cmdZ cmd_optionZ output_dirZ build_filesrZ prefix_lenZoutputsfilerrr_mutate_outputss  *zinstall_lib._mutate_outputscCsg}x|D]}tjjtjj|d}|tkrDq |jrl|jtjj |dd|j dkr |jtjj |d|j q W|S)Nr" optimizationr) r2r3splitextnormcasePYTHON_SOURCE_EXTENSIONrrB importlibutilcache_from_sourcer)rZ py_filenamesZbytecode_filesZpy_fileextrrr_bytecode_filenamess "  zinstall_lib._bytecode_filenamescCsu|j|jjdd|j}|jr?|j|}ng}|j|jjdd|j}|||S)Nr/r!r0)rEr*r+rrrOr1)rZ pure_outputsZbytecode_outputsZ ext_outputsrrrr>s   zinstall_lib.get_outputscCslg}|jjr7|jd}|j|j|jjrh|jd}|j|j|S)Nr/r0)r*r+r;extendr>r1)rZinputsr/r0rrr get_inputsszinstall_lib.get_inputs)rrr)rr r )r r r )rrr)rNr)rrr)rNr)__name__ __module__ __qualname__ descriptionZ user_optionsZboolean_optionsZ negative_optrr(r.r)r r,rErOr>rQrrrrrs*          r) r2importlib.utilrKr9Zdistutils.corerZdistutils.errorsrrJrrrrrs