o ÏCÙf¥Wã@sÌdZddlmZddlmZddlmZmZddlmZmZm Z m Z ddl m Z m Z ddlmZmZddlmZdd lmZdd 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(m)Z)dd l*m+Z+dd l*m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6ddl/m7Z7m8Z8ddl9m:Z:ddl;mZ>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJdd l;Z;ejKde;jLdgd¢ZMdd„ZNdd„ZOdd„ZPdd„ZQd d!„ZRGd"d#„d#e,ƒZSd$d%„ZTd&d'„ZUd(d)„ZVd*d+„ZWd,d-„ZXGd.d/„d/eBƒZYGd0d1„d1eYƒZZej[ \d2d3¡d4krBeZZYd5d6„Z]d7d8„Z^d9d:„Z_d;d<„Z`did=d>„Zad?d@„ZbdAdB„ZcdCejdvrhecZendDdE„ZedjdGdH„ZfdIdJ„ZgdKdL„ZhdMdN„ZizddOlmjZkWnely“dPdQ„ZkYnwdRdS„ZjGdTdU„dUemƒZnen o¡ZpGdVdW„dWenƒZqGdXdY„dYƒZrGdZd[„d[erƒZsGd\d]„d]esƒZterjuZuerjvZvd^d_„Zwd`da„Zxdbe^fdcdd„Zydedf„ZzGdgdh„dhe+ƒZ{d S)ka) 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)ÚINSTALL_SCHEMESÚ SCHEME_KEYS)ÚlogÚdir_util)Ú first_line_re)Úfind_executableN)Úget_config_varsÚget_path)ÚSetuptoolsDeprecationWarning)ÚCommand)Ú run_setup)Úsetopt)Úunpack_archive)Ú PackageIndexÚparse_requirement_argÚ URL_SCHEME)Ú bdist_eggÚegg_info)ÚWheel)Ú yield_linesÚnormalize_pathÚresource_stringÚensure_directoryÚget_distributionÚfind_distributionsÚ EnvironmentÚ RequirementÚ DistributionÚ PathMetadataÚ EggMetadataÚ WorkingSetÚDistributionNotFoundÚVersionConflictÚ DEVELOP_DISTÚdefault)Úcategory)ÚsamefileÚ easy_installÚPthDistributionsÚextract_wininst_cfgÚget_exe_prefixescCst d¡dkS)NÚPé)ÚstructÚcalcsize©r7r7úA/usr/lib/python3/dist-packages/setuptools/command/easy_install.pyÚis_64bitJór9cCsjtj |¡o tj |¡}ttjdƒo|}|rtj ||¡Stj tj |¡¡}tj tj |¡¡}||kS)z  Determine if two paths reference the same file. Augments os.path.samefile to work on Windows and suppresses errors if the path doesn't exist. r.)ÚosÚpathÚexistsÚhasattrr.ÚnormpathÚnormcase)Úp1Úp2Ú both_existÚ use_samefileÚnorm_p1Únorm_p2r7r7r8r.Nsr.cCs | d¡S)NÚutf8)Úencode©Úsr7r7r8Ú _to_bytes^s rKcCs&z| d¡WdStyYdSw)NÚasciiTF)rHÚ UnicodeErrorrIr7r7r8Úisasciibs   ÿrNcCst |¡ ¡ dd¡S)NÚ z; )ÚtextwrapÚdedentÚstripÚreplace)Útextr7r7r8Ú _one_linerjsrUc@sÒeZdZdZdZdZdddddd d d d d ddddddddddddddddejfgZgd¢Z dd iZ e Z d!d"„Z d#d$„Zd%d&„Zed'd(„ƒZd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd˜d3d4„Zd5d6„Zd7d8„Zd9d:„Ze d;¡ ¡Ze d<¡ ¡Ze d=¡ ¡Z d>d?„Z!d@dA„Z"dBdC„Z#dDdE„Z$dFdG„Z%dHdI„Z&e'j(dJdK„ƒZ)d™dMdN„Z*d™dOdP„Z+dQdR„Z, d˜dSdT„Z-dUdV„Z.dWdX„Z/dYdZ„Z0dšd[d\„Z1ed]d^„ƒZ2d›dadb„Z3dcdd„Z4dedf„Z5dgdh„Z6didj„Z7dkdl„Z8dmdn„Z9e do¡ ¡Z:e dp¡Z;dœdrds„Zdwdx„Z?dydz„Z@d{d|„ZAd}d~„ZBdd€„ZCdd‚„ZDdƒd„„ZEe d…¡ F¡ZGd†d‡„ZHeIjJddˆ…d‰vs:dŠeIjKvr=d‹ZLndŒZLeMeMddŽdeMdeLd‘deMdeLd‘deMd’eLdŽdd“ZNeMd”d•dZOd–d—„ZPdS)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=rJzinstall 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)zinstall-layout=Nz1installation layout to choose (known values: deb))z"force-installation-into-system-dirÚ0zforce installation into /usr)z no-find-linksNz9Don't load find-links defined in packages being installedÚuserNz!install in user site-package '%s') rVrXr]rZr_rhrjrmroz&force-installation-into-system-diruserrerVcCsDt dt¡d|_d|_|_d|_|_|_d|_ d|_ d|_ d|_ d|_ |_d|_|_|_d|_|_|_d|_|_|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ t!j"rlt!j#|_$t!j%|_&nd|_$d|_&d|_'d|_(d|_)|_*d|_+i|_,d|_-d|_.d|_/d|_0|j1j2|_2|j1 3||j1 4d¡¡dS)NzVeasy_install command is deprecated. Use build and pip and other standards-based tools.rr/)5ÚwarningsÚwarnÚEasyInstallDeprecationWarningrqÚzip_okÚlocal_snapshots_okÚ install_dirÚ script_dirÚexclude_scriptsÚ index_urlÚ find_linksÚbuild_directoryÚargsÚoptimizeÚrecordrZÚ always_copyÚ multi_versionrhÚno_depsÚ allow_hostsÚrootÚprefixÚ no_reportroÚinstall_purelibÚinstall_platlibÚinstall_headersÚ install_libÚinstall_scriptsÚ install_dataÚ install_baseÚinstall_platbaseÚsiteÚENABLE_USER_SITEÚ USER_BASEÚinstall_userbaseÚ USER_SITEÚinstall_usersiteÚ no_find_linksÚ package_indexÚpth_fileÚalways_copy_fromÚ site_dirsÚinstalled_projectsÚinstall_layoutÚ"force_installation_into_system_dirÚ multiarchÚ_dry_runÚ distributionÚverboseÚ_set_command_optionsÚget_option_dict©Úselfr7r7r8Úinitialize_optionssTý      ÿzeasy_install.initialize_optionscCs"dd„|Dƒ}tt|j|ƒƒdS)Ncss,|]}tj |¡stj |¡r|VqdS©N)r;r<r=Úislink)Ú.0Úfilenamer7r7r8Ú Øs€ þ þ ÿz/easy_install.delete_blockers..)ÚlistÚmapÚ _delete_path)r¤ÚblockersÚextant_blockersr7r7r8Údelete_blockers×sÿzeasy_install.delete_blockerscCsJt d|¡|jr dStj |¡otj |¡ }|rtntj}||ƒdS)Nz Deleting %s) r ÚinfoÚdry_runr;r<Úisdirr§ÚrmtreeÚunlink)r¤r<Úis_treeÚremoverr7r7r8r­Þs  zeasy_install._delete_pathcCs4djtjŽ}tdƒ}d}t|jditƒ¤Žƒtƒ‚)zT Render the Setuptools version and installation details, then exit. ú{}.{}Ú setuptoolsz=setuptools {dist.version} from {dist.location} (Python {ver})Nr7)ÚformatÚsysÚ version_infor!ÚprintÚlocalsÚ SystemExit)ÚverÚdistÚtmplr7r7r8Ú_render_versionçs zeasy_install._render_versionc CsÜ|jo| ¡tj ¡d}tddƒ\}}|j ¡|j ¡|j ¡||dd…|d|d||||t tddƒdœ |_ t j rK|j |j d <|j|j d <n|jrSt d ¡| ¡| ¡| ¡|jr†|j ¡d vrmtd ƒ‚|j ¡|_ddl}tjdd…dkr†| d¡|_| dddd¡|jdur—|j|_|jdurŸd|_|  dd¡|  dd¡|jr¹|j!r¹|j!|_|j"|_|j#dkrÅ|j$sÅtdƒ‚|  dd¡t%t&tj'ƒ}t(ƒ|_)|j*dur dd„|j* d¡Dƒ}|D]$}t+j' ,|¡s÷t d |¡qèt&|ƒ|vrt|d!ƒ‚|j) -t&|ƒ¡qè|j.s| /¡|j0pd"|_0|j)dd…|_1|jt&|jƒfD]}||j1vr;|j1 2d|¡q,|j3durOd#d„|j3 d¡Dƒ} nd$g} |j4durc|j5|j0|j1| d%|_4t6|j1tj'ƒ|_7|j8dur€t9|j8t:ƒr|j8 ¡|_8ng|_8|j;r‘|j4 <|j1tj'¡|jsœ|j4 =|j8¡|  dd&¡t9|j>t?ƒsÕzt?|j>ƒ|_>d|j>kr¾dksÁt@‚t@‚Wnt@yÔ} ztd'ƒ| ‚d} ~ ww|j.rá|jAsátBd(ƒ‚|jCsétBd)ƒ‚g|_DdS)*Nrr…Ú exec_prefixééÚabiflagsÚ) Ú dist_nameÚ dist_versionÚ dist_fullnameÚ py_versionÚpy_version_shortÚpy_version_nodotÚ sys_prefixr…Úsys_exec_prefixrÄrÇÚuserbaseÚusersitez6WARNING: The user site-packages directory is disabled.©Údebz"unknown value for --install-layout)rÅrÅÚ MULTIARCHrwrxr|r™FrŠ)rwrwr‹©rwrxú/usrzÞinstallation into /usr Trying to install into the system managed parts of the file system. Please consider to install to another location, or use the option --force-installation-into-system-dir to overwrite this warning. Úinstall)rrcSsg|] }tj | ¡¡‘qSr7)r;r<Ú expanduserrR©r¨rJr7r7r8Ú Fsÿz1easy_install.finalize_options..ú,z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.pathzhttps://pypi.org/simple/cSsg|]}| ¡‘qSr7)rRrÚr7r7r8rÛ\óÚ*)Ú search_pathÚhosts)r~r~z--optimize must be 0, 1, or 2z9Must specify a build directory (-b) when using --editablez:No urls, filenames, or requirements specified (see --help))ErorÃr»ÚsplitrrŸÚget_nameÚ get_versionÚ get_fullnameÚgetattrÚ config_varsrrr’r”rqr rsÚ_fix_install_dir_for_user_siteÚexpand_basedirsÚ expand_dirsr›ÚlowerrÚ sysconfigr¼Úget_config_varrÚ_expandrxrwr•Úset_undefined_optionsr‡r‹r…rœr¬rr<Ú get_site_dirsÚ all_site_dirsr™r;r³ÚappendrhÚcheck_site_dirrzÚ shadow_pathÚinsertrƒr–Ú create_indexr#Ú local_indexr{Ú isinstanceÚstrrvÚscan_egg_linksÚadd_find_linksr~ÚintÚ ValueErrorr|rr}Úoutputs) r¤rÌr…rÄrër?r™r\Ú path_itemràrir7r7r8Úfinalize_optionsòsè €  ô    þ  ÿÿ     þ ÿ €   ÿ  €  ÿÿÿþ€ÿÿÿ zeasy_install.finalize_optionscCs\|jrtjsdS| ¡|jdurd}t|ƒ‚|j|_|_tj   dd¡d}|  |¡dS)z; Fix the install_dir if "--user" was used. Nz$User base directory is not specifiedÚposixÚunixÚ_user) rqrrÚcreate_home_pathr’r rrŽr;ÚnamerSÚ select_scheme)r¤ÚmsgÚ scheme_namer7r7r8rçƒs  z+easy_install._fix_install_dir_for_user_sitecCsX|D]'}t||ƒ}|dur)tjdkstjdkrtj |¡}t||jƒ}t|||ƒqdS)NrÚnt)rår;rr<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.)rrŽr„N©r r£r7r7r8rè›szeasy_install.expand_basedirscCsgd¢}| |¡dS)z+Calls `os.path.expanduser` on install dirs.)r‡rˆrŠr‰r‹rŒNr)r¤Údirsr7r7r8ré szeasy_install.expand_dirsc Csè|r | dtj¡|j|jjkrt |j¡zU|jD] }| ||j ¡q|j r^t t |j ƒƒ}|j rJt|j ƒ}tt|ƒƒD] }|||d…||<q=ddlm}| |j|j |fd|j ¡| ¡Wt |jj¡dSt |jj¡w)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')Úannouncer ÚWARNr rŸÚ set_verbosityr}r/r‚rr«Úsortedrýr„ÚlenÚrangeÚ distutilsrÚexecuteÚ write_fileÚwarn_deprecated_options)r¤Úshow_deprecationÚspecrýÚroot_lenÚcounterrr7r7r8Úrun¬s2ý     ÿþ "zeasy_install.runcCsBzt ¡}Wntyt dtj¡}Ynwtj |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ÚrandomÚrandintr»Úmaxsizer<Újoinrw)r¤Úpidr7r7r8Úpseudo_tempnameÉs   ÿzeasy_install.pseudo_tempnamecCódSr¦r7r£r7r7r8rÔóz$easy_install.warn_deprecated_optionsc CsBt|jƒ}tj |d¡}tj |¡s)zt |¡Wnttfy(|  ¡Ynw||j v}|s8|j s8|  ¡}n1|  ¡d}tj |¡}z|rLt |¡t|dƒ ¡t |¡Wnttfyh|  ¡Ynw|s~|j s~tj dd¡}t |j|j|¡|r|jdurŒt||j ƒ|_nd|_|j rœtj |¡sœd|_||_dS)z;Verify that self.install_dir is .pth-capable dir, if neededúeasy-install.pthz .write-testÚwÚ PYTHONPATHrÈN)rrwr;r<r%r=ÚmakedirsÚOSErrorÚIOErrorÚcant_write_to_targetrðrÚcheck_pth_processingr'rµÚopenÚcloseÚenvironÚgetr rsÚ_easy_install__no_default_msgr—r0)r¤Úinstdirr—Ú is_site_dirÚtestfileÚ test_existsÚ 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. cCsR|jt ¡d|jf}tj |j¡s|d|j7}t |ƒ‚|d|j7}t |ƒ‚)NérO) Ú_easy_install__cant_write_msgr»Úexc_inforwr;r<r=Ú_easy_install__not_exists_idÚ_easy_install__access_msgr)r¤rr7r7r8r0(s ÿz!easy_install.cant_write_to_targetc Cs|j}t d|¡| ¡d}|d}tj |¡}tdƒd}z|r't |¡tj  |¡}tj |ddt |dƒ}Wnt t fyI| ¡Yn³wz“| |jditƒ¤Ž¡| ¡d }tj}tjd kr„tj |¡\}} tj |d ¡} |  ¡d kotj | ¡} | r„| }d dlm} | |dddgd ƒtj |¡rÀt d|¡W|r¦| ¡tj |¡r±t |¡tj |¡r¾t |¡dSdSW|rÇ| ¡tj |¡rÒt |¡tj |¡rÝt |¡n|rä| ¡tj |¡rït |¡tj |¡rût |¡ww|jst 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() rOT)Úexist_okr+Nrú pythonw.exeú python.exer)Úspawnz-Ez-cÚpassz-TEST PASSED: %s appears to support .pth filesz+TEST FAILED: %s does NOT support .pth filesFr7)rwr r±r'r;r<r=rUrµÚdirnamer-r2r.r/r0Úwriterºr¾r3r»Ú executablerrár%rêÚdistutils.spawnrErrs) r¤r7r—Úok_fileÚ ok_existsrÂrGrbrIÚbasenameÚaltÚuse_altrEr7r7r8r11s~   û   ÿ   þ  þ   ÿõ    €û    ÿ z!easy_install.check_pth_processingc CsV|js$| d¡r$| d¡D]}| d|¡rq | ||| d|¡¡q | |¡dS)z=Write all the scripts for `dist`, unless scripts are excludedÚscriptszscripts/N)ryÚmetadata_isdirÚmetadata_listdirÚinstall_scriptÚ get_metadataÚinstall_wrapper_scripts)r¤rÁÚ script_namer7r7r8Úinstall_egg_scriptsls þz easy_install.install_egg_scriptscCsVtj |¡r#t |¡D]\}}}|D] }|j tj ||¡¡qq dS|j |¡dSr¦)r;r<r³Úwalkrýrñr%)r¤r<ÚbaserÚfilesr©r7r7r8Ú add_outputzs ÿÿzeasy_install.add_outputcCs|jr td|fƒ‚dS)NzjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).)rhr©r¤rr7r7r8Ú not_editable‚sþÿÿzeasy_install.not_editablecCs<|jsdStj tj |j|j¡¡rtd|j|jfƒ‚dS)Nz2%r already exists in %s; can't do a checkout there)rhr;r<r=r%r|Úkeyrr\r7r7r8Úcheck_editableŠs ÿÿÿzeasy_install.check_editablec csTtjdd}zt|ƒVWtj |¡ot|ƒdSdStj |¡o(t|ƒww)Nz easy_install-)r…)ÚtempfileÚmkdtemprør;r<r=r´)r¤Útmpdirr7r7r8Ú_tmpdir”s €  8zeasy_install._tmpdirFc CsB| ¡“}t|tƒsIt|ƒr*| |¡|j ||¡}| d|||d¡WdƒStj   |¡rE| |¡| d|||d¡WdƒSt |ƒ}|  |¡|j  |||j|j|j |j¡}|durqd|}|jrm|d7}t|ƒ‚|jtkr‡| |||d¡|WdƒS| ||j||¡WdƒS1sšwYdS)NTz+Could not find suitable distribution for %rz2 (--always-copy skips system and development eggs)ÚUsing)rcr÷r$rr]r–ÚdownloadÚ install_itemr;r<r=rr_Úfetch_distributionrZrhr€rörÚ precedencer+Úprocess_distributionÚlocation)r¤rÚdepsrbÚdlrÁrr7r7r8r/s8   ú  õ   þ ä$âzeasy_install.easy_installcCs |p|j}|ptj |¡|k}|p| d¡ }|p*|jduo*tj t|ƒ¡t|jƒk}|rA|sA|j|jD] }|j |kr>nq5d}t   dtj  |¡¡|ra|  |||¡}|D] }| |||¡qVn| |¡g}| ||d|d¡|dur‚|D] }||vr|SqwdSdS)Nú.eggTz Processing %srrd)r€r;r<rGÚendswithr˜rröÚ project_namerjr r±rMÚ install_eggsriÚegg_distribution)r¤rrerbrkÚinstall_neededrÁÚdistsr7r7r8rf¾s<  ÿþ ÿÿ ÿþzeasy_install.install_itemcCs<t|}tD]}d|}t||ƒdurt||||ƒqdS)z=Sets the install directories by applying the install schemes.Úinstall_N)r r rår )r¤rÚschemer^Úattrnamer7r7r8râs€ýzeasy_install.select_schemec Gsš| |¡|j |¡||j|jvr|j |¡|j |¡| |¡||j|j<t  |j ||g|¢RŽ¡|  d¡rH|j sH|j  | d¡¡|sO|jsOdS|dura|j|jkrat d|¡dS|dusi||vrs| ¡}tt|ƒƒ}t  d|¡ztgƒ |g|j|j¡}Wn%tyš}ztt|ƒƒ|‚d}~wty¬}zt| ¡ƒ|‚d}~ww|js³|jrÅ|D]}|j|jvrÄ| | ¡¡qµt  d|¡dS)Nzdependency_links.txtzSkipping dependencies for %szProcessing dependencies for %sz'Finished processing dependencies for %s)Ú update_pthr–Úaddrör^ÚremoverWršr r±Úinstallation_reportÚ has_metadatar•rúÚget_metadata_linesr€rsÚas_requirementr$rør(Úresolver/r)rr*Úreportr˜)r¤Ú requirementrÁrkr±ÚdistreqÚdistrosrir7r7r8riìsP       ÿÿ     ÿ€€ÿ  €z!easy_install.process_distributioncCs2|jdur |j S| d¡rdS| d¡sdSdS)Nz not-zip-safeTzzip-safeF)rur{©r¤rÁr7r7r8Ú should_unzips   zeasy_install.should_unzipcCs¶tj |j|j¡}tj |¡rd}t ||j|j|¡|Stj |¡r&|}n)tj  |¡|kr3t  |¡t  |¡}t |ƒdkrOtj ||d¡}tj |¡rO|}t |ƒt ||¡|S)Nz<%r already exists in %s; build directory %s will not be keptr<r)r;r<r%r|r^r=r rsr³rGrµÚlistdirrr ÚshutilÚmove)r¤rÚ dist_filenameÚ setup_baseÚdstrÚcontentsr7r7r8Ú maybe_moves$ ÿ      zeasy_install.maybe_movecCs,|jrdSt ¡ |¡D]}|j|Žq dSr¦)ryÚ ScriptWriterÚbestÚget_argsÚ write_script)r¤rÁr}r7r7r8rU5s  ÿz$easy_install.install_wrapper_scriptscCsNt| ¡ƒ}t||ƒ}|r| |¡tƒ}t |¡|}| |t|ƒd¡dS)z/Generate a legacy script wrapper and install itrcN) rør}Úis_python_scriptÚ_load_templater¾rÚ get_headerrrK)r¤rÁrVÚ script_textÚdev_pathrÚ is_scriptÚbodyr7r7r8rS;s  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)rSrÚdecode)r•rÚ raw_bytesr7r7r8r’Es    zeasy_install._load_templateÚtr7csºˆ ‡fdd„|Dƒ¡t d|ˆj¡tj ˆj|¡}ˆ |¡ˆjr&dSt ƒ}t |ƒtj  |¡r8t  |¡t |d|ƒ }| |¡Wdƒn1sOwYt|d|ƒdS)z1Write an executable file to the scripts directorycsg|] }tj ˆj|¡‘qSr7)r;r<r%rx©r¨r^r£r7r8rÛWóz-easy_install.write_script..zInstalling %s script to %sNr+iÿ)r°r r±rxr;r<r%r[r²Ú current_umaskr r=rµr2rHÚchmod)r¤rVr‹Úmoder®ÚtargetÚmaskrbr7r£r8rTs ÿ    ÿzeasy_install.write_scriptc CsH|j|j|jdœ}z || ¡dd…}Wn tyYnw|||ƒgS|}tj |¡r:| d¡s:t |||j ƒn tj  |¡rFtj  |¡}|  |¡rY|jrY|durY| |||¡}tj |d¡}tj |¡sttj |dd¡ƒ}|s|tdtj  |¡ƒ‚t|ƒdkrŒtdtj  |¡ƒ‚|d }|jržt | ||¡¡gS| ||¡S) N)rmú.exez.whléüÿÿÿú.pyzsetup.pyrÞz"Couldn't find a setup script in %sr<zMultiple setup scripts in %sr)Ú install_eggÚ install_exeÚ install_wheelrêÚKeyErrorr;r<ÚisfilernrÚunpack_progressr³ÚabspathÚ startswithr|rŒr%r=rrrrhr r±Úreport_editableÚbuild_and_install) r¤rrˆrbÚ installer_mapÚ install_distr‰Ú setup_scriptÚsetupsr7r7r8rphsTýÿ ÿ    ÿ  ÿÿ  ÿÿ zeasy_install.install_eggscCs>tj |¡rt|tj |d¡ƒ}ntt |¡ƒ}tj ||dS)NúEGG-INFO)Úmetadata) r;r<r³r&r%r'Ú zipimportÚ zipimporterr%Ú from_filename)r¤Úegg_pathrµr7r7r8rq›s  ÿzeasy_install.egg_distributionc Cs‚tj |jtj |¡¡}tj |¡}|jst|ƒ| |¡}t ||ƒs·tj  |¡r8tj  |¡s8t j ||jdntj |¡rI| tj|fd|¡z_d}tj  |¡re| |¡r^tjd}}n,tjd}}n%| |¡rv| |¡|jd}}nd}| |¡r„tjd}}ntjd}}| |||f|dtj |¡tj |¡f¡t||d Wnty¶t|dd ‚w| |¡| |¡S) N©r²ú Removing FÚMovingÚCopyingÚ ExtractingTz %s to %s©Úfix_zipimporter_caches)r;r<r%rwrMr¬r²r rqr.r³r§r Ú remove_treer=rrµr­r†r‡Úcopytreer„ÚmkpathÚunpack_and_compileÚcopy2rGÚupdate_dist_cachesr!r[)r¤r¹rbÚ destinationrÁÚnew_dist_is_zippedrbrYr7r7r8r¦¤s` þ    ý        þý þ  þ  zeasy_install.install_eggc sNt|ƒ}|durtd|ƒ‚td| dd¡| dd¡tƒd}tj || ¡d¡}||_ |d}tj |d¡}tj |d ¡}t |ƒt ||ƒ|_ |  ||¡tj |¡s€t|d ƒ} |  d ¡| d¡D]\} } | d kr{|  d |  dd¡ ¡| f¡qd|  ¡tj |d¡‰| ‡fdd„t |¡Dƒ¡tj|||j|jd| ||¡S)Nz(%s is not a valid distutils Windows .exerµrro)roroÚplatformrmz.tmpr´úPKG-INFOr+zMetadata-Version: 1.0 Útarget_versionz%s: %s Ú_ú-rPcsg|] }tj ˆ|d¡‘qS)r)r;r<r%)r¨r}©rxr7r8rÛüsÿÿz,easy_install.install_exe..)r r²)r1rr%r5rr;r<r%Úegg_namerjr r&Ú _providerÚ exe_to_eggr=r2rHÚitemsrSÚtitler3r°rrrÚ make_zipfiler r²r¦) r¤rˆrbÚcfgrÁr¹Úegg_tmpÚ _egg_infoÚpkg_infrbÚkÚvr7rÎr8r§ÚsDÿ ý     €þ ÿ zeasy_install.install_exec s8t|ƒ‰g‰g‰i‰‡‡‡‡‡fdd„}t|ˆ|ƒg}ˆD]7}| ¡ d¡rU| d¡}|d}t |d¡d|d<tjj ˆg|¢RŽ}ˆ  |¡|  |¡t  ||¡q|  ˆ¡t  tj  ˆd¡t ˆ|¡¡dD]-} tƒ| r™tj  ˆd| d ¡} tj | ¡s™t| d ƒ} |  d   tƒ| ¡d ¡|  ¡qld S) z;Extract a bdist_wininst to the directories an egg would usecs| ¡}ˆD]l\}}| |¡rr||t|ƒd…}| d¡}tjjˆg|¢RŽ}| ¡}| d¡s6| d¡rTt  |d¡|d<dˆtj  |d¡d<ˆ  |¡|S| d¡rn|dkrndˆtj  |d¡d<ˆ  |¡|Sq| d ¡s~t   d |¡dS) Nú/ú.pydú.dlléÿÿÿÿr<rr¥úSCRIPTS/rAzWARNING: can't process %s)rêr­rrár;r<r%rnrÚ strip_moduleÚsplitextrñr rs)ÚsrcrŠrJÚoldÚnewÚpartsrl©rÖÚ native_libsÚprefixesÚ to_compileÚ top_levelr7r8Úprocesss(    ý ô z(easy_install.exe_to_egg..processrÜrÛrÞr¥r´)rêrçz.txtr+rON)r2rrêrnrárràr;r<r%rñÚ write_stubÚ byte_compileÚwrite_safety_flagÚ analyze_eggr¾r=r2rHr3) r¤rˆrÖrëÚstubsÚresråÚresourceÚpyfilerÚtxtrbr7rær8rÑs>     €   þ   €úzeasy_install.exe_to_eggc Csìt|ƒ}| ¡s J‚tj |j| ¡¡}tj |¡}|js!t |ƒtj  |¡r6tj  |¡s6t j ||jdntj |¡rG| tj|fd|¡z| |j|fdtj |¡tj |¡f¡Wt|ddnt|ddw| |¡| |¡S)Nrºr»zInstalling %s to %sFr¿)rÚ is_compatibler;r<r%rwrÏr¬r²r r³r§r rÁr=rrµÚinstall_as_eggrMrGrÆr[rq)r¤Ú wheel_pathrbÚwheelrÇr7r7r8r¨=s4   ý  þý  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)srOrÈ) rr†Ú_easy_install__mv_warningrwr¬rr»r<Ú_easy_install__id_warningrjroror¾) r¤ÚreqrÁÚwhatrÚegglocrroÚextrasr7r7r8rzks  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)NrO)r;r<rGr»rIÚ_easy_install__editable_msgr¾)r¤rr²rGÚpythonr7r7r8r®„s zeasy_install.report_editablec CsÚtj dt¡tj dt¡t|ƒ}|jdkr'd|jd}| dd|¡n |jdkr2| dd¡|jr;| dd ¡t   d |t |ƒdd…d   |¡¡zt ||ƒWdStyl}z td |jdfƒ|‚d}~ww) Nzdistutils.command.bdist_eggzdistutils.command.egg_inforÆrÚr<rrÍz-qz-nz Running %s %sú zSetup script exited with %s)r»ÚmodulesÚ setdefaultrrr«r rôr²r r±rr%rr¿rr})r¤r²r‰r}rÚr7r7r8r‰s.    ÿÿþ€ÿzeasy_install.run_setupc CsÊddg}tjdtj |¡d}zJ| tj |¡¡| |¡| |||¡t|gƒ}g}|D]}||D] }| |  |j |¡¡q4q.|sM|j sMt   d|¡|Wt|ƒt  |j¡St|ƒt  |j¡w)Nrz --dist-dirz egg-dist-tmp-)r…Údirz+No eggs found in %s (setup script problem?))r`rar;r<rGÚ_set_fetcher_optionsrñrr#r¦rjr²r rsr´rr ) r¤r²r‰r}Údist_dirÚall_eggsÚeggsr^rÁr7r7r8r¯Ÿs. ÿ   ÿ ÿÿzeasy_install.build_and_installc Csh|j d¡ ¡}d}i}| ¡D]\}}||vrq|d||<qt|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/)r{r™rzr~rƒr<)r/z setup.cfgN) rŸr¢ÚcopyrÒÚdictr;r<r%rÚ edit_config) r¤rYÚei_optsÚfetch_directivesÚ fetch_optionsr^r ÚsettingsÚ cfg_filenamer7r7r8r·s  z!easy_install._set_fetcher_optionscCsJ|jdurdS|j|jD]%}|js|j|jkrq t d|¡|j |¡|j|jvr2|j |j¡q |js]|j|jjvrDt d|¡nt d|¡|j  |¡|j|jvr]|j  |j¡|j rbdS|j  ¡|jdkrndSt j |jd¡}t j |¡rt  |¡t|dƒ}| |j |j¡d¡WdƒdS1sžwYdS)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ÚwtrO)r—r^rrjr r±ryróÚpathsrxrñr²Úsaver;r<r%rwr§rµr2rHÚ make_relative)r¤rÁr\r©rbr7r7r8rwÎs>    €þ        "ÿzeasy_install.update_pthcCst d||¡|S)NzUnpacking %s to %s)r Údebug)r¤rârŠr7r7r8r«÷szeasy_install.unpack_progresscshg‰g‰‡‡‡fdd„}t|||ƒˆ ˆ¡ˆjs0ˆD]}t |¡tjdBd@}t||ƒqdSdS)NcsZ| d¡r| d¡sˆ |¡n| d¡s| d¡rˆ |¡ˆ ||¡ˆj r+|p,dS)Nr¥ú EGG-INFO/rÝz.so)rnr­rñr«r²)rârŠ©r¤Úto_chmodrér7r8Úpfs    z+easy_install.unpack_and_compile..pfimií)rrír²r;ÚstatÚST_MODErŸ)r¤r¹rÇrrbr r7rr8rÄüs   ýzeasy_install.unpack_and_compilec Cs†tjrdSddlm}z0t |jd¡||dd|jd|jr3|||jd|jdWt |j¡dSWt |j¡dSt |j¡w)Nr)rír<)r~Úforcer²) r»Údont_write_bytecodeÚdistutils.utilrír rr r²r~)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|jsdSttj d¡ƒ}|j ¡D]\}}| |¡r.tj |¡s.|  d|¡t  |d¡qdS)zCreate directories under ~.Nú~zos.makedirs('%s', 0o700)iÀ) rqrr;r<rÙrærÒr­r³Ú debug_printr-)r¤Úhomerr<r7r7r8rBs €ýzeasy_install.create_home_pathrÅ)z2.3z2.4z2.5Ú real_prefixú site-packagesú dist-packagesz/$base/lib/python$py_version_short/site-packagesz $base/binrÖz*$base/local/lib/python$py_version_short/%sz$base/local/binz$base/lib/python3/%s)rÚ unix_localÚ posix_localÚ deb_systemz$base/Lib/site-packagesz $base/ScriptscGsø| d¡j}|js |jrP|jr|jdvrd}d|_n|js"dtjvr&tj}nd}| ¡}|j|d<|j   ||j ¡}|  ¡D]\}}t ||dƒdurOt|||ƒq=dd lm}|D]!}t ||ƒ}|dury|||ƒ}tjd krstj |¡}t|||ƒqXdS) NrØrÓr)r×r$r(rYr)rr)Úget_finalized_commandrær…r›r»Ú__dict__r;rr r r5ÚDEFAULT_SCHEMErÒrår r rr<rÙ)r¤r rærrur r rr7r7r8ríis2    €      €úzeasy_install._expand)T)Fr¦)r›r7)rù)QÚ__name__Ú __module__Ú __qualname__Ú__doc__Ú descriptionÚcommand_consumes_argumentsrr“Ú user_optionsÚboolean_optionsÚ negative_optrrõr¥r°r­Ú staticmethodrÃrÿrçr rèrérr'rròrPrQÚlstripr=r?r@r0r1rWr[r]r_Ú contextlibÚcontextmanagerrcr/rfrrir„rŒrUrSr’rrprqr¦r§rÑr¨rúrûrzrr®rr¯rrwr«rÄrírRr6rr»ror+Ú sitedir_namer r r,rír7r7r7r8r/nsâ :     - ôüò ;   !$ ÿ)    3 6.5 ÷  ÷ )â þþþþóþ r/cCs tj dd¡ tj¡}td|ƒS)Nr,rÈ)r;r4r5ráÚpathsepÚfilter)rÒr7r7r8Ú _pythonpath‡s r=c s¨g‰ˆ tƒ¡tjg}tjtjkr| tj¡|D]w}|sqtjdvr0ˆ tj  |dd¡¡n:tj dkr]ˆ tj  |ddtj dd…d ¡tj  |d d j tj Žd ¡tj  |d d ¡g¡n ˆ |tj  |d d¡g¡tjd krpqd|vruqtj d¡}|s~qtj  |dddj tj Žd¡}ˆ |¡qtdƒtdƒf}ˆ ‡fdd„|Dƒ¡tjr¯ˆ tj¡t t¡ˆ t ¡¡Wdƒn1sÆwYtttˆƒƒ‰ˆS)z& Return a list of 'site' dirs )Úos2emxÚriscosÚLibr%rÛz local/librNrÅr&Úlibz python{}.{}z site-pythonÚdarwinzPython.frameworkÚHOMEÚLibraryÚPythonr¸ÚpurelibÚplatlibc3s|] }|ˆvr|VqdSr¦r7rÚ©Úsitedirsr7r8rªËs€z get_site_dirs..)Úextendr=r»r…rÄrñrÉr;r<r%Úseprorºr¼r4r5rrrr“r8ÚsuppressÚAttributeErrorÚgetsitepackagesr«r¬r)rèr…r#Úhome_spÚ lib_pathsr7rHr8rïŒsl     ü üóþ   û   ÿrïccsèi}|D]l}t|ƒ}||vrqd||<tj |¡sqt |¡}||fV|D]I}| d¡s/q'|dvr4q'ttj ||¡ƒ}tt |ƒƒ}|  ¡|D]&}|  d¡rQqIt|  ¡ƒ}||vr\qId||<tj |¡sgqI|t |¡fVqIq'qdS)zBYield sys.path directories that might contain "old-style" packagesr<rA)r*rÚimportN) rr;r<r³r…rnr2r%r«rr3r­Úrstrip)ÚinputsÚseenrGrZrrbÚlinesÚliner7r7r8Ú expand_pathsØs@€        ôòôrWc CsTt|dƒ}zŸt |¡}|durW| ¡dS|d|d|d}|dkr-W| ¡dS| |d¡t d| d¡¡\}}}|dvrKW| ¡dS| |d|¡d d d œ}t  |¡}z| |¡} |   d d ¡d } |   t   ¡¡} | t | ¡¡WntjyŒYW| ¡dSw| d¡r—| d¡sžW| ¡dS|W| ¡S| ¡w)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Êr<z .egg-inforNrrAz -nspkg.pth)ÚPURELIBÚPLATLIBú\rQz%s/%s/rÈcSsg|] \}}| ¡|f‘qSr7)rê)r¨r^Úyr7r7r8rÛNrz$get_exe_prefixes..)r_ÚZipFileÚinfolistr©rárrnrôr%Úupperrcr™rrRrSr­rñr3ÚsortÚreverse)Ú exe_filenamerèrWr±rrår‹Úpthr7r7r8r2/s4      €r2c@sReZdZdZdZddd„Zdd„Zdd „Zed d „ƒZ d d „Z dd„Z dd„Z dS)r0z)A .pth file with Distribution paths in itFr7cCsl||_ttt|ƒƒ|_ttj |j¡ƒ|_|  ¡t   |gdd¡t |j ƒD] }tt|jt|dƒƒƒq&dS)NT)r©r«r¬rrIr;r<rGÚbasedirÚ_loadr#Ú__init__rrrxr")r¤r©rIr<r7r7r8rYsÿzPthDistributions.__init__cCsg|_d}t |j¡}tj |j¡ret|jdƒ}|D]F}|  d¡r$d}q|  ¡}|j  |¡|  ¡r9|  ¡  d¡r:qt tj |j|¡ƒ}|jd<tj |¡rS||vr\|j ¡d|_qd||<q| ¡|jrm|smd|_|jrˆ|jd  ¡sŒ|j ¡|jrŠ|jd  ¡rwdSdSdSdS)NFÚrtrQTú#rÞr<)rr ÚfromkeysrIr;r<rªr©r2r­rRrñrRrr%rr=ÚpopÚdirtyr3)r¤Ú saw_importrTrbrVr<r7r7r8r€bs6    ÿ    $ÿzPthDistributions._loadcCsÊ|jsdStt|j|jƒƒ}|rLt d|j¡| |¡}d  |¡d}t j   |j¡r0t   |j¡t|jdƒ }| |¡Wdƒn1sFwYnt j  |j¡r`t d|j¡t   |j¡d|_dS)z$Write changed .pth file back to diskNz Saving %srOrzDeleting empty %sF)r†r«r¬rrr rr©Ú _wrap_linesr%r;r<r§rµr2rHr=)r¤Ú rel_pathsrUÚdatarbr7r7r8rs"   ÿ€  zPthDistributions.savecCó|Sr¦r7)rUr7r7r8rˆ—szPthDistributions._wrap_linescCsN|j|jvo|j|jvp|jt ¡k}|r|j |j¡d|_t ||¡dS)z"Add `dist` to the distribution mapTN) rjrrIr;Úgetcwdrñr†r#rx)r¤rÁÚnew_pathr7r7r8rx›s   üzPthDistributions.addcCs<|j|jvr|j |j¡d|_|j|jvst ||¡dS)z'Remove `dist` from the distribution mapTN)rjrryr†r#rƒr7r7r8ry©s  þzPthDistributions.removecCs–tj t|ƒ¡\}}t|jƒ}|g}tjdkrdptj}t|ƒ|krI||jkr6| tj ¡|  ¡|  |¡Stj |¡\}}| |¡t|ƒ|ks"|S)NrÛ) r;r<rárrrÚaltseprKrñÚcurdirr|r%)r¤r<ÚnpathÚlastÚbaselenrårKr7r7r8r°s       úzPthDistributions.make_relativeN)r7) r-r.r/r0r†rr€rr6rˆrxryrr7r7r7r8r0Ts    r0c@s(eZdZedd„ƒZedƒZedƒZdS)ÚRewritePthDistributionsccs&|jV|D]}|Vq|jVdSr¦)ÚpreludeÚpostlude)ÚclsrUrVr7r7r8rˆÁs € z#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ˆrUr”r•r7r7r7r8r“Às   r“ÚSETUPTOOLS_SYS_PATH_TECHNIQUEÚrawÚrewritecCs 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 ržcCsX|tjtjfvrtjdkrt|tjƒ||ƒSt ¡\}}}|d|dd||ff‚)Nrrr<z %s %s) r;rµryrrŸrÚS_IWRITEr»r>)ÚfuncÚargÚexcÚetÚevrÌr7r7r8Ú auto_chmodæs  r¥cCs0t|ƒ}t|tjƒ|rt|ƒdSt|ƒ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)Ú dist_pathrÀÚnormalized_pathr7r7r8rÆï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. r<rÈ)rrr­r;rKrñ)r«ÚcacheÚresultÚ prefix_lenÚpÚnpr7r7r8Ú"_collect_zipimporter_cache_entriesAs   €r±cCs@t||ƒD]}||}||=|o|||ƒ}|dur|||<qdS)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±)r«r¬Úupdaterr¯Ú old_entryÚ new_entryr7r7r8Ú_update_zipimporter_cacheUs €òrµcCst||ƒdSr¦)rµ)r«r¬r7r7r8r¦ur:r¦cCódd„}t|tj|ddS)NcSs | ¡dSr¦)Úclear©r<r³r7r7r8Ú2clear_and_remove_cached_zip_archive_directory_datazs zf_remove_and_clear_zip_directory_cache_data..clear_and_remove_cached_zip_archive_directory_data©r²©rµr¶Ú_zip_directory_cache)r«r¹r7r7r8r©ys  þr©Ú__pypy__cCr¶)NcSs&| ¡t |¡| tj|¡|Sr¦)r·r¶r·Úupdater¼r¸r7r7r8Ú)replace_cached_zip_archive_directory_datas zT_replace_zip_directory_cache_data..replace_cached_zip_archive_directory_datarºr»)r«r¿r7r7r8r¨s   þr¨úc Cs,z t||dƒWdSttfyYdSw)z%Is this string a valid Python script?ÚexecFT)rÚ SyntaxErrorÚ TypeError)rTr©r7r7r8Ú is_python¢s ýÿrÄc Cshz&tj|dd }| d¡}Wdƒn 1swYW|dkSW|dkSttfy3|YSw)zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1)ÚencodingrÆNú#!)rhr2rcr.r/)rIÚfpÚmagicr7r7r8Úis_sh¬s ÿüþÿrÉcCs t |g¡S)z@Quote a command line argument according to Windows parsing rules©Ú subprocessÚ list2cmdline)r¡r7r7r8Ú nt_quote_arg¶s rÍcCsH| d¡s | d¡r dSt||ƒrdS| d¡r"d| ¡d ¡vSdS)zMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc. r¥ú.pywTrÆrrF)rnrÄr­Ú splitlinesrê)r”r©r7r7r8r‘»s  r‘)rŸcGr(r¦r7)r}r7r7r8Ú_chmodÍr)rÐc CsTt d||¡zt||ƒWdStjy)}z t d|¡WYd}~dSd}~ww)Nzchanging mode of %s to %ozchmod failed: %s)r rrÐr;Úerror)r<r rir7r7r8rŸÑs€ÿrŸc@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. cCr‹)zV Choose the best CommandSpec class based on environmental conditions. r7©r–r7r7r8rŽâszCommandSpec.bestcCstj tj¡}tj d|¡S)NÚ__PYVENV_LAUNCHER__)r;r<r?r»rIr4r5)r–Ú_defaultr7r7r8Ú_sys_executableészCommandSpec._sys_executablecCs:t||ƒr|St|tƒr||ƒS|dur| ¡S| |¡S)zg Construct a CommandSpec from a parameter to build_scripts, which may be None. N)r÷r«Úfrom_environmentÚ from_string)r–Úparamr7r7r8Ú from_paramîs   zCommandSpec.from_paramcCs|| ¡gƒSr¦)rÖrÓr7r7r8r×ýszCommandSpec.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Òr7r7r8rØszCommandSpec.from_stringcCs<t | |¡¡|_t |¡}t|ƒsdg|jdd…<dSdS)Nz-xr)rÛráÚ_extract_optionsÚoptionsrËrÌrN)r¤r”Úcmdliner7r7r8Úinstall_options s  ÿzCommandSpec.install_optionscCs:|d ¡d}tƒ |¡}|r| d¡pdnd}| ¡S)zH Extract any options from the first line of the script. rOrr<rÈ)rÏržÚmatchÚgrouprR)Ú orig_scriptÚfirstrârßr7r7r8rÞs  €zCommandSpec._extract_optionscCs| |t|jƒ¡Sr¦)Ú_renderr«rßr£r7r7r8Ú as_headerszCommandSpec.as_headercCs6d}|D]}| |¡r| |¡r|dd…Sq|S)Nz"'r<rÞ)r­rn)ÚitemÚ_QUOTESÚqr7r7r8Ú _strip_quotess €zCommandSpec._strip_quotescCs t dd„|Dƒ¡}d|dS)Ncss|] }t | ¡¡VqdSr¦)rÒrërR)r¨rèr7r7r8rª's€ ÿz&CommandSpec._render..rÆrOrÊ)rÒràr7r7r8ræ%s ÿ zCommandSpec._renderN)r-r.r/r0rßr rÜr—rŽrÖrÚr×rØrár6rÞrçrërær7r7r7r8rÒÙs,        rÒc@seZdZeddZdS)ÚWindowsCommandSpecF)rN)r-r.r/r rÜr7r7r7r8rì0srìc@sŠeZdZdZe d¡ ¡ZeZ e ddd„ƒZ e ddd„ƒZ e dd d „ƒZ ed d „ƒZe d d„ƒZe dd„ƒZe dd„ƒZe ddd„ƒZdS)rz` 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)()) NFcCs6t dt¡|r tnt ¡}| d||¡}| ||¡S)Nz Use get_argsrÈ)rrrsrtÚWindowsScriptWriterrrŽÚget_script_headerr)r–rÁrIÚwininstÚwriterÚheaderr7r7r8Úget_script_args_s  zScriptWriter.get_script_argscCs$tjdtdd|r d}| ||¡S)NzUse get_headerrÆ)Ú stacklevelrD)rrrsrtr“)r–r”rIrïr7r7r8rîgs ÿ zScriptWriter.get_script_headerc cs‚|dur | ¡}t| ¡ƒ}dD]-}|d}| |¡ ¡D]\}}| |¡|jtƒ}| ||||¡} | D]} | Vq7qqdS)z Yield write_script() argument tuples for a distribution's console_scripts and gui_scripts entry points. N©ÚconsoleÚguiÚ_scripts) r“rør}Ú get_entry_maprÒÚ_ensure_safe_nameÚtemplater¾Ú_get_script_args) r–rÁrñrÚtype_rãrÚepr”r}rñr7r7r8rps€   ÿüþzScriptWriter.get_argscCst d|¡}|r tdƒ‚dS)z? Prevent paths in *_scripts entry point names. z[\\/]z+Path separators not allowed in script namesN)rœÚsearchrü)rÚ has_path_sepr7r7r8rù‚s ÿzScriptWriter._ensure_safe_namecCs t dt¡|r t ¡S| ¡S©NzUse best)rrrsrtrírŽ)r–Ú force_windowsr7r7r8Ú get_writer‹s zScriptWriter.get_writercCs*tjdkstjdkrtjdkrt ¡S|S)zD Select the best ScriptWriter for this environment. Úwin32Újavar)r»rÉr;rÚ_namerírŽrÓr7r7r8rŽ‘szScriptWriter.bestccs|||fVdSr¦r7)r–rürrñr”r7r7r8rû›s€zScriptWriter._get_script_argsrÈcCs"|j ¡ |¡}| |¡| ¡S)z;Create a #! line, getting options (if any) from script_text)Úcommand_spec_classrŽrÚrárç)r–r”rIÚcmdr7r7r8r“ s zScriptWriter.get_header)NFr¦)rÈN)r-r.r/r0rPrQr7rúrÒrr—ròrîrr6rùrrŽrûr“r7r7r7r8r4s,!ß#       rc@sLeZdZeZedd„ƒZedd„ƒZedd„ƒZedd„ƒZ e d d „ƒZ d S) rícCst dt¡| ¡Sr)rrrsrtrŽrÓr7r7r8r«s zWindowsScriptWriter.get_writercCs"tt|d}tj dd¡}||S)zC Select the best ScriptWriter suitable for Windows )rIÚnaturalÚSETUPTOOLS_LAUNCHERrI)r ÚWindowsExecutableLauncherWriterr;r4r5)r–Ú writer_lookupÚlauncherr7r7r8rޱs þzWindowsScriptWriter.bestc #s’tddd|}|tjd ¡ d¡vr$djd itƒ¤Ž}t |t ¡gd¢}|  |¡|  ||¡}‡fdd „|Dƒ}ˆ|||d |fVd S) z For Windows, add a .py extensionú.pyarÎrôÚPATHEXTú;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.)r r¥ú -script.pyú.pycú.pyorÎr£cóg|]}ˆ|‘qSr7r7rœ©rr7r8rÛËrÝz8WindowsScriptWriter._get_script_args..r›Nr7) r r;r4rêrárºr¾rrrsÚ UserWarningryÚ_adjust_header) r–rürrñr”Úextrrãr®r7rr8rû¾s€ýý   z$WindowsScriptWriter._get_script_argscCsNd}d}|dkr ||}}t t |¡tj¡}|j||d}| |¡r%|S|S)z† Make sure 'pythonw' is used for gui and 'python' is used for console (regardless of what sys.executable is). rCrDrö)rÝÚrepl)rœrÚescapeÚ IGNORECASEÚsubÚ _use_header)r–rüÚ orig_headerr›rÚ pattern_obÚ new_headerr7r7r8rÎs z"WindowsScriptWriter._adjust_headercCs$|dd… d¡}tjdkpt|ƒ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Þú"r)rRr»rÉr)rÚ clean_headerr7r7r8rÜs zWindowsScriptWriter._use_headerN) r-r.r/rìrr—rrŽrûrr6rr7r7r7r8rí¨s     ríc@seZdZedd„ƒZdS)r c #s˜|dkr d}d}dg}nd}d}gd¢}| ||¡}‡fdd„|Dƒ} ˆ|||d | fVˆd t|ƒd fVtƒsJˆd } | tˆƒd fVd Sd S)zG For Windows, add a .py extension and an .exe launcher röz -script.pywrÎÚclir)r¥rrcrr7r7rœrr7r8rÛørÝzDWindowsExecutableLauncherWriter._get_script_args..r›r£rcz .exe.manifestN)rÚget_win_launcherr9Úload_launcher_manifest) r–rürrñr”Ú launcher_typerrãÚhdrr®Úm_namer7rr8rûês$€  þùz0WindowsExecutableLauncherWriter._get_script_argsN)r-r.r/r—rûr7r7r7r8r ésr cCsJd|}tƒrtƒdkr| dd¡}n | 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-arm64Ú.z-arm64.z-64.z-32.r¹)r9rrSr)ÚtypeÚ launcher_fnr7r7r8r# s   r#cCst td¡}| d¡tƒS)Nzlauncher manifest.xmlr˜)Ú pkg_resourcesrr-r™Úvars)rÚmanifestr7r7r8r$ s r$FcCst |||¡Sr¦)r†r´)r<Ú ignore_errorsÚonerrorr7r7r8r´% r:r´cCst d¡}t |¡|S)Né)r;Úumask)Útmpr7r7r8rž) s  ržc@seZdZdZdS)rtzF Warning for EasyInstall deprecations, bypassing suppression. N)r-r.r/r0r7r7r7r8rt/ srtr¦)rÀ)|r0rr rrrÚdistutils.errorsrrrr Údistutils.command.installr r rr r Údistutils.command.build_scriptsrrJrr»r;r¶r†r`r_rœrr"rPrrrr5r8rËrÛrhrdrërrr¹rrÚsetuptools.sandboxrÚsetuptools.commandrÚsetuptools.archive_utilrÚsetuptools.package_indexrrrrrÚsetuptools.wheelrr+rrrr r!r"r#r$r%r&r'r(r)r*r+ÚfilterwarningsÚ PEP440WarningÚ__all__r9r.rKrNrUr/r=rïrWr1r2r0r“r4r5ržr¥rÆr±rµr¦r©Úbuiltin_module_namesr¨rÄrÉrÍr‘rŸrÐÚ ImportErrorr«rÒrÖÚsys_executablerìrrír ròrîr#r$r´ržrtr7r7r7r8ÚsÆ         D#L.)%l  R   ÿ    þTtA