3 ª fuhã@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZmZmZdd lmZdd l mZdd lmZdd lmZdZddddddœZddddddœddddddœedœZe�rddddddœed <ddd!d"ddœed#<d+ZGd)d*„d*eƒZdS),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)ÚpurelibÚplatlibÚheadersÚscriptsÚdataz/$base/lib/python$py_version_short/site-packagesz5$platbase/lib64/python$py_version_short/site-packagesz9$base/include/python$py_version_short$abiflags/$dist_namez $base/binz$base/lib/pythonz$base/lib64/pythonz$base/include/python/$dist_name)Ú unix_prefixÚ unix_homeÚntz $usersitez4$userbase/Python$py_version_nodot/Include/$dist_namez)$userbase/Python$py_version_nodot/Scriptsz $userbaseÚnt_userz=$userbase/include/python$py_version_short$abiflags/$dist_namez $userbase/binÚ unix_userrrrrrc@s:eZdZdZd_d`dadbdddedfdgdidjdkdldmdndodpdqdrgZdd%d(gZer`ejd,dd-efƒejd,ƒd diZ d.d/„Z d0d1„Z d2d3„Z d4d5„Z d6d7„Zd8d9„Zd:d;„Zdd?„Zd@dA„ZdBdC„ZdDdE„ZdFdG„ZdHdI„ZdJdK„ZdLdM„ZdNdO„ZdPdQ„ZdRdS„ZdTdU„ZdVdW„ZdXefdYefdZefd[efd\d]d^„fgZdS)sÚinstallz'install everything from build directoryúprefix=Núinstallation prefixú exec-prefix=ú.(Unix only) prefix for platform-specific filesúhome=ú+(Unix only) home directory to install underú install-base=ú;base installation directory (instead of --prefix or --home)úinstall-platbase=z8base installation directory for platform-specific files z$(instead of --exec-prefix or --home)úroot=ú/opt/alt/python36/lib64/python3.6/distutils/command/install.pyÚinitialize_options’s2 zinstall.initialize_optionscCsx|js|js|jr&|js|jr&td%ƒ‚|jr@|js8|jr@tdƒ‚|jrl|jsd|jsd|jsd|jsd|jrltdƒ‚tjdkrŒ|jrŒ|j dƒd|_|j dƒtjdkrª|j ƒn|j ƒ|j d ƒt jjƒd }td d ƒ\}}y t j}Wntk rúd }YnX|jjƒ|jjƒ|jjƒ|dt jdd…dt jdd…|||||dœ |_t�rf|j|jd<|j|jd<|jƒ|j dƒ|j|jd<|j|jd<t�r´d dlm}tdƒ||jƒ|j ƒ|j dƒ|j�rÖ|j!ƒ|j"dk�rþ|jj#�rö|j$|_"n|j%|_"|j&ddddddddƒ|j'ƒ|j"|_(tj)j*|j"|j+ƒ|_"|j,dk �r\|j-d ddddddƒ|j d!ƒ|j.d"d&d'ƒdS)(zFinalizes options.z.must supply either prefix/exec-prefix/home or z)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)baseÚposixz+exec-prefix option ignored on this platformNzpre-finalize_{unix,other}zpost-finalize_{unix,other}()rrArBÚz%d.%déz%d%d) Z dist_nameZ dist_versionZ dist_fullnameÚ py_versionÚpy_version_shortÚpy_version_nodotZ sys_prefixrAZsys_exec_prefixrBÚabiflagsÚuserbaseZusersitezpost-expand_basedirs()ÚbaseÚplatbase)Úpprintz config vars:zpost-expand_dirs()ÚlibrrrrrZlibbasezafter prepending rootÚbuildrTrUzWmust supply either prefix/exec-prefix/home or install-base/install-platbase -- not both)rTrT)rUrU)/rArBrCrDrEr r?ÚosÚnameÚwarnÚ dump_dirsÚ finalize_unixÚfinalize_otherÚsysÚversionÚsplitrraÚAttributeErrorÚ distributionZget_nameZ get_versionZ get_fullnameÚ version_infoÚ config_varsÚ HAS_USER_SITErMrNÚexpand_basedirsrreÚprintÚ expand_dirsÚcreate_home_pathrJZ ext_modulesrHrGÚ convert_pathsÚhandle_extra_pathÚinstall_libbaseÚpathÚjoinÚ extra_dirsrFÚ change_rootsZset_undefined_options)rWr^rArBrarerXrXrYÚfinalize_optionsàsŠ                           zinstall.finalize_optionscCs¤tsdSddlm}tj|dƒx||jD]r}|d}|ddkrN|dd …}||jkrz|j|}|j|ƒ}t||ƒ }n|j|ƒ}t||ƒ}tjd||ƒq*WdS) zDumps the list of user options.Nr)Ú longopt_xlateú:r@ú=z %s: %séÿÿÿÿr…) rZdistutils.fancy_getoptr‚rÚdebugÚ user_optionsÚ negative_optÚ translateÚgetattr)rWÚmsgr‚ZoptZopt_nameÚvalrXrXrYrkus         zinstall.dump_dirscCs"|jdk s|jdk r\|jdkr2|jdkr2|jdksP|jdksP|jdksP|jdkrXtdƒ‚dS|j rŽ|j dkrtt dƒ‚|j |_|_|j dƒn�|j dk r²|j |_|_|j dƒnl|jdkrð|jdk rÎtdƒ‚tjjtjƒ|_tjjtjƒ|_n|jdk�r|j|_|j|_|j|_|j dƒdS)z&Finalizes options for posix platforms.NzPinstall-base or install-platbase supplied, but installation scheme is incompletez$User base directory is not specifiedrrz*must not supply exec-prefix without prefixr)rDrErJrGrHrIrKrLr r?rMrÚ select_schemerCrArBrhr}Únormpathrn)rWrXrXrYrlˆs<             zinstall.finalize_unixc Cs¼|jr8|jdkrtdƒ‚|j|_|_|jtjdƒn€|jdk r\|j|_|_|jdƒn\|j dkrvtj j t j ƒ|_ |j |_|_y|jtjƒWn"t k r¶tdtjƒ‚YnXdS)z)Finalizes options for non-posix platformsNz$User base directory is not specifiedZ_userrz)I don't know how to install stuff on '%s')r?rMrrDrEr�rhrirCrAr}rŽrnÚKeyError)rWrXrXrYrm°s"    zinstall.finalize_othercCs@t|}x2tD]*}d|}t||ƒdkrt||||ƒqWdS)z=Sets the install directories by applying the install schemes.Úinstall_N)ÚINSTALL_SCHEMESÚ SCHEME_KEYSrŠÚsetattr)rWriÚschemeÚkeyZattrnamerXrXrYr�Æs  zinstall.select_schemecCs\xV|D]N}t||ƒ}|dk rtjdks0tjdkr|jƒD]2}|j|ƒ}x"|jƒD]}||kr&|j|ƒq&WqW|jrl|jrl|jtjj|j |jdƒƒ|S)z.Assembles the outputs of all the sub-commands.z.pth) r¤Úget_finalized_commandr¦ÚappendržrQrhr}r~r|)rWr¬r«Úcmdr®rXrXrYr¦Ws  zinstall.get_outputscCs2g}x(|jƒD]}|j|ƒ}|j|jƒƒqW|S)z*Returns the inputs of all the sub-commands)r¤r¯ÚextendÚ get_inputs)rWZinputsr«r±rXrXrYr³hs  zinstall.get_inputscCs|jjƒp|jjƒS)zSReturns true if the current distribution has any Python modules to install.)rrZhas_pure_modulesZhas_ext_modules)rWrXrXrYÚhas_libts zinstall.has_libcCs |jjƒS)zLReturns true if the current distribution has any headers to install.)rrÚ has_headers)rWrXrXrYrµzszinstall.has_headerscCs |jjƒS)zMReturns true if the current distribution has any scripts to. install.)rrÚ has_scripts)rWrXrXrYr¶szinstall.has_scriptscCs |jjƒS)zJReturns true if the current distribution has any data to. install.)rrZhas_data_files)rWrXrXrYÚhas_data„szinstall.has_datarJrIrKrLZinstall_egg_infocCsdS)NTrX)rWrXrXrYÚ�szinstall.)rNr)rNr)rNr)r Nr!ú\base installation directory for platform-specific files (instead of --exec-prefix or --home))r"Nr¹)r#Nr$)r%Nr&)r'Nr(úginstallation directory for all module distributions (overrides --install-purelib and --install-platlib))r)Nrº)r*Nr+)r,Nr-)r.Nr/)r0r1r2)r3Nr4)r5r6r7)r8r9r:)r;Nr<)r=Nr>) Ú__name__Ú __module__Ú __qualname__Z descriptionr‡Zboolean_optionsrur°rrˆrZr�rkrlrmr�r˜rvrxrzr{r€ryr­r¥r¦r³r´rµr¶r·Z sub_commandsrXrXrXrYrIsŒ   N(  " , r)rrrrr)Ú__doc__rnrhZ distutilsrZdistutils.corerZdistutils.debugrZdistutils.sysconfigrZdistutils.errorsrZdistutils.file_utilrZdistutils.utilrr r r r Zsiter rruZWINDOWS_SCHEMEr‘r’rrXrXrXrYÚsV