a „oe®Qã@sàdZddlmZddlmZddlmZmZddlmZmZm Z m Z ddl m Z m Z ddlmZddlmZdd lmZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd l Z dd l!Z!dd l"Z"dd l#Z#dd l$Z$dd l%Z%dd l&Z&dd l&m'Z'dd l(m)Z)dd l*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1m2Z2m3Z3ddl,m4Z4m5Z5ddl6m7Z7m8Z8ddl9m:Z:ddl;mZ>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHdd l;Z;ddlImJZJddlKmLZLddlMmNZNejOde;jPd�gd¢ZQdd„ZRdd„ZSd d!„ZTd"d#„ZUGd$d%„d%e)ƒZVd&d'„ZWd(d)„ZXd*d+„ZYd,d-„ZZd.d/„Z[Gd0d1„d1e@ƒZ\Gd2d3„d3e\ƒZ]ej^ _d4d5¡d6k�rœe]Z\d7d8„Z`d9d:„Zad;d<„Zbd=d>„Zcdmd?d@„ZddAdB„ZedCdD„ZfdEejgv�rèefZhndFdG„ZhdndIdJ„ZidKdL„ZjdMdN„ZkdOdP„ZlzddQlmmZnWneo�y>dRdS„ZnYn0dTdU„ZmGdVdW„dWepƒZqeq r¡ZsGdXdY„dYeqƒZtGdZd[„d[ƒZuGd\d]„d]euƒZvGd^d_„d_evƒZwd`da„Zxdbdc„Zyddeafdedf„Zzdgdh„Z{didj„Z|Gdkdl„dle7ƒZ}d S)oa) Easy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ https://setuptools.pypa.io/en/latest/deprecated/easy_install.html é)Úglob)Ú get_platform)Ú convert_pathÚ subst_vars)ÚDistutilsArgErrorÚDistutilsOptionErrorÚDistutilsErrorÚDistutilsPlatformError)ÚlogÚdir_util)Ú first_line_re)Úfind_executable)ÚinstallN)Úget_path)ÚCommand)Ú run_setup)Úsetopt)Úunpack_archive)Ú PackageIndexÚparse_requirement_argÚ URL_SCHEME)Ú bdist_eggÚegg_info)ÚSetuptoolsDeprecationWarningÚSetuptoolsWarning)ÚWheel) Únormalize_pathÚresource_stringÚget_distributionÚfind_distributionsÚ EnvironmentÚ RequirementÚ DistributionÚ PathMetadataÚ EggMetadataÚ WorkingSetÚDistributionNotFoundÚVersionConflictÚ DEVELOP_DISTé)Ú py312compat)Úensure_directory)Ú yield_linesÚdefault)Úcategory)Ú easy_installÚPthDistributionsÚextract_wininst_cfgÚget_exe_prefixescCst d¡dkS)NÚPé)ÚstructÚcalcsize©r7r7ú@C:\Program Files\Certbot\pkgs\setuptools\command\easy_install.pyÚis_64bit]sr9cCs | d¡S)NÚutf8)Úencode©Úsr7r7r8Ú _to_bytesasr>cCs*z| d¡WdSty$YdS0dS)NÚasciiTF)r;Ú UnicodeErrorr<r7r7r8Úisasciies   rAcCst |¡ ¡ dd¡S)NÚ z; )ÚtextwrapÚdedentÚstripÚreplace)Útextr7r7r8Ú _one_linermsrHc@s�eZdZdZdZdZdddddd d d d d ddddddddddddddejfgZgd¢Z ddiZ e Z dd „Z d!d"„Zd#d$„Zed%d&„ƒZd'd(„Zed)d*„ƒZed+d,„ƒZd-d.„Zd/d0„Zd1d2„Zd3d4„Zd’d5d6„Zd7d8„Zd9d:„Zd;d<„Ze d=¡ ¡Z e d>¡ ¡Z!e d?¡ ¡Z"d@dA„Z#dBdC„Z$dDdE„Z%dFdG„Z&dHdI„Z'dJdK„Z(e)j*dLdM„ƒZ+d“dOdP„Z,d”dQdR„Z-dSdT„Z.d•dUdV„Z/dWdX„Z0dYdZ„Z1d[d\„Z2d–d]d^„Z3ed_d`„ƒZ4d—dcdd„Z5dedf„Z6dgdh„Z7didj„Z8dkdl„Z9dmdn„Z:dodp„Z;e dq¡ ¡Ze dv¡ ¡Z?dwdx„Z@dydz„ZAd{d|„ZBd}d~„ZCdd€„ZDd�d‚„ZEdƒd„„ZFd…d†„ZGe d‡¡ H¡ZIdˆd‰„ZJeKeKdŠd‹dŒ�d��ZLeKdŽd�dŒ�ZMd�d‘„ZNdS)™r/z'Manage a download/build/install processz Find/get/install Python packagesT)zprefix=Nzinstallation prefix)úzip-okÚzzinstall package as a zipfile)ú multi-versionÚmz%make apps have to require() a version)ÚupgradeÚUz1force upgrade (searches PyPI for latest versions))z install-dir=Údzinstall package to DIR)z script-dir=r=zinstall scripts to DIR)úexclude-scriptsÚxzDon't install scripts)ú always-copyÚaz'Copy all needed packages to install dir)z index-url=Úiz base URL of Python Package Index)z find-links=Úfz(additional URL(s) to search for packages)zbuild-directory=Úbz/download/extract/build in DIR; keep the results)z optimize=ÚOzlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0])zrecord=Nz3filename in which to record list of installed files)ú always-unzipÚZz*don't install as a zipfile, no matter what)z site-dirs=ÚSz)list of directories where .pth files work)ÚeditableÚez+Install specified packages in editable form)úno-depsÚNzdon't install dependencies)z allow-hosts=ÚHz$pattern(s) that hostnames must match)úlocal-snapshots-okÚlz(allow building eggs from local checkouts)ÚversionNz"print version information and exit)z no-find-linksNz9Don't load find-links defined in packages being installedÚuserNz!install in user site-package '%s') rIrKrPrMrRr[r]r`rbrcrXrIcCst ¡d|_d|_|_d|_|_|_d|_d|_ d|_ d|_ d|_ |_ d|_|_|_d|_|_|_d|_|_|_d|_d|_d|_d|_d|_d|_d|_d|_d|_t j!|_"t j#|_$d|_%d|_&d|_'|_(d|_)i|_*d|_+|j,j-|_-|j, .||j, /d¡¡dS)Nrr/)0ÚEasyInstallDeprecationWarningÚemitrcÚzip_okÚlocal_snapshots_okÚ install_dirÚ script_dirÚexclude_scriptsÚ index_urlÚ find_linksÚbuild_directoryÚargsÚoptimizeÚrecordrMÚ always_copyÚ multi_versionr[Úno_depsÚ allow_hostsÚrootÚprefixÚ no_reportrbÚinstall_purelibÚinstall_platlibÚinstall_headersÚ install_libÚinstall_scriptsÚ install_dataÚ install_baseÚinstall_platbaseÚsiteÚ USER_BASEÚinstall_userbaseÚ USER_SITEÚinstall_usersiteÚ no_find_linksÚ package_indexÚpth_fileÚalways_copy_fromÚ site_dirsÚinstalled_projectsZ_dry_runÚ distributionÚverboseZ_set_command_optionsÚget_option_dict©Úselfr7r7r8Úinitialize_options¨sB     ÿzeasy_install.initialize_optionscCs"dd„|Dƒ}tt|j|ƒƒdS)Ncss*|]"}tj |¡stj |¡r|VqdS©N)ÚosÚpathÚexistsÚislink)Ú.0Úfilenamer7r7r8Ú Ösþz/easy_install.delete_blockers..)ÚlistÚmapÚ _delete_path)r�ÚblockersZextant_blockersr7r7r8Údelete_blockersÕsþzeasy_install.delete_blockerscCsJt d|¡|jrdStj |¡o.tj |¡ }|r8tntj}||ƒdS)Nz Deleting %s) r ÚinfoÚdry_runr’r“Úisdirr•Ú_rmtreeÚunlink)r�r“Zis_treeZremoverr7r7r8r›Ýs  zeasy_install._delete_pathcCs8djtjŽ}tdƒ}d}t|jfitƒ¤Žƒtƒ‚dS)zT Render the Setuptools version and installation details, then exit. ú{}.{}Ú setuptoolsz=setuptools {dist.version} from {dist.location} (Python {ver})N)ÚformatÚsysÚ version_inforÚprintÚlocalsÚ SystemExit)ZverÚdistÚtmplr7r7r8Ú_render_versionæs  zeasy_install._render_versioncCsX|jo | ¡tj ¡d}tt ¡ƒ|_|j |j   ¡|j   ¡|j   ¡|tj j›dtj j›�tj j›tj j›�|jd|jdttddƒttddƒd œ ¡t t¡�.|j t ¡ ¡t ¡d œ¡Wdƒn1sÚ0Y|j d ttd dƒ dd¡¡|j|jd <|j|jd<|j�r4tj�s4t d¡|  ¡| !¡| "¡| #dddd¡|j$du�rp|j%|_$|j&du�r‚d|_&| 'dd¡| 'dd¡|j�rº|j(�rº|j(|_%|j)|_$| 'dd¡t*ƒ|_+|j+ ,| -|j.¡¡|j/�sò| 0¡t1 2dd¡}|j3�p||_3|j+dd…|_4|j%t5|j$ƒfD] }||j4v�r,|j4 6d|¡�q,|j7du�rrdd„|j7 d¡Dƒ}nd g}|j8du�rš|j9|j3|j4|d!�|_8t:|j4tj;ƒ|_<|j=du�rÔt>|j=t?ƒ�rÚ|j= ¡|_=ng|_=|j@�rö|j8 A|j4tj;¡|j&�s |j8 B|j=¡| 'dd"¡| C|jD¡|_D|j/�r>|jE�s>tFd#ƒ‚|jG�sNtFd$ƒ‚g|_HdS)%NrÚ.rvÚ exec_prefixÚabiflagsÚÚ platlibdirÚlib) Z dist_nameZ dist_versionZ dist_fullnameÚ py_versionZpy_version_shortZpy_version_nodotZ sys_prefixZsys_exec_prefixr°r²)Zimplementation_lowerÚimplementationZpy_version_nodot_platZwindirÚuserbaseZusersitez6WARNING: The user site-packages directory is disabled.rhrirmr‰Fr{)rhrhr|©rhrir)rprpZ__EASYINSTALL_INDEXzhttps://pypi.org/simple/cSsg|] }| ¡‘qSr7)rE©r–r=r7r7r8Ú Józ1easy_install.finalize_options..ú,Ú*)Ú search_pathÚhosts)roroz9Must specify a build directory (-b) when using --editablez:No urls, filenames, or requirements specified (see --help))Irbr­r¦ÚsplitÚdictÚ sysconfigZget_config_varsÚ config_varsÚupdater‹Zget_nameZ get_versionZ get_fullnamer§ÚmajorÚminorÚgetattrÚ contextlibÚsuppressÚAttributeErrorrZ_get_implementationÚlowerÚ setdefaultrFr‚r„rcr€ÚENABLE_USER_SITEr ÚwarnÚ_fix_install_dir_for_user_siteÚexpand_basedirsÚ expand_dirsÚ_expandrirhr…Zset_undefined_optionsrxr|Ú get_site_dirsÚ all_site_dirsÚextendÚ_process_site_dirsr‰r[Úcheck_site_dirr’ÚgetenvrkÚ shadow_pathrÚinsertrtr†Ú create_indexr r“Ú local_indexrlÚ isinstanceÚstrrgZscan_egg_linksÚadd_find_linksÚ_validate_optimizerormrrnÚoutputs)r�r´Z default_indexÚ path_itemr¾r7r7r8Úfinalize_optionsñs°  óÿ  þÿ"þ   ü         ý  ÿÿzeasy_install.finalize_optionsccsx|dur dStttjƒ}dd„| d¡Dƒ}|D]B}tj |¡sNt d|¡q0t|ƒ|vrht |dƒ‚q0t|ƒVq0dS)NcSsg|]}tj | ¡¡‘qSr7)r’r“Ú expanduserrEr¸r7r7r8r¹rrºz3easy_install._process_site_dirs..r»z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.path) ršrr¦r“r¿r’r r rÍr)r‰ÚnormpathrOr7r7r8rÕls   zeasy_install._process_site_dirsc CsPzt|ƒ}|tdƒvrt‚Wn.tyJ}ztdƒ|‚WYd}~n d}~00|S)Néz--optimize must be 0, 1, or 2)ÚintÚrangeÚ ValueErrorr)Úvaluer\r7r7r8rß{s  zeasy_install._validate_optimizecCsP|js dS| ¡|jdur(d}t|ƒ‚|j|_|_tj›d�}| |¡dS)z; Fix the install_dir if "--user" was used. Nz$User base directory is not specifiedÚ_user) rcÚcreate_home_pathr‚r r~rr’ÚnameÚ select_scheme)r�ÚmsgZ scheme_namer7r7r8rΆs  z+easy_install._fix_install_dir_for_user_sitecCsX|D]N}t||ƒ}|durtjdks.tjdkr:tj |¡}t||jƒ}t|||ƒqdS)NÚposixÚnt)rÆr’rìr“rãrrÂÚsetattr)r�ÚattrsÚattrÚvalr7r7r8Ú _expand_attrs•s   zeasy_install._expand_attrscCs| gd¢¡dS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.)r~rruN©rõrŽr7r7r8rÏžszeasy_install.expand_basedirscCsgd¢}| |¡dS)z+Calls `os.path.expanduser` on install dirs.)rxryr{rzr|r}Nrö)r�Údirsr7r7r8rУszeasy_install.expand_dirsc Csâ|r| dtj¡|j|jjkr,t |j¡z |jD]}| ||j ¡q4|j r´|j }|j rŒt |j ƒ}t t |ƒƒD]}|||d…||<qrddlm}| |j|j |fd|j ¡| ¡Wt |jj¡nt |jj¡0dS)NzXWARNING: The easy_install command is deprecated and will be removed in a future version.r)Ú file_utilz'writing list of installed files to '%s')Zannouncer ZWARNrŒr‹Ú set_verbosityrnr/rsrpràruÚlenrçÚ distutilsrøÚexecuteZ write_fileÚwarn_deprecated_options)r�Zshow_deprecationÚspecràZroot_lenZcounterrør7r7r8Úrun¯s0ý    ý zeasy_install.runcCsBz t ¡}Wn ty,t dtj¡}Yn0tj |j d|¡S)zÈReturn a pseudo-tempname base in the install directory. This code is intentionally naive; if a malicious party can write to the target directory you're already in deep doodoo. rztest-easy-install-%s) r’ÚgetpidÚ ExceptionÚrandomZrandintr¦Úmaxsizer“Újoinrh)r�Zpidr7r7r8Úpseudo_tempnameÌs   zeasy_install.pseudo_tempnamecCsdSr‘r7rŽr7r7r8rý×sz$easy_install.warn_deprecated_optionscCsBt|jƒ}tj |d¡}tj |¡sNzt |¡WntyL| ¡Yn0||j v}|sl|j sl|  ¡}n^|  ¡d}tj |¡}z*|r”t  |¡t|dƒ ¡t  |¡WntyÈ| ¡Yn0|sô|j sôtj dd¡}t |j|j|¡|�r|jdu�rt||j ƒ|_nd|_|j �r8tj |¡�s8d|_||_dS)z;Verify that self.install_dir is .pth-capable dir, if neededúeasy-install.pthz .write-testÚwÚ PYTHONPATHr±N)rrhr’r“rr”ÚmakedirsÚOSErrorÚcant_write_to_targetrÓrrÚcheck_pth_processingrr¢ÚopenÚcloseÚenvironÚgetr rÍÚ_easy_install__no_default_msgr‡r0)r�Úinstdirr‡Z is_site_dirZtestfileZ test_existsZ pythonpathr7r7r8rÖÚs:            zeasy_install.check_site_diraS can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: %s The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s zÀ This directory does not currently exist. Please create it and try again, or choose a different installation directory (using the -d or --install-dir option). a¯ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://setuptools.pypa.io/en/latest/deprecated/easy_install.html Please make the appropriate changes for your system and try again. cCsP|jt ¡d|jf}tj |j¡s6|d|j7}n|d|j7}t |ƒ‚dS)NérB) Ú_easy_install__cant_write_msgr¦Úexc_inforhr’r“r”Ú_easy_install__not_exists_idÚ_easy_install__access_msgr)r�rîr7r7r8r 1s þz!easy_install.cant_write_to_targetc Cs$|j}t d|¡| ¡d}|d}tj |¡}tdƒd}z6|rNt |¡tj  |¡}tj |dd�t |dƒ}Wnt y�|  ¡Y�n|0�z6| |jfitƒ¤Ž¡| ¡d }tj}tjd k�rtj |¡\}} tj |d ¡} |  ¡d k�otj | ¡} | �r| }d dlm} | |dddgd ƒtj |¡�rŠt d|¡W|�rV| ¡tj |¡�rnt |¡tj |¡�r†t |¡dSW|�rš| ¡tj |¡�r²t |¡tj |¡�r t |¡n@|�rÚ| ¡tj |¡�ròt |¡tj |¡�r t |¡0|j�s t d|¡dS)z@Empirically verify whether .pth files are supported in inst. dirz Checking .pth file support in %sú.pthz.okzz import os f = open({ok_file!r}, 'w') f.write('OK') f.close() rBT)Úexist_okrNrðú pythonw.exeú python.exer)Úspawnz-Ez-cÚpassz-TEST PASSED: %s appears to support .pth filesz+TEST FAILED: %s does NOT support .pth filesF)rhr ržrr’r“r”rHr¢Údirnamer r r r Úwriter¥r©rr¦Ú executablerìr¿rrÊÚdistutils.spawnrrrrÍ) r�rr‡Zok_fileZ ok_existsr¬rrUr ÚbasenameZaltZuse_altrr7r7r8r =sr   ÿøÿ         ù  û   z!easy_install.check_pth_processingc CsV|jsH| d¡rH| d¡D],}| d|¡r.q| ||| d|¡¡q| |¡dS)z=Write all the scripts for `dist`, unless scripts are excludedÚscriptszscripts/N)rjZmetadata_isdirZmetadata_listdirÚinstall_scriptZ get_metadataÚinstall_wrapper_scripts)r�r«Ú script_namer7r7r8Úinstall_egg_scriptswsÿz easy_install.install_egg_scriptscCsTtj |¡rDt |¡D]*\}}}|D]}|j tj ||¡¡q$qn |j |¡dSr‘)r’r“r ÚwalkràÚappendr)r�r“Úbaser÷Úfilesr—r7r7r8Ú add_output„s  zeasy_install.add_outputcCs|jrtd|fƒ‚dS)NzjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).)r[r©r�rþr7r7r8Ú not_editableŒs ÿÿzeasy_install.not_editablecCs<|js dStj tj |j|j¡¡r8td|j|jfƒ‚dS)Nz2%r already exists in %s; can't do a checkout there)r[r’r“r”rrmÚkeyrr-r7r7r8Úcheck_editable“s ÿÿzeasy_install.check_editablec csJtjdd�}z"t|ƒVWtj |¡o,t|ƒntj |¡oBt|ƒ0dS)Nz easy_install-)rv)ÚtempfileÚmkdtemprÝr’r“r”r¡)r�Útmpdirr7r7r8Ú_tmpdir�s  zeasy_install._tmpdirFc CsX| ¡��8}t|tƒs”t|ƒrV| |¡|j ||¡}| d|||d¡WdƒStj   |¡rŒ| |¡| d|||d¡WdƒSt |ƒ}|  |¡|j  |||j|j|j |j¡}|duræd|}|jrÜ|d7}t|ƒ‚nN|jtk�r| |||d¡|WdƒS| ||j||¡WdƒSWdƒn1�sJ0YdS)NTz+Could not find suitable distribution for %rz2 (--always-copy skips system and development eggs)ÚUsing)r4rÜr!rr.r†ÚdownloadÚ install_itemr’r“r”rr0Zfetch_distributionrMr[rqrÛrZ precedencer(Úprocess_distributionÚlocation)r�rþÚdepsr3Údlr«rîr7r7r8r/¦s8        ú  zeasy_install.easy_installcCs |p|j}|ptj |¡|k}|p,| d¡ }|pT|jduoTtj t|ƒ¡t|jƒk}|r‚|s‚|j|jD]}|j |krjq‚qjd}t   dtj  |¡¡|rÂ|  |||¡}|D]}| |||¡q¬n | |¡g}| ||d|d¡|du�r|D]}||vrð|SqðdS)Nú.eggTz Processing %srr5)rqr’r“rÚendswithrˆrrÛÚ project_namer9r ržr"Ú install_eggsr8Úegg_distribution)r�rþr6r3r:Zinstall_neededr«Zdistsr7r7r8r7Ës2  ÿþ   zeasy_install.install_itemc Cs>zt ||¡Wn(ty8tj || dd¡¡Yn0dS)NrïZunix)rZ_select_schemerÉrírF)r�rìr7r7r8ríîs zeasy_install.select_schemec Gs¾| |¡|j |¡||j|jvr2|j |¡|j |¡| |¡||j|j<t  |j ||g|¢RŽ¡|  d¡r�|j s�|j  | d¡¡|sž|jsždS|durÂ|j|jkrÂt d|¡dS|dusÒ||vræ| ¡}tt|ƒƒ}t  d|¡ztgƒ |g|j|j¡}Wnft�yB}ztt|ƒƒ|‚WYd}~n)r�r«r&Ú script_textÚdev_pathrþZ is_scriptÚbodyr7r7r8r$Fs   zeasy_install.install_scriptcCs(d}|r| dd¡}td|ƒ}| d¡S)z‰ There are a couple of template scripts in the package. This function loads one of them and prepares it for use. z script.tmplz.tmplz (dev).tmplr¤úutf-8)rFrÚdecode)r[rìZ raw_bytesr7r7r8rXPs   zeasy_install._load_templateÚtr7csºˆ ‡fdd„|Dƒ¡t d|ˆj¡tj ˆj|¡}ˆ |¡ˆjrLdSt ƒ}t |ƒtj  |¡rpt  |¡t |d|ƒ�}| |¡Wdƒn1sž0Yt|d|ƒdS)z1Write an executable file to the scripts directorycsg|]}tj ˆj|¡‘qSr7)r’r“rri©r–rQrŽr7r8r¹brºz-easy_install.write_script..zInstalling %s script to %sNriÿ)r�r ržrir’r“rr,rŸÚ current_umaskr+r”r¢r rÚchmod)r�r&rQÚmoderœÚtargetÚmaskrUr7rŽr8rV_sÿ   (zeasy_install.write_scriptc CsR|j|j|jdœ}z|| ¡dd…}Wnty<Yn0|||ƒgS|}tj |¡rt| d¡stt |||j ƒntj  |¡rŒtj  |¡}|  |¡r²|jr²|dur²| |||¡}tj |d¡}tj |¡�s$ttj |dd¡ƒ}|sútdtj  |¡ƒ‚t|ƒdk�rtdtj  |¡ƒ‚|d }|j�rBt | ||¡¡gS| ||¡SdS) N)r<ú.exez.whléüÿÿÿú.pyzsetup.pyr¼z"Couldn't find a setup script in %srzMultiple setup scripts in %sr)Ú install_eggÚ install_exeÚ install_wheelrÊÚKeyErrorr’r“Úisfiler=rÚunpack_progressr ÚabspathÚ startswithrmrRrr”rrrúr[r ržÚreport_editableÚbuild_and_install) r�rþrNr3Z installer_mapZ install_distrOÚ setup_scriptZsetupsr7r7r8r?ssNý    ÿþý ÿÿÿzeasy_install.install_eggscCs>tj |¡r"t|tj |d¡ƒ}ntt |¡ƒ}tj ||d�S)NúEGG-INFO)Úmetadata) r’r“r r#rr$Ú zipimportÚ zipimporterr"Z from_filename)r�Úegg_pathrur7r7r8r@¦s zeasy_install.egg_distributionc Csžtj |jtj |¡¡}tj |¡}|js2t|ƒ| |¡}tj  |¡rXtj  ||¡�sŠtj  |¡r‚tj  |¡s‚t j||jd�n"tj  |¡r¤| tj|fd|¡zÂd}tj  |¡rÜ| |¡rÎtjd}}n tjd}}nN| |¡�r| |¡|jd}}n*d}| |¡�rtjd}}n tjd}}| |||f|dtj |¡tj |¡f¡t||d �Wn"t�yˆt|dd �‚Yn0| |¡| |¡S) N©rŸú Removing FZMovingZCopyingZ ExtractingTz %s to %s©Úfix_zipimporter_caches)r’r“rrhr"rorŸr+r@r”Úsamefiler r•r Ú remove_treerür¢rprLrMÚcopytreerJZmkpathÚunpack_and_compileÚcopy2rÚupdate_dist_cachesrr,)r�rxr3Ú destinationr«Znew_dist_is_zippedrUrLr7r7r8ri®sb þ   ÿ ÿ ý      ÿýþ   zeasy_install.install_eggc sPt|ƒ}|durtd|ƒ‚td| dd¡| dd¡tƒd�}tj || ¡d¡}||_ |d}tj |d¡}tj |d ¡}t |ƒt ||ƒ|_ |  ||¡tj |¡�st|d ƒ} |  d ¡| d¡D].\} } | d krÊ|  d |  dd¡ ¡| f¡qÊ|  ¡tj |d¡‰| ‡fdd„t |¡Dƒ¡tj|||j|jd�| ||¡S)Nz(%s is not a valid distutils Windows .exerurìrb)r>rbÚplatformr<z.tmprtúPKG-INFOrzMetadata-Version: 1.0 Útarget_versionz%s: %s Ú_ú-r#csg|]}tj ˆ|d¡‘qS)r)r’r“r)r–rn©rir7r8r¹rºz,easy_install.install_exe..)rŒrŸ)r1rr"rrr’r“rÚegg_namer9r+r#Z _providerÚ exe_to_eggr”r rÚitemsrFÚtitlerr�rSrUrZ make_zipfilerŒrŸri) r�rNr3Úcfgr«rxÚegg_tmpZ _egg_infoZpkg_infrUÚkÚvr7r‰r8rjäsJÿ  ü     ÿüzeasy_install.install_exec s8t|ƒ‰g‰g‰i‰‡‡‡‡‡fdd„}t|ˆ|ƒg}ˆD]n}| ¡ d¡r<| d¡}|d}t |d¡d|d<tjj ˆg|¢RŽ}ˆ  |¡|  |¡t  ||¡q<|  ˆ¡t  tj  ˆd¡t ˆ|¡¡dD]Z} tƒ| rØtj  ˆd| d ¡} tj | ¡sØt| d ƒ} |  d   tƒ| ¡d ¡|  ¡qØd S) z;Extract a bdist_wininst to the directories an egg would usecsú| ¡}ˆD]Ò\}}| |¡r ||t|ƒd…}| d¡}tjjˆg|¢RŽ}| ¡}| d¡sl| d¡r¢t  |d¡|d<dˆtj  |d¡d<ˆ  |¡n4| d¡rÖ|dkrÖdˆtj  |d¡d<ˆ  |¡|Sq | d ¡söt   d |¡dS) Nú/ú.pydú.dlléÿÿÿÿrrrhúSCRIPTS/rzWARNING: can't process %s)rÊrprúr¿r’r“rr=rÚ strip_moduleÚsplitextr)r rÍ)ÚsrcrPr=ÚoldÚnewÚpartsr;©r�Ú native_libsÚprefixesÚ to_compileÚ top_levelr7r8Úprocesss$        z(easy_install.exe_to_egg..processr“r’r•rhrt)r¡ržz.txtrrBN)r2rrÊr=r¿rr—r’r“rr)Z write_stubÚ byte_compileZwrite_safety_flagZ analyze_eggr©r”r rr) r�rNr�r¢ZstubsÚresrœÚresourceZpyfilerìZtxtrUr7r�r8r‹s6     ÿ   zeasy_install.exe_to_eggc Csìt|ƒ}| ¡sJ‚tj |j| ¡¡}tj |¡}|jsBt |ƒtj  |¡rltj  |¡slt j ||jd�n"tj |¡rŽ| tj|fd|¡z:| |j|fdtj |¡tj |¡f¡Wt|dd�nt|dd�0| |¡| |¡S)NryrzzInstalling %s to %sFr{)rZ is_compatibler’r“rrhrŠrorŸr+r r•r r~r”rür¢Zinstall_as_eggr"rr‚r,r@)r�Z wheel_pathr3Zwheelrƒr7r7r8rkJs2   ýÿý zeasy_install.install_wheela( Because this distribution was installed --multi-version, before you can import modules from this package in an application, you will need to 'import pkg_resources' and then use a 'require()' call similar to one of these examples, in order to select the desired version: pkg_resources.require("%(name)s") # latest installed version pkg_resources.require("%(name)s==%(version)s") # this exact version pkg_resources.require("%(name)s>=%(version)s") # this version or higher zõ Note also that the installation directory must be on sys.path at runtime for this to work. (e.g. by being the application's script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) Ú Installedc Cs^d}|jr>|js>|d|j7}|jtttjƒvr>|d|j7}|j }|j }|j }d}|t ƒS)z9Helpful installation message for display to package usersz %(what)s %(eggloc)s%(extras)srBr±) rrrwÚ_easy_install__mv_warningrhršrr¦r“Ú_easy_install__id_warningr9r>rbr©) r�Zreqr«ZwhatrîZegglocrìrbÚextrasr7r7r8rDzs z easy_install.installation_reportaR Extracted editable version of %(spec)s to %(dirname)s If it uses setuptools in its setup script, you can activate it in "development" mode by going to that directory and running:: %(python)s setup.py develop See the setuptools documentation for the "develop" command for more info. cCs"tj |¡}tj}d|jtƒS)NrB)r’r“rr¦r Ú_easy_install__editable_msgr©)r�rþrsrÚpythonr7r7r8rq•s zeasy_install.report_editablec Csètj dt¡tj dt¡t|ƒ}|jdkrNd|jd}| dd|¡n|jdkrd| dd¡|jrv| dd ¡t   d |t |ƒdd…d   |¡¡zt ||ƒWn:tyâ}z"td |jdfƒ|‚WYd}~n d}~00dS) Nzdistutils.command.bdist_eggzdistutils.command.egg_infor)r‘rrrˆz-qz-nz Running %s %sú zSetup script exited with %s)r¦ÚmodulesrËrrr™rŒrÙrŸr ržrúrrrªrrn)r�rsrOrnr‘r7r7r8ršs    $zeasy_install.run_setupc CsÎddg}tjdtj |¡d�}z”| tj |¡¡| |¡| |||¡t|gƒ}g}|D]&}||D]}| |  |j |¡¡qhq\|sš|j sšt   d|¡|Wt|ƒt  |j¡St|ƒt  |j¡0dS)Nrz --dist-dirz egg-dist-tmp-)rvÚdirz+No eggs found in %s (setup script problem?))r1r2r’r“rÚ_set_fetcher_optionsr)rr rir9rŸr rÍr¡rùrŒ) r�rsrOrnZdist_dirZall_eggsZeggsr/r«r7r7r8rr¬s. ÿ      ýÿzeasy_install.build_and_installc Csh|j d¡ ¡}d}i}| ¡D]\}}||vr2q |d||<q t|d�}tj |d¡}t  ||¡dS)a When easy_install is about to run bdist_egg on a source dist, that source dist might have 'setup_requires' directives, requiring additional fetching. Ensure the fetcher options given to easy_install are available to that command as well. r/)rlr‰rkrortr)r/z setup.cfgN) r‹r�ÚcopyrŒrÀr’r“rrZ edit_config) r�r*Zei_optsZfetch_directivesZ fetch_optionsr/rôZsettingsZ cfg_filenamer7r7r8r¯Ãs  z!easy_install._set_fetcher_optionscCsL|jdurdS|j|jD]J}|js2|j|jkr2qt d|¡|j |¡|j|jvr|j |j¡q|jsº|j|jjvrˆt d|¡n2t d|¡|j  |¡|j|jvrº|j  |j¡|j rÄdS|j  ¡|jdkrÜdSt j |jd¡}t j |¡�rt  |¡t|dƒ�(}| |j |j¡d¡Wdƒn1�s>0YdS)Nz&Removing %s from easy-install.pth filez4%s is already the active version in easy-install.pthz"Adding %s to easy-install.pth filer¤úsetuptools.pthÚwtrB)r‡r/rrr9r ržrCrØÚpathsrBr)rŸÚsaver’r“rrhr•r¢r rÚ make_relative)r�r«rOr—rUr7r7r8rAÞs:    þ       zeasy_install.update_pthcCst d||¡|S)NzUnpacking %s to %s)r Údebug)r�r™rPr7r7r8rnszeasy_install.unpack_progresscsdg‰g‰‡‡‡fdd„}t|||ƒˆ ˆ¡ˆjs`ˆD]&}t |¡tjdBd@}t||ƒq8dS)NcsZ| d¡r | d¡s ˆ |¡n| d¡s4| d¡r>ˆ |¡ˆ ||¡ˆj rV|pXdS)Nrhú EGG-INFO/r”z.so)r=rpr)rnrŸ)r™rP©r�Zto_chmodr r7r8Úpfs    z+easy_install.unpack_and_compile..pfimií)rr£rŸr’ÚstatÚST_MODErb)r�rxrƒr¹rUrcr7r¸r8r€ s  zeasy_install.unpack_and_compilec Csvtjr dSddlm}zLt |jd¡||dd|jd�|jrT|||jd|jd�Wt |j¡nt |j¡0dS)Nr)r£r)roÚforcerŸ) r¦Údont_write_bytecodeÚdistutils.utilr£r rùrŒrŸro)r�r r£r7r7r8r£s üzeasy_install.byte_compilea� bad install directory or PYTHONPATH You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s and your PYTHONPATH environment variable currently contains: %r Here are some of your options for correcting the problem: * You can choose a different installation directory, i.e., one that is on PYTHONPATH or supports .pth files * You can add the installation directory to the PYTHONPATH environment variable. (It must then also be on PYTHONPATH whenever you run Python and want to use the package(s) you are installing.) * You can set up the installation directory to support ".pth" files by using one of the approaches described here: https://setuptools.pypa.io/en/latest/deprecated/easy_install.html#custom-installation-locations Please make the appropriate changes for your system and try again. cCsb|js dSttj d¡ƒ}t|j ¡ƒD]4}| |¡r(tj  |¡s(|  d|¡t  |d¡q(dS)zCreate directories under ~.Nú~zos.makedirs('%s', 0o700)iÀ) rcrr’r“rãÚ only_strsrÂÚvaluesrpr Z debug_printr )r�Úhomer“r7r7r8rëVszeasy_install.create_home_pathz/$base/lib/python$py_version_short/site-packagesz $base/binr·©rïz$base/Lib/site-packagesz $base/ScriptscGs¼| d¡j}|jrdt|ƒ}|j|d<|j tj|j¡}|  ¡D]$\}}t ||dƒdur>t |||ƒq>ddl m }|D]B}t ||ƒ}|durt|||ƒ}tjdkrªtj |¡}t |||ƒqtdS)Nrr*r)rrï)Zget_finalized_commandrÂrvrÀÚINSTALL_SCHEMESrr’rìÚDEFAULT_SCHEMErŒrÆrñr¾rr“rã)r�ròrÂÚschemerórôrr7r7r8rÑls        zeasy_install._expand)T)F)F)T)N)r_r7)r¦)OÚ__name__Ú __module__Ú __qualname__Ú__doc__Ú descriptionZcommand_consumes_argumentsr€rƒZ user_optionsZboolean_optionsZ negative_optrrÚr�r�r›Ú staticmethodr­rârÕrßrÎrõrÏrÐrÿrrýrÖrCrDÚlstriprrrr r r'r,r.r0rÇÚcontextmanagerr4r/r7rír8rJrRr%r$rXrVr?r@rirjr‹rkr§r¨rDrªrqrrrr¯rArnr€r£rErrërÀrÄrÅrÑr7r7r7r8r/qsæá! -  {     -ÿÿÿ :    % # ü ,    3615ÿ ÿ ÿ )ÿ" þÿþr/cCs tj dd¡ tj¡}td|ƒS)Nrr±)r’rrr¿ÚpathsepÚfilter)rŒr7r7r8Ú _pythonpathƒsrÑc sŽg‰ˆ tƒ¡tjg}tjtjkr0| tj¡|D]Ð}|s>q4tjdvr`ˆ tj  |dd¡¡nVtj dkrœˆ tj  |ddj tj Žd¡tj  |dd¡g¡nˆ |tj  |dd¡g¡tjdkrÂq4d |vrÌq4tj  d ¡}|sÞq4tj  |d d d j tj Žd¡}ˆ |¡q4tdƒtdƒf}ˆ ‡fdd„|Dƒ¡tj�rBˆ tj¡t t¡�ˆ t ¡¡Wdƒn1�sr0Ytttˆƒƒ‰ˆS)z& Return a list of 'site' dirs )Zos2emxZriscosZLibz site-packagesr’r³z python{}.{}z site-pythonÚdarwinzPython.frameworkÚHOMEÚLibraryÚPythonr£ZpurelibZplatlibc3s|]}|ˆvr|VqdSr‘r7r¸©Úsitedirsr7r8r˜Årºz get_site_dirs..N)rÔrÑr¦rvr¯r)r„r’r“rÚsepr¥r§rrrr€rÌrƒrÇrÈrÉÚgetsitepackagesr™ršr)rŸrvrÂZhome_spZ lib_pathsr7rÖr8rÒˆsb      üùÿ þÿ   û   .rÒccsæi}|D]Ø}t|ƒ}||vrqd||<tj |¡s4qt |¡}||fV|D]’}| d¡s\qL|dvrfqLttj ||¡ƒ}tt |ƒƒ}|  ¡|D]L}|  d¡r q�t|  ¡ƒ}||vr¶q�d||<tj |¡sÌq�|t |¡fVq�qLqdS)zBYield sys.path directories that might contain "old-style" packagesrr)rr±ÚimportN) rr’r“r rKr=r rr™r,rrpÚrstrip)ZinputsÚseenrr+rìrUÚlinesÚliner7r7r8Ú expand_pathsÒs8        rßc Cs`t|dƒ}�zDt |¡}|dur.W| ¡dS|d|d|d}|dkr\W| ¡dS| |d¡t d| d¡¡\}}}|dvr˜W| ¡dS| |d|¡d d d œ}t  |¡}z<| |¡} |   d d ¡d } |   t   ¡¡} | t | ¡¡Wn"tj�yYW| ¡dS0| d¡�r6| d¡�sDW| ¡dS|W| ¡S| ¡0dS)znExtract configuration data from a bdist_wininst .exe Returns a configparser.RawConfigParser, or None ÚrbNé ééé zegg path translations for a given .exe file))zPURELIB/r±)zPLATLIB/pywin32_system32r±)zPLATLIB/r±)r–zEGG-INFO/scripts/)zDATA/lib/site-packagesr±r’rår)r…rz .egg-inforNr·rz -nspkg.pth)ZPURELIBZPLATLIBú\rÚz%s/%s/r±cSsg|]\}}| ¡|f‘qSr7)rÊ)r–rQÚyr7r7r8r¹Hrºz$get_exe_prefixes..)ræÚZipFileÚinfolistr—r¿rúr=rÙrÚupperrér^r,rErFrpr)rÚsortÚreverse)Z exe_filenamerŸrJržrìrœrQZpthr7r7r8r2)s2       r2csfeZdZdZd‡fdd„ Zdd„Zdd„Zd d „Zed d „ƒZ ‡fd d„Z ‡fdd„Z dd„Z ‡Z S)r0z)A .pth file with Distribution paths in itr7cs„||_ttt|ƒƒ|_ttj |j¡ƒ|_|  ¡\|_ |_ |j dd…|_ t ƒ gdd¡t|j ƒD]}tt|jt|dƒƒƒqddS)NT)r—r™ršrr×r’r“rÚbasedirÚ_loadr³ÚdirtyÚ _init_pathsÚsuperÚ__init__r,rBr)r�r—r×r“©Ú __class__r7r8rþQszPthDistributions.__init__c Csèg}d}}t |j¡}t|jdƒ}|D]ˆ}| ¡}| |¡| d¡rNd}q(| ¡}|r(| d¡rfq(t t j   |j |¡ƒ} | |vsŽt j  | ¡s¨t d|¡d}| ¡q(d|| <q(| ¡|rØ|d ¡sØ| ¡d}qº||pä|oä|fS) NFZrt)úimport úfrom Tú#z!cleaned up dirty or duplicated %rrr•)rÀÚfromkeysr×r r—rÛr)rprErr’r“rrùr”r r¶Úpopr) r�r³rûZ saw_importrÜrUrÞr“Ú stripped_pathÚnormalized_pathr7r7r8Ú _load_raw\s2      zPthDistributions._load_rawcCstj |j¡r| ¡SgdfS)NF)r’r“rmr—rrŽr7r7r8rú{szPthDistributions._loadc Cs²| ¡\}}|dd…D]6}||jvrD|j |¡t d|¡d}q| |¡q|jdd…D]N}||vr^| d¡s^tj  |j |¡}tj  |¡s^|j |¡t d|¡d}q^|j |pÂ|j|j kO_ |j sÒdStt|j|jƒƒ}|�rft d|j¡| |¡}d  |¡d}tj |j¡�r,t |j¡t|jdƒ�}| |¡Wdƒn1�sZ0Yn*tj  |j¡�r�t d |j¡t |j¡d |_ |jdd…|j dd…<dS) z$Write changed .pth file back to diskNzdetected new path %rT)rrrz!removing now non-existent path %rz Saving %srBr²zDeleting empty %sF)rúr³r)r ržrCrpr’r“rrùr”rûrür™ršrµr¶r—Ú _wrap_linesr•r¢r r) r�Z last_pathsZ last_dirtyr“Z absolute_pathZ rel_pathsrÝÚdatarUr7r7r8r´€sB      ÿ     , zPthDistributions.savecCs|Sr‘r7)rÝr7r7r8r ®szPthDistributions._wrap_linescsN|j|jvo$|j|jvp$|jt ¡k}|r>|j |j¡d|_tƒ |¡dS)z"Add `dist` to the distribution mapTN) r9r³r×r’Úgetcwdr)rûrýrB)r�r«Únew_pathrÿr7r8rB²s   üzPthDistributions.addcs2|j|jvr"|j |j¡d|_qtƒ |¡dS)z'Remove `dist` from the distribution mapTN)r9r³rCrûrýrIrÿr7r8rC¿s zPthDistributions.removecCsŒtj t|ƒ¡\}}t|jƒ}|g}tjdkr2dp6tj}t|ƒ|krˆ||jkrl| tj ¡|  ¡|  |¡Stj |¡\}}| |¡q8|S)Nr’) r’r“r¿rrúrùÚaltseprØr)Úcurdirrør)r�r“ZnpathZlastZbaselenrœrØr7r7r8rµÆs      zPthDistributions.make_relative)r7)rÇrÈrÉrÊrþrrúr´rÌr rBrCrµÚ __classcell__r7r7rÿr8r0Ns .  r0c@s(eZdZedd„ƒZedƒZedƒZdS)ÚRewritePthDistributionsccs$|jV|D] }|Vq |jVdSr‘)ÚpreludeÚpostlude)ÚclsrÝrÞr7r7r8r ×sz#RewritePthDistributions._wrap_linesz? import sys sys.__plen = len(sys.path) zÐ import sys new = sys.path[sys.__plen:] del sys.path[sys.__plen:] p = getattr(sys, '__egginsert', 0) sys.path[p:p] = new sys.__egginsert = p + len(new) N)rÇrÈrÉÚ classmethodr rHrrr7r7r7r8rÖs ÿÿrZSETUPTOOLS_SYS_PATH_TECHNIQUEÚrawZrewritecCs ttjtƒrtSt tj ¡¡S)z_ Return a regular expression based on first_line_re suitable for matching strings. )rÜr ÚpatternrÝÚreÚcompiler^r7r7r7r8Ú_first_line_reôs rcCs\|tjtjfvr.tjdkr.t|tjƒ||ƒSt ¡\}}}|d|dd||ff‚dS)Nrðrrz %s %s) r’r¢rCrìrbrºÚS_IWRITEr¦r)ÚfuncÚargÚexcÚetZevr‡r7r7r8Ú auto_chmods  rcCs.t|ƒ}t|tjƒ|r"t|ƒnt|ƒdS)aa Fix any globally cached `dist_path` related data `dist_path` should be a path of a newly installed egg distribution (zipped or unzipped). sys.path_importer_cache contains finder objects that have been cached when importing data from the original distribution. Any such finders need to be cleared since the replacement distribution might be packaged differently, e.g. a zipped egg distribution might get replaced with an unzipped egg folder or vice versa. Having the old finders cached may then cause Python to attempt loading modules from the replacement distribution using an incorrect loader. zipimport.zipimporter objects are Python loaders charged with importing data packaged inside zip archives. If stale loaders referencing the original distribution, are left behind, they can fail to load modules from the replacement distribution. E.g. if an old zipimport.zipimporter instance is used to load data from a new zipped egg archive, it may cause the operation to attempt to locate the requested data in the wrong location - one indicated by the original distribution's zip archive directory information. Such an operation may then fail outright, e.g. report having read a 'bad local file header', or even worse, it may fail silently & return invalid data. zipimport._zip_directory_cache contains cached zip archive directory information for all existing zipimport.zipimporter instances and all such instances connected to the same archive share the same cached directory information. If asked, and the underlying Python implementation allows it, we can fix all existing zipimport.zipimporter instances instead of having to track them down and remove them one by one, by updating their shared cached zip archive directory information. This, of course, assumes that the replacement distribution is packaged as a zipped egg. If not asked to fix existing zipimport.zipimporter instances, we still do our best to clear any remaining zipimport.zipimporter related cached data that might somehow later get used when attempting to load data from the new distribution and thus cause such load operations to fail. Note that when tracking down such remaining stale data, we can not catch every conceivable usage from here, and we clear only those that we know of and have found to cause problems if left alive. Any remaining caches should be updated by whomever is in charge of maintaining them, i.e. they should be ready to handle us replacing their zip archives with new distributions at runtime. N)rÚ_uncacher¦Úpath_importer_cacheÚ!_replace_zip_directory_cache_dataÚ*_remove_and_clear_zip_directory_cache_data)Z dist_pathr|rr7r7r8r‚ s <  r‚cCsPg}t|ƒ}|D]:}t|ƒ}| |¡r|||d…tjdfvr| |¡q|S)ap Return zipimporter cache entry keys related to a given normalized path. Alternative path spellings (e.g. those using different character case or those using alternative path separators) related to the same path are included. Any sub-path entries are included as well, i.e. those corresponding to zip archives embedded in other zip archives. rr±)rúrrpr’rØr))rÚcacheÚresultÚ prefix_lenÚpZnpr7r7r8Ú"_collect_zipimporter_cache_entries[s þ r(cCs@t||ƒD]0}||}||=|o(|||ƒ}|dur |||<q dS)a— Update zipimporter cache data for a given normalized path. Any sub-path entries are processed as well, i.e. those corresponding to zip archives embedded in other zip archives. Given updater is a callable taking a cache entry key and the original entry (after already removing the entry from the cache), and expected to update the entry and possibly return a new one to be inserted in its place. Returning None indicates that the entry should not be replaced with a new one. If no updater is given, the cache entries are simply removed without any additional processing, the same as if the updater simply returned None. N)r()rr$Úupdaterr'Ú old_entryZ new_entryr7r7r8Ú_update_zipimporter_cacheqs  r+cCst||ƒdSr‘)r+)rr$r7r7r8r ‘sr cCsdd„}t|tj|d�dS)NcSs | ¡dSr‘)Úclear©r“r*r7r7r8Ú2clear_and_remove_cached_zip_archive_directory_data–szf_remove_and_clear_zip_directory_cache_data..clear_and_remove_cached_zip_archive_directory_data©r)©r+rvÚ_zip_directory_cache)rr.r7r7r8r#•s ýr#Z__pypy__cCsdd„}t|tj|d�dS)NcSs&| ¡t |¡| tj|¡|Sr‘)r,rvrwrÃr1r-r7r7r8Ú)replace_cached_zip_archive_directory_data­s zT_replace_zip_directory_cache_data..replace_cached_zip_archive_directory_datar/r0)rr2r7r7r8r"¬s  ýr"úc Cs2zt||dƒWnttfy(YdS0dSdS)z%Is this string a valid Python script?ÚexecFTN)rÚ SyntaxErrorÚ TypeError)rGr—r7r7r8Ú is_pythonÁs r7cCsZz:t|dd��}| d¡}Wdƒn1s.0YWntyP|YS0|dkS)zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1)Úencodingr)Nú#!)r rér )r ÚfpÚmagicr7r7r8Úis_shËs ,  r<cCs t |g¡S)z@Quote a command line argument according to Windows parsing rules©Ú subprocessÚ list2cmdline)rr7r7r8Ú nt_quote_argÕsr@cCsH| d¡s| d¡rdSt||ƒr&dS| d¡rDd| ¡d ¡vSdS)zHIs this text, as a whole, a Python script? (as opposed to shell/bat/etc.rhú.pywTr9r«rF)r=r7rpÚ splitlinesrÊ)rZr—r7r7r8rWÚs  rW)rbcGsdSr‘r7)rnr7r7r8Ú_chmodësrCc CsTt d||¡zt||ƒWn2tjyN}zt d|¡WYd}~n d}~00dS)Nzchanging mode of %s to %ozchmod failed: %s)r r¶rCr’Úerror)r“rcr\r7r7r8rbïs rbc@sŠeZdZdZgZeƒZedd„ƒZedd„ƒZ edd„ƒZ edd „ƒZ ed d „ƒZ d d „Z edd„ƒZdd„Zedd„ƒZedd„ƒZdS)Ú CommandSpeczm A command spec for a #! header, specified as a list of arguments akin to those passed to Popen. cCs|S)zV Choose the best CommandSpec class based on environmental conditions. r7©rr7r7r8rTszCommandSpec.bestcCstj tj¡}tj d|¡S)NÚ__PYVENV_LAUNCHER__)r’r“rär¦r rr)rZ_defaultr7r7r8Ú_sys_executableszCommandSpec._sys_executablecCs:t||ƒr|St|tƒr ||ƒS|dur0| ¡S| |¡S)zg Construct a CommandSpec from a parameter to build_scripts, which may be None. N)rÜr™Úfrom_environmentÚ from_string)rZparamr7r7r8Ú from_param s  zCommandSpec.from_paramcCs|| ¡gƒSr‘)rHrFr7r7r8rIszCommandSpec.from_environmentcCstj|fi|j¤Ž}||ƒS)z} Construct a command spec from a simple string representing a command line parseable by shlex.split. )Úshlexr¿Ú split_args)rÚstringrŒr7r7r8rJszCommandSpec.from_stringcCs8t | |¡¡|_t |¡}t|ƒs4dg|jdd…<dS)Nz-xr)rLr¿Ú_extract_optionsÚoptionsr>r?rA)r�rZÚcmdliner7r7r8Úinstall_options(s zCommandSpec.install_optionscCs:|d ¡d}tƒ |¡}|r.| d¡p0dnd}| ¡S)zH Extract any options from the first line of the script. rBrrr±)rBrÚmatchÚgrouprE)Z orig_scriptÚfirstrSrPr7r7r8rO.s zCommandSpec._extract_optionscCs| |t|jƒ¡Sr‘)Ú_renderr™rPrŽr7r7r8Ú as_header8szCommandSpec.as_headercCs6d}|D](}| |¡r| |¡r|dd…Sq|S)Nz"'rr•)rpr=)ÚitemZ_QUOTESÚqr7r7r8Ú _strip_quotes;s zCommandSpec._strip_quotescCs t dd„|Dƒ¡}d|dS)Ncss|]}t | ¡¡VqdSr‘)rErZrE)r–rXr7r7r8r˜Esz&CommandSpec._render..r9rBr=)rŒrQr7r7r8rVCs ÿzCommandSpec._renderN)rÇrÈrÉrÊrPrÀrMrrTrHrKrIrJrRrÌrOrWrZrVr7r7r7r8rE÷s*       rEc@seZdZedd�ZdS)ÚWindowsCommandSpecFrÃN)rÇrÈrÉrÀrMr7r7r7r8r[Osr[c@sbeZdZdZe d¡ ¡ZeZ e ddd„ƒZ e dd„ƒZ e dd „ƒZe d d „ƒZe dd d„ƒZdS)rSz` Encapsulates behavior around writing entry point scripts for console and gui apps. aJ # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r import re import sys # for compatibility with easy_install; see #2198 __requires__ = %(spec)r try: from importlib.metadata import distribution except ImportError: try: from importlib_metadata import distribution except ImportError: from pkg_resources import load_entry_point def importlib_load_entry_point(spec, group, name): dist_name, _, _ = spec.partition('==') matches = ( entry_point for entry_point in distribution(dist_name).entry_points if entry_point.group == group and entry_point.name == name ) return next(matches).load() globals().setdefault('load_entry_point', importlib_load_entry_point) if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(load_entry_point(%(spec)r, %(group)r, %(name)r)()) Nc cs€|dur| ¡}t| ¡ƒ}dD]Z}|d}| |¡ ¡D]>\}}| |¡|jtƒ}| ||||¡} | D] } | Vqlq:q dS)z� Yield write_script() argument tuples for a distribution's console_scripts and gui_scripts entry points. N©ZconsoleÚguiZ_scripts) rYrÝrFZ get_entry_maprŒÚ_ensure_safe_nameÚtemplater©Ú_get_script_args) rr«ÚheaderrþÚtype_rTrìZeprZrnr¤r7r7r8rU€s   zScriptWriter.get_argscCst d|¡}|rtdƒ‚dS)z? Prevent paths in *_scripts entry point names. z[\\/]z+Path separators not allowed in script namesN)rÚsearchrè)rìZ has_path_sepr7r7r8r^’s zScriptWriter._ensure_safe_namecCs.tjdkstjdkr&tjdkr&t ¡S|SdS)zD Select the best ScriptWriter for this environment. Úwin32ÚjavarðN)r¦r„r’rìÚ_nameÚWindowsScriptWriterrTrFr7r7r8rT›szScriptWriter.bestccs|||fVdSr‘r7)rrbrìrarZr7r7r8r`¥szScriptWriter._get_script_argsr±cCs"|j ¡ |¡}| |¡| ¡S)z;Create a #! line, getting options (if any) from script_text)Úcommand_spec_classrTrKrRrW)rrZr Úcmdr7r7r8rYªs zScriptWriter.get_header)N)r±N)rÇrÈrÉrÊrCrDrÍr_rErhrrUrÌr^rTr`rYr7r7r7r8rSSsÿ%    rSc@s@eZdZeZedd„ƒZedd„ƒZedd„ƒZe dd„ƒZ d S) rgcCs"tt|d�}tj dd¡}||S)zC Select the best ScriptWriter suitable for Windows )r ZnaturalZSETUPTOOLS_LAUNCHERr )rÀÚWindowsExecutableLauncherWriterr’rr)rZ writer_lookupZlauncherr7r7r8rTµs þzWindowsScriptWriter.bestc #sŽtddd�|}|tjd ¡ d¡vrDdjfitƒ¤Ž}t |¡gd¢}|  |¡|  ||¡}‡fdd „|Dƒ}ˆ|||d |fVd S) z For Windows, add a .py extensionú.pyarAr\ÚPATHEXTú;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.)rkrhú -script.pyú.pycú.pyorArfcsg|] }ˆ|‘qSr7r7r`©rìr7r8r¹Ïrºz8WindowsScriptWriter._get_script_args..r_N) rÀr’rrÊr¿r¥r©rrerCÚ_adjust_header) rrbrìrarZÚextrîršrœr7rqr8r`Âsÿý   z$WindowsScriptWriter._get_script_argscCsNd}d}|dkr||}}t t |¡tj¡}|j||d�}| |¡rJ|S|S)z† Make sure 'pythonw' is used for gui and 'python' is used for console (regardless of what sys.executable is). rrr])rNÚrepl)rrÚescapeÚ IGNORECASEÚsubÚ _use_header)rrbZ orig_headerrrtZ pattern_obÚ new_headerr7r7r8rrÒs z"WindowsScriptWriter._adjust_headercCs$|dd… d¡}tjdkp"t|ƒS)zÝ Should _adjust_header use the replaced header? On non-windows systems, always use. On Windows systems, only use the replaced header if it resolves to an executable on the system. r)r•ú"rd)rEr¦r„r )ryZ clean_headerr7r7r8rxàs zWindowsScriptWriter._use_headerN) rÇrÈrÉr[rhrrTr`rrrÌrxr7r7r7r8rg²s   rgc@seZdZedd„ƒZdS)rjc #s’|dkrd}d}dg}nd}d}gd¢}| ||¡}‡fdd„|Dƒ} ˆ|||d | fVˆd t|ƒd fVtƒsŽˆd } | tˆƒd fVd S)zG For Windows, add a .py extension and an .exe launcher r]z -script.pywrAZclirn)rhrorpcsg|] }ˆ|‘qSr7r7r`rqr7r8r¹ürºzDWindowsExecutableLauncherWriter._get_script_args..r_rfrVz .exe.manifestN)rrÚget_win_launcherr9Úload_launcher_manifest) rrbrìrarZZ launcher_typersršZhdrrœZm_namer7rqr8r`îs" ýz0WindowsExecutableLauncherWriter._get_script_argsN)rÇrÈrÉrr`r7r7r7r8rjísrjcCsJd|}tƒr4tƒdkr&| dd¡}q@| dd¡}n | dd¡}td|ƒS)z« Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. z%s.exez win-arm64r®z-arm64.z-64.z-32.r¤)r9rrFr)ÚtypeZ launcher_fnr7r7r8r{ s  r{cCst td¡}| d¡tƒS)Nzlauncher manifest.xmlr])Ú pkg_resourcesrrÇr^Úvars)rìZmanifestr7r7r8r| s r|FcCst |||¡Sr‘)r*Z shutil_rmtree)r“Ú ignore_errorsZonexcr7r7r8r¡% sr¡cCst d¡}t |¡|S)Né)r’Úumask)Útmpr7r7r8ra) s  racCstdd„|ƒS)z, Exclude non-str values. Ref #3063. cSs t|tƒSr‘)rÜrÝ)rôr7r7r8Ú3 rºzonly_strs..)rÐ)rÁr7r7r8rÀ/ srÀc@seZdZdZdZdZdS)rdz#easy_install command is deprecated.z‘ Please avoid running ``setup.py`` and ``easy_install``. Instead, use pypa/build, pypa/installer or other standards-based tools. z-https://github.com/pypa/setuptools/issues/917N)rÇrÈrÉZ_SUMMARYZ_DETAILSZ_SEE_URLr7r7r7r8rd6 srd)N)r3)~rÊrr¾rrrZdistutils.errorsrrrr rûr r Zdistutils.command.build_scriptsr r!r Zdistutils.commandrr¦r’rvrLr1rærrºrrCÚwarningsr€r5rÇr>rLrìrêrÁrr¤rZsetuptools.sandboxrZsetuptools.commandrZsetuptools.archive_utilrZsetuptools.package_indexrrrrrZsetuptools.warningsrrZsetuptools.wheelrr~rrrrr r!r"r#r$r%r&r'r(r±r*Ú_pathr+Zextern.jaraco.textr,ÚfilterwarningsZ PEP440WarningÚ__all__r9r>rArHr/rÑrÒrßr1r2r0rrrrrr‚r(r+r r#Úbuiltin_module_namesr"r7r<r@rWrbrCÚ ImportErrorr™rErHZsys_executabler[rSrgrjr{r|r¡rarÀrdr7r7r7r8ÚsÆ           <   J.)%   R     U_;