a DOgh@sddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZmZmZdd lmZdd l mZdd lmZdd lmZd ZddddddZddddddddddddedZerdddddded<ddd d!dded"<dZGd#d$d$eZdS)%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 $userbaseZnt_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=Nz/opt/alt/python39/lib64/python3.9/distutils/command/install.pyinitialize_optionss2 zinstall.initialize_optionsc Csz|js|js|jr&|js|jr&td|jr@|js8|jr@td|jrl|jsd|jsd|jsd|jsd|jrltdtjdkr|jr| dd|_| dtjdkr| n| | dt jd}td d \}}z t j}Wntyd }Yn0|j|j|j|d t jdd dt jdd |||||t jd |_trh|j|jd<|j|jd<|| d|j|jd<|j|jd<trddlm}t d||j|!| d|jr|"|j#dur|jj$r|j%|_#n|j&|_#|'dddddddd|(|j#|_)tj*+|j#|j,|_#|j-dur^|.ddddddd| d|/d d!d"dS)#NzWmust 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 platformzpre-finalize_{unix,other}zpost-finalize_{unix,other}()rr"r#z%d.%dz%d%d) Z dist_nameZ dist_versionZ dist_fullname py_versionZpy_version_shortZpy_version_nodotZ sys_prefixr"Zsys_exec_prefixr#abiflags platlibdiruserbaseZusersitezpost-expand_basedirs()baseZplatbase)pprintz config vars:zpost-expand_dirs()librrrrrZlibbasezafter prepending rootbuild)r5r5)r6r6)0r"r#r$r%r&r r osnamewarn dump_dirs finalize_unixfinalize_othersysversionsplitrrAAttributeError distributionZget_nameZ get_versionZ get_fullname version_inforB config_vars HAS_USER_SITEr.r/expand_basedirsrrEprint expand_dirscreate_home_pathr+Z ext_modulesr)r( convert_pathshandle_extra_pathinstall_libbasepathjoin extra_dirsr' change_rootsZset_undefined_options)r9r@r"r#rArEr:r:r;finalize_optionss                         zinstall.finalize_optionscCstsdSddlm}t|d|jD]r}|d}|ddkrL|dd}||jvrx|j|}||}t|| }n||}t||}td||q(dS)Nr) longopt_xlate:=z %s: %s) rZdistutils.fancy_getoptrbrdebug user_options negative_opt translategetattr)r9msgrboptZopt_namevalr:r:r;rKvs         zinstall.dump_dirscCs"|jdus|jdur\|jdur2|jdur2|jdusP|jdusP|jdusP|jdurXtddS|j r|j durtt d|j |_|_| dn|j dur|j |_|_| dnl|jdur|jdurtdtjtj|_tjtj|_n|jdur|j|_|j|_|j|_| ddS)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&r+r(r)r*r,r-r r r.r select_schemer$r"r#rHr]normpathrNr8r:r:r;rLsL        zinstall.finalize_unixcCs|jr8|jdurtd|j|_|_|tjdn~|jdur\|j|_|_|dnZ|j durvtj t j |_ |j |_|_z|tjWn t ytdtjYn0dS)NrnZ_userrz)I don't know how to install stuff on '%s')r r.rr%r&rorHrIr$r"r]rprNKeyErrorr8r:r:r;rMs&     zinstall.finalize_othercCs<t|}tD]*}d|}t||dur t||||q dSNZinstall_)INSTALL_SCHEMES SCHEME_KEYSrjsetattr)r9rIZschemekeyattrnamer:r:r;ros zinstall.select_schemecCsX|D]N}t||}|durtjdks.tjdkr:tj|}t||j}t|||qdS)Nr=r)rjrHrIr] expanduserr rTru)r9attrsattrrmr:r:r; _expand_attrss   zinstall._expand_attrscCs|gddS)N)r%r&r'r{r8r:r:r;rVszinstall.expand_basedirscCs|gddS)N)r(r)r+r*r,r-r|r8r:r:r;rXszinstall.expand_dirscGs,|D]"}d|}t||tt||qdSrr)rurrjr9namesrIrzr:r:r;rZszinstall.convert_pathscCs|jdur|jj|_|jdurtdt|jtrB|jd|_t|jdkr`|jd}}n"t|jdkrz|j\}}ntdt |}nd}d}||_ ||_ dS)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>) r1rRrrJ isinstancestrrPlenr r path_filer_)r9rr_r:r:r;r[s(      zinstall.handle_extra_pathc Gs0|D]&}d|}t||t|jt||qdSrr)rur r'rjr}r:r:r;r` szinstall.change_rootscCsb|js dSttjd}|jD]8\}}||r$tj|s$| d|t |dq$dS)N~zos.makedirs('%s', 0o700)i) r rrHr]rxrTitems startswithisdirZ debug_printmakedirs)r9r$rIr]r:r:r;rYszinstall.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)NrGz"Can't install when cross-compilingz'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)r3Z run_commandrRZget_command_objZ plat_namer4r rget_sub_commandsrcreate_path_filer7 get_outputsr'rrangeexecutermaprHr]rprNnormcaser+r2rrf)r9Z build_platcmd_nameoutputsZroot_lenZcounterZsys_pathr+r:r:r;runsD    z install.runcCsJtj|j|jd}|jr8|t||jgfd|n| d|dS)N.pthz creating %szpath file '%s' not created) rHr]r^r\rr2rrr_rJ)r9filenamer:r:r;rJs  zinstall.create_path_filecCshg}|D].}||}|D]}||vr"||q"q |jrd|jrd|tj|j |jd|S)Nr) rget_finalized_commandrappendrr2rHr]r^r\)r9rrcmdrr:r:r;rXs    zinstall.get_outputscCs.g}|D]}||}||q |SN)rrextend get_inputs)r9Zinputsrrr:r:r;ris   zinstall.get_inputscCs|jp|jSr)rRZhas_pure_modulesZhas_ext_modulesr8r:r:r;has_libus zinstall.has_libcCs |jSr)rR has_headersr8r:r:r;r{szinstall.has_headerscCs |jSr)rR has_scriptsr8r:r:r;rszinstall.has_scriptscCs |jSr)rRZhas_data_filesr8r:r:r;has_dataszinstall.has_datar+r*r,r-Zinstall_egg_infocCsdS)NTr:r8r:r:r;zinstall.) __name__ __module__ __qualname__Z descriptionrgZboolean_optionsrUrrrhr<rarKrLrMror{rVrXrZr[r`rYrrrrrrrrZ sub_commandsr:r:r:r;rIsJ; N(  " ,  r)rNrHZ distutilsrZdistutils.corerZdistutils.debugrZdistutils.sysconfigrZdistutils.errorsrZdistutils.file_utilrZdistutils.utilrr r r r Zsiter rrUZWINDOWS_SCHEMErsrtrr:r:r:r;s`