ZQdRx dZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z ddlmZddlmZdd lmZmZmZdd lmZdd lmZdd lmZdd lmZeduZdZiiidZdddddddddd ed<dddddddddd ed<eD]6Zd D]1\ZZ eZ!ej"e Z#ed!kree#vrd"Z!e#e!eee<27eD]Z$ee$%D]\ZZ&ej'd#d$e&Z&e&(d%d&Z&e&(d'd(Z&ed!kre&d)z Z&ej)d*kred+kre&(d,d-Z&e&ee$e<erd.d.d/d0d1ded2<d.d.d3d4d1ded5<Gd6d7eZ*dS)8zFdistutils.command.install Implements the Distutils 'install' command.N)log)Command)DEBUG)get_config_varsis_virtual_environment)DistutilsPlatformError) write_file) convert_path subst_vars change_root) get_platform)DistutilsOptionError) USER_BASE) USER_SITE)purelibplatlibheadersscriptsdata) unix_prefix unix_homentz6{installed_base}/{platlibdir}/python{py_version_short}z0{platbase}/{platlibdir}/python{py_version_short}z7{base}/local/lib/python{py_version_short}/dist-packageszD{platbase}/local/{platlibdir}/python{py_version_short}/dist-packagesz;{installed_base}/include/python{py_version_short}{abiflags}z7{base}/local/include/python{py_version_short}{abiflags}z?{installed_platbase}/include/python{py_version_short}{abiflags}z{base}/local/binz {base}/local) stdlib platstdlibrrincluder platincluderr unix_localz {base}/lib/python3/dist-packagesz-{platbase}/{platlibdir}/python3/dist-packagesz {base}/binz{base} deb_system))r posix_prefix)r posix_home)rrrrz \{(.+?)\}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=Nzr?r@ sysconfigis_python_buildget_config_varexpand_basedirsrrcprint expand_dirscreate_home_pathr; ext_modulesr9r8 convert_pathshandle_extra_pathinstall_libbasepathjoin extra_dirsr7 change_rootsset_undefined_options)rLrWr1r2r\rcs rMfinalize_optionszinstall.finalize_optionss [ @D, @  @   @"&"7 @&?@@ @ 9 O$+ O)9 O&MOO O 9 R$+ R)9 RTY R! R%)%: R&(QRR R 7g   ( GHHH#'  2333 7g         ! ! ! 5666[&&((+ /- H H |HH   HHH *.):)C)C)E)E,0,=,I,I,K,K-1->-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)rLmsgroptopt_namevals rMrjzinstall.dump_dirss  F888888 #)$ 1 1C1vH|s""#AbD>4,,,,X6#--m<<!$111#--m<<dH-- Ij(C 0 0 0 0 1 1rOcj|j|j;|j|j|j|j|j|jtddS|j r@|j td|j x|_|_| ddS|j *|j x|_|_| ddS|j|_|js|jtdt"jt(j|_t"jt(j|_n|j |j|_|j|_|j|_|jr|jdvr0ddl}|jd |_| d dS|jd vr| d dStd |jr(t"j|jdkst5r| d dSt"j|jdkrdx|_|_dx|_|_| ddS)z&Finalizes options for posix platforms.NzPinstall-base or install-platbase supplied, but installation scheme is incomplete$User base directory is not specifiedr$rz*must not supply exec-prefix without prefix)debr MULTIARCHr)unixrz"unknown value for --install-layoutz /usr/localz/usrr)r5r6r;r8r9r:r<r=rr.r?r select_schemer3r1r4r2rgrnormpathrmrAlowerrwryrBr)rLrws rMrkzinstall.finalize_unixs   (D,A,M!)%-%-$,$,!)*:;;; F 9+ 1$,,:<<<8<8M MD  5   { + + + + + Y "8< AD  5   { + + + + +!%D {"#/.FHHH!g..sz:: #%7#3#3CO#D#D  #+'+{D$ $ D $($4D !" 1&,,..'99$$$$%=Y%=k%J%JDN&&|44444(..00H<<&&}55555.<>>>% 17##DK00L@@+--A""=111117##DK00L@@5;;DK$"2@FFD%(=""<00000rOc4|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.r?rr5r6rrgrhr3r1rrrmKeyErrorrKs rMrlzinstall.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)rLrhschemekeyattrnames rMrzinstall.select_schemesX!& 5 5C!C'HtX&&.hs 444 5 5rOc|D]y}t||}|etjdkstjdkrtj|}t ||j}t|||zdS)NrQr)rrgrhr expanduserr rvr)rLattrsattrrs rM _expand_attrszinstall._expand_attrss ) )D$%%C7g%%D',,S11C d&677dC(((  ) )rOc4|gddS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.)r5r6r7NrrKs rMrzzinstall.expand_basedirs"s% GGGHHHHHrOc4|gddS)z+Calls `os.path.expanduser` on install dirs.)r8r9r;r:r<r=NrrKs rMr|zinstall.expand_dirs's; @@@ A A A A ArOc r|D]3}d|z}t||tt||4dS)z!Call `convert_path` over `names`.rN)rr rrLnamesrhrs rMrzinstall.convert_paths-sP C CD$D D$ WT4-@-@ A A B B B B C CrOc|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.,r0rrSzY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsrR) rDrqrri isinstancestrrolenrr path_filer)rLrrs rMrzinstall.handle_extra_path3s ? ""/:DO ? & H.   $/3// ="&/"7"7"<"<4?##q(()-);; JJT_%%**(,% ::*DEEE &j11JJIJ#$rOc ~|D]9}d|z}t||t|jt||:dS)z:Change the install directories pointed by name using root.rN)rr r7rrs rMrzinstall.change_rootsUsT M MD$D D$ DIwtT7J7J K K L L L L M MrOcp|jsdSttjd}|jD]f\}}||rLtj|s-| d|ztj |dgdS)zCreate directories under ~.N~zos.makedirs('%s', 0o700)i) r.r rgrrrvitems startswithisdir debug_printmakedirs)rLr3rhrs rMr}zinstall.create_home_path[sy  FBG..s3344*0022 ) )JD$t$$ )RW]]4-@-@ )  !;d!BCCC D%((( ) )rOc|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.rfz"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)rF run_commandrqget_command_obj plat_namerGr rget_sub_commandsrcreate_path_filerJ get_outputsr7rrangeexecuter maprgrrrmnormcaser;rErr)rL build_platcmd_nameoutputsroot_lencountersys_pathr;s rMrunz install.rungs# @   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' ) ) ) ) ) ) ) ' ' ) )rOctj|j|jdz}|jr)|t||jgfd|zdS| d|zdS)zCreates the .pth file.pthz creating %szpath file '%s' not createdN) rgrrrrrErr rri)rLfilenames rMrzinstall.create_path_files7<< 4 $ 799  ! ? LL"T_$56&1 3 3 3 3 3 II2X= > > > > >rOc^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_commandrappendrrErgrrr)rLrrcmdrs rMrzinstall.get_outputss--// - -H,,X66C OO-- - -7**NN8,,, - > Bd4 B NN27<<(<(,(?AA B B BrOcg}|D]>}||}||?|S)z*Returns the inputs of all the sub-commands)rrextend get_inputs)rLinputsrrs rMrzinstall.get_inputss[--// , ,H,,X66C MM#..** + + + + rOcf|jp|jS)zSReturns true if the current distribution has any Python modules to install.)rqhas_pure_moduleshas_ext_modulesrKs rMhas_libzinstall.has_libs2!22444!1133 5rOc4|jS)zLReturns true if the current distribution has any headers to install.)rq has_headersrKs rMrzinstall.has_headers ,,...rOc4|jS)zMReturns true if the current distribution has any scripts to. install.)rq has_scriptsrKs rMrzinstall.has_scriptsrrOc4|jS)zJReturns true if the current distribution has any data to. install.)rqhas_data_filesrKs rMhas_datazinstall.has_datas //111rOr;r:r<r=install_egg_infocdS)NTrKs rMzinstall.sTrO) __name__ __module__ __qualname__ descriptionrboolean_optionsr>rrrrNrrjrkrlrrrzr|rrrr}rrrrrrrr sub_commandsrrOrMr&r&rs;K< < < L|988O'VT@9LN O O Ov&&& 9-LKKKhU?U?U?t111&919191vMMM,555)))III AAA CCC % % %DMMM )))*)*)*)X ? ? ?"555 /// /// 222#0& 4& 4#1')9)9: LLLrOr&)+__doc__rmrwrgre distutilsrdistutils.corerdistutils.debugrdistutils.sysconfigrrdistutils.errorsrdistutils.file_utilr distutils.utilr r r r rsiterrr>rrrdistutils_scheme_namesys_scheme_namesys_key_INSTALL_SCHEMES sys_schememain_keyrvaluesubreplacerur&rrOrMr s_//  """"""!!!!!!GGGGGGGG333333******@@@@@@@@@@''''''111111$& C #%2R@@GDHULHT!  ! ! GD1>LLT  ! !   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 h h h h h gh h h h h rO