a `h@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZmZmZdd lmZdd l mZdd lmZdd lmZdZddddddZddddddddddddedZerdddddded <ddd!d"dded#<dZGd$d%d%eZdS)&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_SITETz$base/Lib/site-packagesz$base/Include/$dist_namez $base/Scriptsz$base)purelibplatlibheadersscriptsdataz/$base/lib/python$py_version_short/site-packagesz;$platbase/$platlibdir/python$py_version_short/site-packagesz9$base/include/python$py_version_short$abiflags/$dist_namez $base/binz$base/lib/pythonz$base/$platlibdir/pythonz$base/include/python/$dist_name) unix_prefix unix_homentz $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_userc@seZdZdZgdZgdZer>edddefedddiZ d d Z d d Z d dZ ddZ ddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3efd4efd5efd6efd7d8d9fgZdS):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)rtrLrMre expanduserr r[r)r:attrsattrrwr;r;r< _expand_attrss   zinstall._expand_attrscCs|gddS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.)r&r'r(Nrr9r;r;r<r]szinstall.expand_basedirscCs|gddS)z+Calls `os.path.expanduser` on install dirs.)r)r*r,r+r-r.Nrr9r;r;r<r_szinstall.expand_dirscGs,|D]"}d|}t||tt||qdS)z!Call `convert_path` over `names`.r|N)rrrtr:namesrMrr;r;r<rbszinstall.convert_pathscCs|jdur|jj|_|jdurtdt|jtrB|jd|_t|jdkr`|jd}}n"t|jdkrz|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"rr@zY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementsr?) r2rVrrN isinstancestrrTlenr r path_filerg)r:rrgr;r;r<rcs(      zinstall.handle_extra_pathc Gs0|D]&}d|}t||t|jt||qdS)z:Change the install directories pointed by name using root.r|N)rr r(rtrr;r;r<rh szinstall.change_rootscCsb|js dSttjd}|jD]8\}}||r$tj|s$| d|t |dq$dS)zCreate directories under ~.N~zos.makedirs('%s', 0o700)i) r!rrLrerr[items startswithisdir debug_printmakedirs)r:r%rMrer;r;r<r`szinstall.create_home_pathcCs"|js6|d|jdj}|jr6|tkr6td|D]}||q>|j r\| |j r| }|j rt|j }tt|D]}|||d||<q|t|j |fd|j ttjjtj}ttjj|}tjtj|j}|jr|j r|js||vrtd|jdS)zRuns the command.rKz"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)r4 run_commandrVget_command_obj plat_namer5r rget_sub_commandsrcreate_path_filer8 get_outputsr(rrangeexecutermaprLrerzrRnormcaser,r3rrp)r:Z build_platcmd_nameoutputsZroot_lenZcounterZsys_pathr,r;r;r<runsD    z install.runcCsJtj|j|jd}|jr8|t||jgfd|n| d|dS)zCreates the .pth file.pthz creating %szpath file '%s' not createdN) rLrerfrdrr3rrrgrN)r:filenamer;r;r<rJs  zinstall.create_path_filecCshg}|D].}||}|D]}||vr"||q"q |jrd|jrd|tj|j |jd|S)z.Assembles the outputs of all the sub-commands.r) rget_finalized_commandrappendrr3rLrerfrd)r:rrcmdrr;r;r<rXs    zinstall.get_outputscCs.g}|D]}||}||q |S)z*Returns the inputs of all the sub-commands)rrextend get_inputs)r:Zinputsrrr;r;r<ris   zinstall.get_inputscCs|jp|jS)zSReturns true if the current distribution has any Python modules to install.)rVhas_pure_moduleshas_ext_modulesr9r;r;r<has_libus zinstall.has_libcCs |jS)zLReturns true if the current distribution has any headers to install.)rV has_headersr9r;r;r<r{szinstall.has_headerscCs |jS)zMReturns true if the current distribution has any scripts to. install.)rV has_scriptsr9r;r;r<rszinstall.has_scriptscCs |jS)zJReturns true if the current distribution has any data to. install.)rVhas_data_filesr9r;r;r<has_dataszinstall.has_datar,r+r-r.Zinstall_egg_infocCsdS)NTr;r9r;r;r<zinstall.) __name__ __module__ __qualname__ descriptionrqboolean_optionsr\rrrrr=rjrOrPrQryrr]r_rbrcrhr`rrrrrrrr sub_commandsr;r;r;r<rIsJ; N(  " ,  r)__doc__rRrL distutilsrdistutils.corerdistutils.debugrdistutils.sysconfigrdistutils.errorsrdistutils.file_utilrdistutils.utilrr r r r Zsiter rr\ZWINDOWS_SCHEMEr}r~rr;r;r;r<sb