_du dZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddlm Z ddl mZdd lmZmZmZdd lmZdd lmZmZd d lmZddlmZddlmZddlmZdZddddddZddddddddddddeddddddddddddd Z erd!d!d"d#d$de d%<d!d!d&d'd$de d(<e jCejDdZ#d)Z$d*Z%d+Z&d,Z'd-Z(d.Z)d/Z*d0Z+d1Z,d2Z-Gd3d4e Z.y)5zFdistutils.command.install Implements the Distutils 'install' command.N)log)Command)DEBUG)get_config_vars) write_file) convert_path subst_vars change_root) get_platform)DistutilsOptionErrorDistutilsPlatformError)_framework_compat) _collections) USER_BASE) USER_SITETz{base}/Lib/site-packagesz{base}/Include/{dist_name}z{base}/Scriptsz{base})purelibplatlibheadersscriptsdatazA{base}/lib/{implementation_lower}{py_version_short}/site-packageszN{platbase}/{platlibdir}/{implementation_lower}{py_version_short}/site-packageszM{base}/include/{implementation_lower}{py_version_short}{abiflags}/{dist_name}z {base}/binz!{base}/lib/{implementation_lower}z*{base}/{platlibdir}/{implementation_lower}z1{base}/include/{implementation_lower}/{dist_name}z{base}/site-packagesz{base}/include/{dist_name}) posix_prefix posix_homentpypypypy_ntz {usersite}zF{userbase}/{implementation}{py_version_nodot_plat}/Include/{dist_name}z:{userbase}/{implementation}{py_version_nodot_plat}/Scriptsz {userbase}nt_userzQ{userbase}/include/{implementation_lower}{py_version_short}{abiflags}/{dist_name}z{userbase}/bin posix_userc tjt5tjDcic]}|tj |dc}cdddScc}w#1swYyxYw)NF)expand) contextlibsuppressAttributeError sysconfigget_scheme_names get_paths)schemes G/usr/lib/python3/dist-packages/setuptools/_distutils/command/install.py_load_sysconfig_schemesr*csb   ^ , $446  I''u= =      sA!AA!A!!A*c txsi}ttjt|Dcic]-}|itj |i|j |i/c}Scc}w)z= Extend default schemes with schemes from sysconfig. )r*set itertoolschainINSTALL_SCHEMESget)sysconfig_schemesr(s r) _load_schemesr2ks{ 017R)///;LMN     !!&"- ##FB/    s2A)c&ttdryy)Npypy_version_infoPyPyPython)hasattrsysr)_get_implementationr;{ss'(r:ct|tt|}t|j t |t |yN)_inject_headers _load_scheme_resolve_schemevarsupdate _remove_set _scheme_attrs)obnamer(s r)_select_schemerGs4 T<0E#F GFHOOKM&$9:;r:cp|jDcic]\}}t||||c}}Scc}}w)z1 Include only attrs that are None in ob. )itemsgetattr)rEattrskeyvalues r)rCrCs2*/ S:3'"c:J:RCJ SS Ss22c|jd\}}} tj|}|S#t$r"t j t |}Y|SwxYw)N_) partitionr%get_preferred_scheme Exceptionfwr( _pypy_hack)rFos_nameseprLresolveds r)r@r@s\s+GS#/11#6 O /99Z-. O/s.'AAct|Sr=)r2)rFs r)r?r?s ?4  r:cXtt|}|jd|d|S)z Given a scheme name and the resolved scheme, if the scheme does not include headers, resolve the fallback scheme for the name and use headers from it. pypa/distutils#88 r)r?rT setdefault)rFr(fallbacks r)r>r>s-Jt,-H i)!45 Mr:cBtDcic] }d||| c}Scc}w)z|d<tAjBtEjF|tIj |g|_%|jM|jd|j|d<|j|d<tNr,d dl(m(}tSd|t7|jJ|jU|jd|j r|jW|jX=|j&j[r|j\|_,n|j^|_,|jadddd d!d"dd|jc|jX|_2tjfji|jX|jj|_,|jl|jod#dddd d!d"|jd$|jqd%d&d'y#t$$rd }YwxYw)(zFinalizes options.zWmust supply either prefix/exec-prefix/home or install-base/install-platbase -- not bothz9must supply either home or prefix/exec-prefix -- not bothzGcan't combine user with prefix, exec_prefix/home, or install_(plat)baseposixz+exec-prefix option ignored on this platformNzpre-finalize_{unix,other}zpost-finalize_{unix,other}()rrjrwz%d.%drz%d%d platlibdirlib) dist_name dist_version dist_fullname py_versionpy_version_shortpy_version_nodot sys_prefixrjsys_exec_prefixrwabiflagsrimplementation_lowerimplementationwinver.)py_version_nodot_platuserbaseusersitezpost-expand_basedirs()baseplatbase)pprintz config vars:zpost-expand_dirs()rrrrrlibbasezafter prepending rootbuild)rr)rr)9rjrwrxryrzr rurgrFwarn dump_dirs finalize_unixfinalize_otherr8versionsplitrrr$ distributionget_name get_version get_fullnamererJr;lowerdictreplace HAS_USER_SITErrr DictStackrSrAr% config_varsexpand_basedirsrrprint expand_dirscreate_home_pathrhas_ext_modulesr}r| convert_pathshandle_extra_pathinstall_libbasepathjoin extra_dirsr{ change_rootsset_undefined_options)rrrjrwr local_vars compat_varsrs r)finalize_optionszinstall.finalize_optionsLs KK4++tyy   !6!6&>  99$++)9)9&K  99 KKyy  $$&:  77g  GH#'  23 77g        ! 56[[&&(+ /- H ||H **335 --99;!..;;=$ '#*:*:2A*> > &)9)9"1)= = *& !#|U;$7$9$?$?$A13 $")#x"<"D"DS""M %)%:%:Jz "%)%:%:Jz "'11 WWY Y%>%>%@* M   /0".. 6!%!6!6 :  % . ! 4(() *  +, 99  ! ! #    #  002#'#7#7 #'#7#7            #//77<<(8(8$//J 99   5)Y 69  ./ "" 13M K H sR RRcttsyddlm}tj|dz|j D]}|d}|ddk(r|dd}||j vr.|j |}|j|}t|| }n|j|}t||}tjd||y) zDumps the list of user options.Nr) longopt_xlate:r=z %s: %s) r fancy_getoptrrdebug user_options negative_opt translaterJ)rmsgroptopt_namevals r)rzinstall.dump_dirss 0 #)$$ 1C1vH|s"#Ab>4,,,,,X6#--m<!$11#--m<dH- IIj(C 0 1r:c|j |jl|jduxr|jduxr|jduxs.|j duxs|j duxs|jdu}|r tdy|jrA|j td|jx|_|_|jdy|j*|jx|_|_|jdy|j|j tdt!t"dd}t$j&j)t*j|z|_t$j&j)t*j|z|_n|j|j|_|j|_|j|_|jd y) 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 prefix_prefix_additionrr)ryrzrr|r}r~rrr rurr select_schemerxrjrwrJr%rgrnormpathr8)rincomplete_schemers r)rzinstall.finalize_unixs    (D,A,A,M$$,5,,45,,4- ''4/ - ''4/ -$$, !*8  99$$,,-STT8<8M8M MD  5   | , YY "8< AD  5   | ,{{"##/.D $+96H"#M  gg..szz:=MM #%77#3#3COO#DGW#W ##+'+{{D$ $ D $($4$4D !   ~ .r:cj|jrR|j td|jx|_|_|j t jdzy|j*|jx|_|_|j dy|j2t jjtj|_ |jx|_|_ |j t jy#t$rtdt jzwxYw)z)Finalizes options for non-posix platformsNrrbrz)I don't know how to install stuff on '%s')rurrryrzrrgrFrxrjrrr8KeyErrorrs r)rzinstall.finalize_otherFs 99$$,,-STT8<8M8M MD  5   rww0 1 YY "8< AD  5   | ,{{" gg..szz: 8< CD  5 ""277+ ,?"''I s ,D &D2ct||yr=)rG)rrFs r)rzinstall.select_scheme\s tT"r:c|D]e}t||}|tjdvrtjj |}t ||j }t|||gy)N)rr)rJrgrFr expanduserr rsetattr)rrKattrrs r) _expand_attrszinstall._expand_attrs_s` )D$%C77o-'',,S1C d&6&67dC(  )r:c*|jgdy)zNCalls `os.path.expanduser` on install_base, install_platbase and root.)ryrzr{Nrrs r)rzinstall.expand_basedirshs GHr:c*|jgdy)z+Calls `os.path.expanduser` on install dirs.)r|r}rr~rrNrrs r)rzinstall.expand_dirsms   r:c \|D]'}d|z}t||tt||)y)z!Call `convert_path` over `names`.r]N)rr rJrnamesrFrs r)rzinstall.convert_pathszs5 CD$D D$ WT4-@ A B Cr:c|j|jj|_|jtjdt |jt r |jj d|_t|jdk(r|jdx}}n3t|jdk(r|j\}}n tdt|}nd}d}||_ ||_ y) z4Set `path_file` and `extra_dirs` using `extra_path`.NzIDistribution option extra_path is deprecated. See issue27919 for details.,rrrzY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsr) rrrwarning isinstancestrrlenr r path_filer)rrrs r)rzinstall.handle_extra_paths ?? ""//::DO ?? & KK. $//3/"&//"7"7"<4??#q()-);; JT__%*(,% :*B&j1JIJ#$r:c r|D]2}d|z}t||t|jt||4y)z:Change the install directories pointed by name using root.r]N)rr r{rJrs r)rzinstall.change_rootss; MD$D D$ DIIwtT7J K L Mr:c||jsyttjj d}|j j D]j\}}t|j|s!tjj|rA|jd|ztj|dly)zCreate directories under ~.N~zos.makedirs('%s', 0o700)i) rur rgrrrrIr startswithisdir debug_printmakedirs)rrxrFrs r)rzinstall.create_home_pathsyy BGG..s34**002 )JD$4y##D)"''--2E  !;d!BC D%( )r:cD|jsZ|jd|jjdj}|j r|t k7r td|jD]}|j||jr|j|jr|j}|jr9t|j}tt|D] }|||d||<|j!t"|j|fd|jzt%t&j(j*t,j(}t%t&j(j.|}t&j(j/t&j(j+|j0}|j r?|jr |j2s&||vr!t5j6d|j0yyyy)zRuns the command.rz"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_commandrget_command_obj plat_namerr rget_sub_commandsrcreate_path_filer get_outputsr{rrangeexecutermaprgrrr8normcaserrrr)r build_platcmd_nameoutputsroot_lencountersys_pathrs r)runz install.runs   W %**::7CMMJ}}|~!=,-TUU--/ 'H   X & ' >>  ! ! # ;;&&(Gyytyy>$S\2CG'.w'7 'BGG$C LLg&9DKKG  rww''2rww''2gg&&rww'7'78H8H'IJ MM^^(>(>8+ IIE   ,)? r:ctjj|j|jdz}|j r(|j t||jgfd|zy|jd|zy)zCreates the .pth file.pthz creating %szpath file '%s' not createdN) rgrrrrrrrrr)rfilenames r)rzinstall.create_path_filesf77<< 4 4dnnv6MN  ! ! LLX'89=8;S  II2X= >r:chg}|jD]>}|j|}|jD]}||vs|j|@|jrR|j rF|jt jj|j|jdz|S)z.Assembles the outputs of all the sub-commands.r ) rget_finalized_commandrappendrrrgrrr)rrrcmdr s r)rzinstall.get_outputss--/ -H,,X6C OO- -7*NN8, -  - >>d44 NN277<<(<(UV Wr:cg}|jD]2}|j|}|j|j4|S)z*Returns the inputs of all the sub-commands)rrextend get_inputs)rinputsrrs r)rzinstall.get_inputssK--/ ,H,,X6C MM#..* + , r:cn|jjxs|jjS)zSReturns true if the current distribution has any Python modules to install.)rhas_pure_modulesrrs r)has_libzinstall.has_libs/    . . 0 WD4E4E4U4U4W r:c6|jjS)zLReturns true if the current distribution has any headers to install.)r has_headersrs r)rzinstall.has_headers  ,,..r:c6|jjS)zMReturns true if the current distribution has any scripts to. install.)r has_scriptsrs r)rzinstall.has_scriptsrr:c6|jjS)zJReturns true if the current distribution has any data to. install.)rhas_data_filesrs r)has_datazinstall.has_data s  //11r:rr~rrinstall_egg_infocy)NTr9rs r)zinstall.,sr:) __name__ __module__ __qualname__ descriptionrboolean_optionsrrrrrrrrrrrrrrrrrr rrrrrrr  sub_commandsr9r:r)rmrms;K:Lx9O T>J K  v& ),LEZp j1(//b,#)I  C !%FM )0d?  / / 2  K( K( " ./ Lr:rm)/__doc__r8rgr"r%r-distutils._logrcorerrrr file_utilrutilr r r r errorsr rrrrSrsiterrrWINDOWS_SCHEMEr/rBschemesr^r*r2r;rGrCr@r?r>rDrTrmr9r:r)r3sf/ '"88A% *)+  W+37?F  ))/  *)/# 3 FO "OI 3# %OL!rzz" C    < T! B 6w gw r: