3  fuh@sdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZmZmZdd lmZdd l mZdd lmZdd lmZdZddddddZddddddddddddedZerdddddded <ddd!d"dded#<d+ZGd)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-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_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_userrrrrrc@s:eZdZdZd_d`dadbdddedfdgdidjdkdldmdndodpdqdrgZdd%d(gZer`ejd,dd-efejd,d diZ d.d/Z d0d1Z d2d3Z d4d5Z d6d7Zd8d9Zd:d;Zdd?Zd@dAZdBdCZdDdEZdFdGZdHdIZdJdKZdLdMZdNdOZdPdQZdRdSZdTdUZdVdWZdXefdYefdZefd[efd\d]d^fgZdS)sinstallz'install everything from build directoryprefix=Ninstallation prefix exec-prefix=.(Unix only) prefix for platform-specific fileshome=+(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.pyinitialize_optionss2 zinstall.initialize_optionscCsx|js|js|jr&|js|jr&td%|jr@|js8|jr@td|jrl|jsd|jsd|jsd|jsd|jrltdtjdkr|jr|j dd|_|j dtjdkr|j n|j |j d t jjd }td d \}}y t j}Wntk rd }YnX|jj|jj|jj|dt jdddt jdd|||||d |_trf|j|jd<|j|jd<|j|j d|j|jd<|j|jd<trd dlm}td||j|j |j d|jr|j!|j"dkr|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)baseposixz+exec-prefix option ignored on this platformNzpre-finalize_{unix,other}zpost-finalize_{unix,other}()rrArBz%d.%dz%d%d) Z dist_nameZ dist_versionZ dist_fullname py_versionpy_version_shortpy_version_nodotZ sys_prefixrAZsys_exec_prefixrBabiflagsuserbaseZusersitezpost-expand_basedirs()baseplatbase)pprintz config vars:zpost-expand_dirs()librrrrrZlibbasezafter prepending rootbuildrTrUzWmust supply either prefix/exec-prefix/home or install-base/install-platbase -- not both)rTrT)rUrU)/rArBrCrDrEr r?osnamewarn dump_dirs finalize_unixfinalize_othersysversionsplitrraAttributeError distributionZget_nameZ get_versionZ get_fullname version_info config_vars HAS_USER_SITErMrNexpand_basedirsrreprint expand_dirscreate_home_pathrJZ ext_modulesrHrG convert_pathshandle_extra_pathinstall_libbasepathjoin extra_dirsrF change_rootsZset_undefined_options)rWr^rArBrarerXrXrYfinalize_optionss                           zinstall.finalize_optionscCstsdSddlm}tj|dx||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: %sr) rZdistutils.fancy_getoptrrdebug user_options negative_opt translategetattr)rWmsgrZoptZopt_namevalrXrXrYrkus         zinstall.dump_dirscCs"|jdk s|jdk r\|jdkr2|jdkr2|jdksP|jdksP|jdksP|jdkrXtddS|j r|j dkrtt d|j |_|_|j dn|j dk r|j |_|_|j dnl|jdkr|jdk rtdtjjtj|_tjjtj|_n|jdkr|j|_|j|_|j|_|j ddS)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)rWrXrXrYrls<             zinstall.finalize_unixc Cs|jr8|jdkrtd|j|_|_|jtjdn|jdk r\|j|_|_|jdn\|j dkrvtj j t j |_ |j |_|_y|jtjWn"t k rtdtjYnXdS)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?rMrrDrErrhrirCrAr}rrnKeyError)rWrXrXrYrms"    zinstall.finalize_othercCs@t|}x2tD]*}d|}t||dkrt||||qWdS)z=Sets the install directories by applying the install schemes.install_N)INSTALL_SCHEMES SCHEME_KEYSrsetattr)rWrischemekeyZattrnamerXrXrYrs  zinstall.select_schemecCs\xV|D]N}t||}|dk rtjdks0tjdkr|jD]2}|j|}x"|jD]}||kr&|j|q&WqW|jrl|jrl|jtjj|j |jd|S)z.Assembles the outputs of all the sub-commands.z.pth) rget_finalized_commandrappendrrQrhr}r~r|)rWrrcmdrrXrXrYrWs  zinstall.get_outputscCs2g}x(|jD]}|j|}|j|jqW|S)z*Returns the inputs of all the sub-commands)rrextend get_inputs)rWZinputsrrrXrXrYrhs  zinstall.get_inputscCs|jjp|jjS)zSReturns true if the current distribution has any Python modules to install.)rrZhas_pure_modulesZhas_ext_modules)rWrXrXrYhas_libts zinstall.has_libcCs |jjS)zLReturns true if the current distribution has any headers to install.)rr has_headers)rWrXrXrYrzszinstall.has_headerscCs |jjS)zMReturns true if the current distribution has any scripts to. install.)rr has_scripts)rWrXrXrYrszinstall.has_scriptscCs |jjS)zJReturns true if the current distribution has any data to. install.)rrZhas_data_files)rWrXrXrYhas_dataszinstall.has_datarJrIrKrLZinstall_egg_infocCsdS)NTrX)rWrXrXrYszinstall.)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 descriptionrZboolean_optionsrurrrrZrrkrlrmrrrvrxrzr{rryrrrrrrrrZ sub_commandsrXrXrXrYrIs   N(  " , r)rrrrr)__doc__rnrhZ distutilsrZdistutils.corerZdistutils.debugrZdistutils.sysconfigrZdistutils.errorsrZdistutils.file_utilrZdistutils.utilrr r r r Zsiter rruZWINDOWS_SCHEMErrrrXrXrXrYsV