\dRndZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZmZmZdd lmZdd l mZdd lmZdd lmZeduZdZiiidZeD]6ZdD]1\ZZeZ ej!eZ"edkree"vrdZ e"e eee<27eD]Z#ee#$D]\ZZ%ej&dde%Z%e%'ddZ%e%'ddZ%edkre%dz Z%ej(dkredkre%'ddZ%e%ee#e<erdddd d!ded"<ddd#d$d!ded%<Gd&d'eZ)dS)(zFdistutils.command.install Implements the Distutils 'install' command.N)log)Command)DEBUG)get_config_vars)DistutilsPlatformError) write_file) convert_path subst_vars change_root) get_platform)DistutilsOptionError) USER_BASE) USER_SITE)purelibplatlibheadersscriptsdata) unix_prefix unix_homent))r posix_prefix)r posix_home)rrrincludez \{(.+?)\}z$\g<1>z$installed_basez$basez$py_version_nodot_platz$py_version_nodotz /$dist_name) rz/lib/z /$platlibdir/z $usersitez4$userbase/Python$py_version_nodot/Include/$dist_namez)$userbase/Python$py_version_nodot/Scriptsz $userbasent_userz=$userbase/include/python$py_version_short$abiflags/$dist_namez $userbase/bin unix_userc0eZdZdZgdZgdZer0edddezfedddiZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdefdefd efd!efd"d#fgZdS)$installz'install everything from build directory))zprefix=Nzinstallation prefix)z exec-prefix=Nz.(Unix only) prefix for platform-specific files)zhome=Nz+(Unix only) home directory to install under)z install-base=Nz;base installation directory (instead of --prefix or --home))zinstall-platbase=Nz\base installation directory for platform-specific files (instead of --exec-prefix or --home))zroot=Nz-K-K-M-M*407#:J2A2:N0N069I"1"9M0M*0&,/:+6(0*-.    A+/+@D Z (+/+@D Z (  $T * * L)2)A()K)KD X &  /000$(#4 '+'<$  % % % % % % % . ! ! ! F4# $ $ $  +,,, 9 $  ! ! # # #   # , 8#'#7  #'#7 5)Y$fi 9 9 9  7   z: 6 6 6    #/7<<(8$/JJ 9   i 9' < < < ./// ""7#?#= ? ? ? ? ?s E++ E:9E:ctsdSddlm}tj|dz|jD]}|d}|ddkr |dd}||jvr4|j|}||}t|| }n%||}t||}tjd||dS)zDumps the list of user options.Nr) longopt_xlate:=z %s: %s) rdistutils.fancy_getoptrrdebug user_options negative_opt translategetattr)rCmsgroptopt_namevals rDrazinstall.dump_dirss  F888888 #)$ 1 1C1vH|s""#AbD>4,,,,X6#--m<<!$111#--m<<dH-- Ij(C 0 0 0 0 1 1rFc|j|j;|j|j|j|j|j|jtddS|j r@|j td|j x|_|_| ddS|j *|j x|_|_| ddS|js|jtdt jt&j|_t jt&j|_n|j |j|_|j|_|j|_| ddS)z&Finalizes options for posix platforms.NzPinstall-base or install-platbase supplied, but installation scheme is incomplete$User base directory is not specifiedrrz*must not supply exec-prefix without prefixr)r.r/r4r1r2r3r5r6r r(r8r select_schemer-r+r,r^rynormpathrdrBs rDrbzinstall.finalize_unixs   (D,A,M!)%-%-$,$,!)*:;;; F 9 .$,,:<<<8<8M MD  5   { + + + + + Y "8< AD  5   { + + + + +{"#/.FHHH!g..sz:: #%7#3#3CO#D#D  #+'+{D$ $ D $($4D !   } - - - - -rFc4|jrM|jtd|jx|_|_|t jdzdS|j*|jx|_|_|ddS|j .t j tj |_ |j x|_|_ |t jdS#t$rtdt jzwxYw)z)Finalizes options for non-posix platformsNr_userrz)I don't know how to install stuff on '%s')r(r8rr.r/rr^r_r-r+ryrrdKeyErrorrBs rDrczinstall.finalize_others& 9 M$,,:<<<8<8M MD  5   rw0 1 1 1 1 1 Y "8< AD  5   { + + + + +{" g..sz:: 8< CD  5 M""27+++++ M M M,ABGKMMM Ms C00'Dct|}tD].}d|z}t||t||||/dS)z=Sets the install directories by applying the install schemes.install_N)INSTALL_SCHEMES SCHEME_KEYSrsetattr)rCr_schemekeyattrnames rDrzinstall.select_schemesX!& 5 5C!C'HtX&&.hs 444 5 5rFc|D]y}t||}|etjdkstjdkrtj|}t ||j}t|||zdS)NrHr)rr^r_ry expanduserr rmr)rCattrsattrrs rD _expand_attrszinstall._expand_attrss ) )D$%%C7g%%D',,S11C d&677dC(((  ) )rFc4|gddS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.)r.r/r0NrrBs rDrqzinstall.expand_basedirss% GGGHHHHHrFc4|gddS)z+Calls `os.path.expanduser` on install dirs.)r1r2r4r3r5r6NrrBs rDrszinstall.expand_dirss; @@@ A A A A ArFc r|D]3}d|z}t||tt||4dS)z!Call `convert_path` over `names`.rN)rr rrCnamesr_rs rDrvzinstall.convert_pathssP C CD$D D$ WT4-@-@ A A B B B B C CrFc|j|jj|_|jtjdt |jt r|jd|_t|jdkr|jdx}}n2t|jdkr |j\}}ntdt|}nd}d}||_ ||_ dS) z4Set `path_file` and `extra_dirs` using `extra_path`.NzIDistribution option extra_path is deprecated. See issue27919 for details.,r*rrJzY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsrI) r;rhrr` isinstancestrrflenr r path_filer{)rCrr{s rDrwzinstall.handle_extra_paths ? ""/:DO ? & H.   $/3// ="&/"7"7"<"<4?##q(()-);; JJT_%%**(,% ::*DEEE &j11JJIJ#$rFc ~|D]9}d|z}t||t|jt||:dS)z:Change the install directories pointed by name using root.rN)rr r0rrs rDr|zinstall.change_roots"sT M MD$D D$ DIwtT7J7J K K L L L L M MrFcp|jsdSttjd}|jD]f\}}||rLtj|s-| d|ztj |dgdS)zCreate directories under ~.N~zos.makedirs('%s', 0o700)i) r(r r^ryrrmitems startswithisdir debug_printmakedirs)rCr-r_rys rDrtzinstall.create_home_path(sy  FBG..s3344*0022 ) )JD$t$$ )RW]]4-@-@ )  !;d!BCCC D%((( ) )rFc|js\|d|jdj}|jr!|t krtd|D]}|||j r| |j r| }|j rFt|j }tt|D]}|||d||<|t"|j |fd|j zt%t&jjt,j}t%t&jj|}t&jt&j|j}|jr.|j r|js$||vrt5jd|jdSdSdSdS)zRuns the command.r]z"Can't install when cross-compilingNz'writing list of installed files to '%s'zmodules installed to '%s', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself)r= run_commandrhget_command_obj plat_namer>r rget_sub_commandsrcreate_path_filerA get_outputsr0rrangeexecutermapr^ryrrdnormcaser4r<rr)rC build_platcmd_nameoutputsroot_lencountersys_pathr4s rDrunz install.run4s# @   W % % %*::7CCMJ} @|~~!=!=,.?@@@--// ' 'H   X & & & & > $  ! ! # # # ; &&&((Gy Cty>>$S\\22CCG'.w'7 'BGG$$ LL+w/B% & & & rw'22rw'22g&&rw'7'78H'I'IJJ M ) )$($: ) x ' ' IH' ) ) ) ) ) ) ) ' ' ) )rFctj|j|jdz}|jr)|t||jgfd|zdS| d|zdS)zCreates the .pth file.pthz creating %szpath file '%s' not createdN) r^ryrzrxrr<rrr{r`)rCfilenames rDrzinstall.create_path_file`s7<< 4 $ 799  ! ? LL"T_$56&1 3 3 3 3 3 II2X= > > > > >rFc^g}|D]G}||}|D]}||vr||H|jrG|jr@|t j|j |jdz|S)z.Assembles the outputs of all the sub-commands.r) rget_finalized_commandrappendrr<r^ryrzrx)rCrrcmdrs rDrzinstall.get_outputsns--// - -H,,X66C OO-- - -7**NN8,,, - > Bd4 B NN27<<(<(,(?AA B B BrFcg}|D]>}||}||?|S)z*Returns the inputs of all the sub-commands)rrextend get_inputs)rCinputsrrs rDrzinstall.get_inputss[--// , ,H,,X66C MM#..** + + + + rFcf|jp|jS)zSReturns true if the current distribution has any Python modules to install.)rhhas_pure_moduleshas_ext_modulesrBs rDhas_libzinstall.has_libs2!22444!1133 5rFc4|jS)zLReturns true if the current distribution has any headers to install.)rh has_headersrBs rDrzinstall.has_headers ,,...rFc4|jS)zMReturns true if the current distribution has any scripts to. install.)rh has_scriptsrBs rDrzinstall.has_scriptsrrFc4|jS)zJReturns true if the current distribution has any data to. install.)rhhas_data_filesrBs rDhas_datazinstall.has_datas //111rFr4r3r5r6install_egg_infocdS)NTrBs rDzinstall.sTrF) __name__ __module__ __qualname__ descriptionrboolean_optionsr7rrrrEr~rarbrcrrrqrsrvrwr|rtrrrrrrrr sub_commandsrrFrDr r Zs;K9 9 9 Lv988O'VT@9LN O O Ov&&& 9-LFFF^U?U?U?t111&&.&.&.PMMM,555)))III AAA CCC % % %DMMM )))*)*)*)X ? ? ?"555 /// /// 222#0& 4& 4#1')9)9: LLLrFr )*__doc__rdrnr^re distutilsrdistutils.corerdistutils.debugrdistutils.sysconfigrdistutils.errorsrdistutils.file_utilrdistutils.utilr r r r r siterrr7rrrdistutils_scheme_namesys_scheme_namesys_key_INSTALL_SCHEMES sys_schememain_keyrvaluesubreplacerlr rrFrDrs//  """"""!!!!!!//////333333******@@@@@@@@@@''''''111111$& C #%2R@@  J JC3 J J./@ )  : 5 5  G6@6I-.s33 J / /H%h/5577 / / U|Y66 /99 68KLL )   ] "E  v % %#*:*:MM'?;;E).!#&& / I> " " OI K" $ $ OK M M M M M gM M M M M rF