a „oeÉuã @s¾dZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddlm Z ddl mZdd lmZmZmZdd lmZdd lmZmZd d lmZddlmZddlmZddlmZdZddddddœZddddddœddddddœeddddddœddddddœd œZ e�rJd!d!d"d#d$dœe d%<d!d!d&d'd$dœe d(<e  !ej"¡dZ#d)d*„Z$d+d,„Z%d-d.„Z&d/d0„Z'd1d2„Z(d3d4„Z)d5d6„Z*d7d8„Z+d9d:„Z,d;d<„Z-Gd=d>„d>e ƒZ.dS)?zFdistutils.command.install Implements the Distutils 'install' command.éN)Úlogé)ÚCommand)ÚDEBUG)Úget_config_vars)Ú write_file)Ú convert_pathÚ subst_varsÚ change_root)Ú get_platform)ÚDistutilsOptionErrorÚDistutilsPlatformErroré)Ú_framework_compat)Ú _collections)Ú USER_BASE)Ú USER_SITETz{base}/Lib/site-packagesz{base}/Include/{dist_name}z{base}/Scriptsz{base})ÚpurelibÚplatlibÚheadersÚscriptsÚdatazA{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_homeÚntÚpypyZpypy_ntz {usersite}zF{userbase}/{implementation}{py_version_nodot_plat}/Include/{dist_name}z:{userbase}/{implementation}{py_version_nodot_plat}/Scriptsz {userbase}Znt_userzQ{userbase}/include/{implementation_lower}{py_version_short}{abiflags}/{dist_name}z{userbase}/binÚ posix_usercCs@t t¡�"dd„t ¡DƒWdƒS1s20YdS)NcSsi|]}|tj|dd�“qS)F)Úexpand)Ú sysconfigZ get_paths©Ú.0Úscheme©r"úFC:\Program Files\Certbot\pkgs\setuptools\_distutils\command\install.pyÚ esÿz+_load_sysconfig_schemes..)Ú contextlibÚsuppressÚAttributeErrorrZget_scheme_namesr"r"r"r#Ú_load_sysconfig_schemescs þr(cs(tƒpi‰‡fdd„tt tˆ¡ƒDƒS)z= Extend default schemes with schemes from sysconfig. cs*i|]"}|it |i¡¥ˆ |i¡¥“qSr")ÚINSTALL_SCHEMESÚgetr©Zsysconfig_schemesr"r#r$rs ü ÿ þz!_load_schemes..)r(ÚsetÚ itertoolsÚchainr)r"r"r+r#Ú _load_schemesks  ûr/cCsttdƒrdSdSdS)NÚpypy_version_infoZPyPyÚPython)ÚhasattrÚsysr"r"r"r#Ú_get_implementation{s r4cCs.t|tt|ƒƒƒ}t|ƒ t|t|ƒƒ¡dS©N)Ú_inject_headersÚ _load_schemeÚ_resolve_schemeÚvarsÚupdateÚ _remove_setÚ _scheme_attrs)ÚobÚnamer!r"r"r#Ú_select_scheme‚sr?cs‡fdd„| ¡DƒS)z1 Include only attrs that are None in ob. cs$i|]\}}tˆ|ƒdur||“qSr5)Úgetattr)r ÚkeyÚvalue©r=r"r#r$‹óz_remove_set..)Úitems)r=Úattrsr"rCr#r;‡sr;cCsD| d¡\}}}zt |¡}Wn ty>t t|ƒ¡}Yn0|S)NÚ_)Ú partitionrZget_preferred_schemeÚ ExceptionÚfwr!Ú _pypy_hack)r>Zos_nameÚseprAZresolvedr"r"r#r8Žs  r8cCs tƒ|Sr5)r/)r>r"r"r#r7—sr7cCs tt|ƒƒ}| d|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)r7rKÚ setdefault)r>r!Úfallbackr"r"r#r6›s r6cs‡fdd„tDƒS)z.)Ú SCHEME_KEYSrPr"rPr#r<©sr<cCsFtjdk}ttdƒo|}| d¡ }ddtjdk}|rB|rB|S|S)N)éér0)Ú_userÚ_homerZ_ntr)r3Ú version_infor2ÚendswithÚosr>)r>ZPY37Zold_pypyÚprefixZ pypy_namer"r"r#rK®s   rKc@seZdZdZgd¢Zgd¢Zer>e dddef¡e d¡ddiZ d d „Z d d „Z d d„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3efd4efd5efd6efd7d8d9„fgZdS):Ú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ÚwarnÚ dump_dirsÚ finalize_unixÚfinalize_otherr3ÚversionÚsplitrr€r'Ú distributionZget_nameZ get_versionZ get_fullnamerVr@r4ÚlowerÚdictÚreplaceÚ HAS_USER_SITErnrorZ DictStackrJr9rÚ config_varsÚexpand_basedirsrr†ÚprintÚ expand_dirsÚcreate_home_pathrkÚhas_ext_modulesrirhÚ convert_pathsÚhandle_extra_pathÚinstall_libbaseÚpathÚjoinÚ extra_dirsrgÚ change_rootsZset_undefined_options)ryrrYrcr€Z local_varsZ compat_varsr†r"r"r#Úfinalize_optionsLsÌÿÿÿÿÿþýüûÿ          òþ  ÿ        ø ÿ ÿzinstall.finalize_optionscCs tsdSddlm}t |d¡|jD]r}|d}|ddkrL|dd…}||jvrx|j|}| |¡}t||ƒ }n| |¡}t||ƒ}t d||¡q(dS) zDumps the list of user options.Nr)Ú longopt_xlateú:réÿÿÿÿú=z %s: %s) rZ fancy_getoptr¡rÚdebugÚ user_optionsÚ negative_optÚ translater@)ryÚmsgr¡ÚoptZopt_nameÚvalr"r"r#r‰s         zinstall.dump_dirscCs<|jdus|jdur`|jdur2|jdur2|jdupN|jdupN|jdupN|jdu}|r\tdƒ‚dS|j r’|j durxt dƒ‚|j |_|_|  d¡n¦|j dur¶|j |_|_|  d¡n‚|jdu�r |jdurÔtdƒ‚ttddƒ}tj tj¡||_tj tj¡||_n|jdu�r|j|_|j|_|j|_|  d ¡dS) 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_additionr|r)rerfrkrhrirjrlrmr rbrnr Ú select_schemerdrYrcr@rrXrœÚnormpathr3)ryZincomplete_schemer­r"r"r#rŠsL ÿýûúø ÿ      ÿ  zinstall.finalize_unixcCsº|jr8|jdurtdƒ‚|j|_|_| tjd¡n~|jdur\|j|_|_| d¡nZ|j durvtj   t j ¡|_ |j |_|_z| tj¡Wn t y´tdtjƒ‚Yn0dS)z)Finalizes options for non-posix platformsNr¬rTrz)I don't know how to install stuff on '%s')rbrnr rerfr®rXr>rdrYrœr¯r3ÚKeyErrorrxr"r"r#r‹Fs"     ÿzinstall.finalize_othercCst||ƒdSr5)r?)ryr>r"r"r#r®\szinstall.select_schemecCsN|D]D}t||ƒ}|durtjdvr0tj |¡}t||jƒ}t|||ƒqdS)N)r{r)r@rXr>rœÚ expanduserr r“Úsetattr)ryrFÚattrr«r"r"r#Ú _expand_attrs_s    zinstall._expand_attrscCs| gd¢¡dS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.)rerfrgN©r´rxr"r"r#r”hszinstall.expand_basedirscCs| gd¢¡dS)z+Calls `os.path.expanduser` on install dirs.)rhrirkrjrlrmNrµrxr"r"r#r–msÿzinstall.expand_dirscGs,|D]"}d|}t||tt||ƒƒƒqdS)z!Call `convert_path` over `names`.rON)r²rr@©ryÚnamesr>r³r"r"r#r™zszinstall.convert_pathscCs¤|jdur|jj|_|jdurŒt d¡t|jtƒrB|j d¡|_t|jƒdkr`|jd}}n"t|jƒdkrz|j\}}ntdƒ‚t |ƒ}nd}d}||_ ||_ dS) 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|) rqrŽrZwarningÚ isinstanceÚstrr�Úlenr rÚ path_filerž)ryr¼ržr"r"r#rš€s(   ÿ  ÿ zinstall.handle_extra_pathc Gs0|D]&}d|}t||t|jt||ƒƒƒqdS)z:Change the install directories pointed by name using root.rON)r²r rgr@r¶r"r"r#rŸ£szinstall.change_rootscCsf|js dSttj d¡ƒ}|j ¡D]<\}}t|ƒ |¡r$tj  |¡s$|  d|¡t  |d¡q$dS)zCreate directories under ~.Nú~zos.makedirs('%s', 0o700)iÀ) rbrrXrœr±r“rErºÚ startswithÚisdirZ debug_printÚmakedirs)ryrdr>rœr"r"r#r—©szinstall.create_home_pathcCs"|js6| d¡|j d¡j}|jr6|tƒkr6tdƒ‚| ¡D]}| |¡q>|j r\|  ¡|j rº|  ¡}|j r t|j ƒ}tt|ƒƒD]}|||d…||<q†| t|j |fd|j ¡ttjjtjƒ}ttjj|ƒ}tj tj |j¡¡}|j�r|j �r|j�s||v�rt d|j¡dS)zRuns the command.r‡z"Can't install when cross-compilingNz'writing list of installed files to '%s'zƒmodules installed to '%s', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself)rsZ run_commandrŽZget_command_objZ plat_namertr r Úget_sub_commandsr¼Úcreate_path_filerwÚ get_outputsrgr»ÚrangeÚexecuterÚmaprXrœr¯r3Únormcaserkrrrr¥)ryZ build_platÚcmd_nameÚoutputsZroot_lenZcounterZsys_pathrkr"r"r#ÚrunµsF    ýÿþþýúz install.runcCsJtj |j|jd¡}|jr8| t||jgfd|¡n|  d|¡dS)zCreates the .pth fileú.pthz creating %szpath file '%s' not createdN) rXrœr�r›r¼rrrÅrržrˆ)ryÚfilenamer"r"r#rÂçs ÿ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Ë) rÁÚget_finalized_commandrÃÚappendr¼rrrXrœr�r›)ryrÉrÈÚcmdrÌr"r"r#rÃós    zinstall.get_outputscCs.g}| ¡D]}| |¡}| | ¡¡q |S)z*Returns the inputs of all the sub-commands)rÁrÍÚextendÚ get_inputs)ryZinputsrÈrÏr"r"r#rÑs   zinstall.get_inputscCs|j ¡p|j ¡S)zSReturns true if the current distribution has any Python modules to install.)rŽZhas_pure_modulesr˜rxr"r"r#Úhas_libsÿzinstall.has_libcCs |j ¡S)zLReturns true if the current distribution has any headers to install.)rŽÚ has_headersrxr"r"r#rÓszinstall.has_headerscCs |j ¡S)zMReturns true if the current distribution has any scripts to. install.)rŽÚ has_scriptsrxr"r"r#rÔszinstall.has_scriptscCs |j ¡S)zJReturns true if the current distribution has any data to. install.)rŽZhas_data_filesrxr"r"r#Úhas_data szinstall.has_datarkrjrlrmZinstall_egg_infocCsdS)NTr"rxr"r"r#Ú,rDzinstall.) Ú__name__Ú __module__Ú __qualname__Ú descriptionr¦Zboolean_optionsr’rÎrr§rzr r‰rŠr‹r®r´r”r–r™ršrŸr—rÊrÂrÃrÑrÒrÓrÔrÕZ sub_commandsr"r"r"r#rZ¶sJ< ÿ M61  # 2   ûrZ)/Ú__doc__r3rXr%rr-Zdistutils._logrZcorerr¥rrZ file_utilrÚutilrr r r Úerrorsr r r|rrJrZsiterrr’ZWINDOWS_SCHEMEr)r:ZschemesrQr(r/r4r?r;r8r7r6r<rKrZr"r"r"r#Ús˜          û ù ûûûç#ú ú