\d ZdZddlZddlZddlZddlmZddlmZdZ GddeZ dS)zkdistutils.command.install_lib Implements the Distutils 'install_lib' command (install all Python modules).N)Command)DistutilsOptionErrorz.pycfeZdZdZgdZgdZddiZdZdZdZ d Z d Z d Z d Z d ZdZdZdS) 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))forcefz-force installation (overwrite existing files))compileczcompile .py to .pyc [default]) 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]) skip-buildNzskip the build steps)r r rr r cZd|_d|_d|_d|_d|_d|_dS)Nr) install_dir build_dirr r optimize skip_buildselfs ...\python\lib\distutils\command\install_lib.pyinitialize_optionszinstall_lib.initialize_options3s1   c H|ddddddd|jd|_|jd |_t|jtsP t |j|_|jd vrt dS#t t f$rtd wxYwdS) Ninstall) build_libr)rr)r r )r r )rr)rrTF)rzoptimize must be 0, 1, or 2)set_undefined_optionsr r isinstanceintAssertionError ValueErrorrrs rfinalize_optionszinstall_lib.finalize_options<s ""9#=#A#5#9#;#?  $ $ $ < DL = !DM$--- J J #DM 2 2 = 11((21/ J J J*+HIII J  J Js )A>>!Bc||}|0|jr||dSdSdSN)buildr distributionhas_pure_modules byte_compileroutfiless rrunzinstall_lib.runVsb <<>>  D$5$F$F$H$H    h ' ' ' ' '   rc|js^|jr|d|jr|ddSdSdS)Nbuild_py build_ext)rr(r) run_commandhas_ext_modulesrs rr'zinstall_lib.buildfs| . 1133 -  ,,, 0022 .  -----  . . . .rctj|jr!||j|j}n|d|jzdS|S)Nz3'%s' does not exist -- no Python modules to install)ospathisdirr copy_treerwarnr+s rrzinstall_lib.installmsa 7== ( ( ~~dnd6FGGHH IIKn% & & & Frc2tjr|ddSddlm}|dj}|jr||d|j||j |j dkr'|||j |j||j |j dSdS)Nz%byte-compiling is disabled, skipping.r)r*r)rr prefixdry_run)rr r:verboser;) sysdont_write_bytecoder8distutils.utilr*get_finalized_commandrootr r r;rr<)rfilesr* install_roots rr*zinstall_lib.byte_compilevs  "  II= > > > F////// 11)<<A < / L#z,!% / / / / =1   L#z,!%t| E E E E E E  rc V|sgS||}|}t||}t|ttjz}g}|D]=} |tj|| |d>|Sr&) r@ get_outputsgetattrlenr4sepappendr5join) rhas_any build_cmd cmd_option output_dir build_filesr prefix_lenoutputsfiles r_mutate_outputszinstall_lib._mutate_outputss I..y99 ++-- Iz22 ^^c"&kk1  H HD NN27<< D4EFF G G G Grcg}|D]}tjtj|d}|tkrP|jr4|tj |d|j dkr9|tj ||j |S)Nr) optimizationr) r4r5splitextnormcasePYTHON_SOURCE_EXTENSIONr rI importlibutilcache_from_sourcer)r py_filenamesbytecode_filespy_fileexts r_bytecode_filenameszinstall_lib._bytecode_filenamess# : :G'""27#3#3G#<#<==a@C---| /%%in&F&F"'G'.'.///}q  %%in&F&F$-'G'9'9:::rc ||jdd|j}|jr||}ng}||jdd|j}||z|zS)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/rr0)rSr(r)rr rar2)r pure_outputsbytecode_outputs ext_outputss rrEzinstall_lib.get_outputss  !2!C!C!E!E!+[!%!1 3 3  < "#77 EE  !   !2!B!B!D!D!,k!%!1 3 3  ..<rvs!!   """"""111111 HHHHH'HHHHHr