U âQabUã@s4dZddlmZddlmZddlmZmZddlmZmZm 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&m'Z'm(Z(dd l)m*Z*dd l+m,Z,ddl-m.Z.m/Z/ddl)m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:m;Z;mZ>ddl?m@Z@ddlAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPdd lQZAeRZSejTdeAjUdddddddgZVd d!„ZWd"d„ZXe,jYrBd#d$„ZZd%d&„Z[nd'd$„ZZd(d&„Z[d)d*„Z\Gd+d„de0ƒZ]d,d-„Z^d.d/„Z_d0d1„Z`d2d„Zad3d„ZbGd4d„deHƒZcGd5d6„d6ecƒZdeje fd7d8¡d9krÊedZcd:d;„Zgdd?„Zid@dA„ZjdsdBdC„ZkdDdE„ZldFdG„ZmdHejnkremZondIdJ„ZodtdLdM„ZpdNdO„ZqdPdQ„ZrdRdS„ZszddTlmtZuWnevk rndUdV„ZuYnXdWdX„ZtGdYdZ„dZewƒZxex y¡ZzGd[d\„d\exƒZ{Gd]d^„d^ƒZ|Gd_d`„d`e|ƒZ}Gdadb„dbe}ƒZ~e|jZe|j€Z€dcdd„Zdedf„Z‚dgehfdhdi„Zƒdjdk„Z„dldm„Z…dudnd„Z†e"j‡dodp„ƒZˆGdqdr„dre*ƒZ‰d S)va% 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.readthedocs.io/en/latest/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)Úsix)Ú configparserÚmap)ÚCommand)Ú run_setup)Ú rmtree_safe)Ú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ÚmainÚget_exe_prefixescCst d¡dkS)NÚPé)ÚstructÚcalcsize©r<r<úC/usr/lib/python3.8/site-packages/setuptools/command/easy_install.pyÚis_64bitOsr>cCsjtj |¡otj |¡}ttjdƒo&|}|r:tj ||¡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. r2)ÚosÚpathÚexistsÚhasattrr2ÚnormpathÚnormcase)Zp1Zp2Z both_existZ use_samefileZnorm_p1Znorm_p2r<r<r=r2SscCs|S©Nr<©Úsr<r<r=Ú _to_bytesesrHcCs.zt |d¡WdStk r(YdSXdS©NÚasciiTF)rZ text_typeÚ UnicodeErrorrFr<r<r=Úisasciihs  rLcCs | d¡S)NÚutf8)ÚencoderFr<r<r=rHpscCs,z| d¡WdStk r&YdSXdSrI)rNrKrFr<r<r=rLss  cCst |¡ ¡ dd¡S)NÚ z; )ÚtextwrapÚdedentÚstripÚreplace)Útextr<r<r=Ú{órUc@s°eZdZdZdZdZdddddd d d d d dddddddddddgZdddddddd d!g Zej r‚d"ej Z e  d#d$e f¡e  d#¡d%diZ eZd&d'„Zd(d)„Zd*d+„Zed,d-„ƒZd.d/„Zd0d1„Zd2d3„Zd4d5„Zd6d7„Zd8d9„Zd:d;„Zdd?„Ze d@¡  ¡Z!e dA¡  ¡Z"e dB¡  ¡Z#dCdD„Z$dEdF„Z%dGdH„Z&dIdJ„Z'dKdL„Z(dMdN„Z)e*j+dOdP„ƒZ,d™dRdS„Z-dšdTdU„Z.dVdW„Z/d›dXdY„Z0dZd[„Z1d\d]„Z2d^d_„Z3dœd`da„Z4edbdc„ƒZ5ddfdg„Z6dhdi„Z7djdk„Z8dldm„Z9dndo„Z:dpdq„Z;drds„Zdždwdx„Z?e dy¡  ¡Z@dzd{„ZAd|d}„ZBd~d„ZCd€d„ZDd‚dƒ„ZEd„d…„ZFd†d‡„ZGdˆd‰„ZHe dŠ¡  ¡ZId‹dŒ„ZJddŽ„ZKdd„ZLeMeMd‘d’d“d”ZNeMd•d–d“ZOd—d˜„ZPd$S)Ÿr3z'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=rGzinstall 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 installedrWrYr^r[r`rirkrnrpz!install in user site-package '%s'ÚuserNrfcCs,d|_d|_|_d|_|_|_d|_d|_d|_d|_ d|_ |_ d|_ |_ |_d|_|_|_d|_|_|_d|_d|_d|_d|_d|_d|_d|_d|_d|_tjrÌtj |_!tj"|_#n d|_!d|_#d|_$d|_%d|_&|_'d|_(i|_)d|_*d|_+|j,j-|_-|j, .||j, /d¡¡dS)NrFr3)0rqÚzip_okÚlocal_snapshots_okÚ install_dirÚ script_dirÚexclude_scriptsÚ index_urlÚ find_linksÚbuild_directoryÚargsÚoptimizeÚrecordr[Ú always_copyÚ multi_versionriÚno_depsÚ allow_hostsÚrootÚprefixÚ no_reportrpÚ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Úsitepy_installedZ_dry_runÚ distributionÚverboseZ_set_command_optionsÚget_option_dict©Úselfr<r<r=Úinitialize_options®sJ      ÿzeasy_install.initialize_optionscCs"dd„|Dƒ}tt|j|ƒƒdS)Ncss*|]"}tj |¡stj |¡r|VqdSrE)r?r@rAÚislink)Ú.0Úfilenamer<r<r=Ú ßs ÿz/easy_install.delete_blockers..)ÚlistrÚ _delete_path)rÚblockersZextant_blockersr<r<r=Údelete_blockersÞsÿzeasy_install.delete_blockerscCsJt d|¡|jrdStj |¡o.tj |¡ }|r8tntj}||ƒdS)Nz Deleting %s) r ÚinfoÚdry_runr?r@ÚisdirrŸÚrmtreeÚunlink)rr@Zis_treeZremoverr<r<r=r¤ås  zeasy_install._delete_pathcCs4djtjŽ}tdƒ}d}t|jftƒŽƒ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Útmplr<r<r=Ú_render_versionîs  zeasy_install._render_versionc Csh|jo | ¡tj ¡d}tddƒ\}}|j ¡|j ¡|j ¡||dd…|d|d||||t tddƒdœ |_ t j r”|j |j d <|j|j d <| ¡| ¡| ¡| d d d d¡|jdkrÎ|j|_|jdkrÞd|_| dd¡| dd¡|jr|jr|j|_|j|_| dd¡tttjƒ}tƒ|_|jdk r¬dd„|j d¡Dƒ}|D]N}t j !|¡s|t" #d|¡n,t|ƒ|kr˜t$|dƒ‚n|j %t|ƒ¡q\|j&s¼| '¡|j(pÆd|_(|jdd…|_)|jt|jƒfD] }||j)krê|j) *d|¡qê|j+dk r0dd„|j+ d¡Dƒ}ndg}|j,dkrX|j-|j(|j)|d|_,t.|j)tjƒ|_/|j0dk r”t1|j0t2j3ƒrš|j0 ¡|_0ng|_0|j4r¶|j, 5|j)tj¡|jsÌ|j, 6|j0¡| dd¡t1|j7t8ƒs6z0t8|j7ƒ|_7d|j7krdksnt9‚Wnt9k r4t$d ƒ‚YnX|j&rN|j:sNt;d!ƒ‚|j<s^t;d"ƒ‚g|_=dS)#Nrr‚Ú exec_prefixééÚabiflagsÚ) Z dist_nameZ dist_versionZ dist_fullnameÚ py_versionZpy_version_shortZpy_version_nodotZ sys_prefixr‚Zsys_exec_prefixr·rºÚuserbaseZusersitertruryr–Fr‡)rtrtrˆ©rtruÚinstall)r|r|cSsg|]}tj | ¡¡‘qSr<)r?r@Ú expanduserrR©r rGr<r<r=Ú 8sz1easy_install.finalize_options..ú,z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.pathzhttps://pypi.org/simple/cSsg|] }| ¡‘qSr<)rRrÁr<r<r=rÂNsÚ*)Z 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))>rpr¶r¯Úsplitrr™Zget_nameZ get_versionZ get_fullnameÚgetattrÚ config_varsrŒrrr‘Ú_fix_install_dir_for_user_siteÚexpand_basedirsÚ expand_dirsÚ_expandrurtr’Zset_undefined_optionsrqr„rˆrr"r@Ú get_site_dirsÚ all_site_dirsr–r?r©r ÚwarnrÚappendriÚcheck_site_dirrwÚ shadow_pathÚinsertr€r“Ú create_indexr'Ú local_indexrxÚ isinstancerZ string_typesrsZscan_egg_linksÚadd_find_linksr{ÚintÚ ValueErrorryrrzÚoutputs) rr¼r‚r·rCr–r]Z path_itemrÅr<r<r=Úfinalize_optionsùsÆ  ô  þ  ÿÿ    þÿ   ÿ   ÿÿzeasy_install.finalize_optionscCs\|jr tjsdS| ¡|jdkr.d}t|ƒ‚|j|_|_tj   dd¡d}|  |¡dS)z; Fix the install_dir if "--user" was used. Nz$User base directory is not specifiedÚposixZunixZ_user) rqrŒrÚcreate_home_pathrr rŠr‹r?ÚnamerSÚ select_scheme)rÚmsgZ scheme_namer<r<r=rÉss  z+easy_install._fix_install_dir_for_user_sitecCsX|D]N}t||ƒ}|dk rtjdks.tjdkr:tj |¡}t||jƒ}t|||ƒqdS)NrÜÚnt)rÇr?rÞr@rÀrrÈÚsetattr)rÚattrsÚattrÚvalr<r<r=Ú _expand_attrs‚s   zeasy_install._expand_attrscCs| dddg¡dS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.rŠr‹rN©rærœr<r<r=rÊ‹szeasy_install.expand_basedirscCsddddddg}| |¡dS)z+Calls `os.path.expanduser` on install dirs.r„r…r‡r†rˆr‰Nrç)rÚdirsr<r<r=rËsúzeasy_install.expand_dirsc CsÂ|j|jjkrt |j¡z’|jD]}| ||j ¡q"|jr¢|j}|j rzt |j ƒ}t t |ƒƒD]}|||d…||<q`ddl m }| |j|j|fd|j¡| ¡W5t |jj¡XdS)Nr)Ú file_utilz'writing list of installed files to '%s')ršr™r Ú set_verbosityrzr3rr|rÚrÚlenÚrangeÚ distutilsréÚexecuteZ write_fileÚwarn_deprecated_options)rÚspecrÚZroot_lenZcounterrér<r<r=Úrunœs*    ÿþ zeasy_install.runcCsDz t ¡}Wn"tk r.t dtj¡}YnXtj |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@Újoinrt)rÚpidr<r<r=Úpseudo_tempname³s  zeasy_install.pseudo_tempnamecCsdSrEr<rœr<r<r=rï¾sz$easy_install.warn_deprecated_optionsc CsZt|jƒ}tj |d¡}tj |¡sTzt |¡Wn ttfk rR|  ¡YnX||j k}|sr|j sr|  ¡}nd|  ¡d}tj |¡}z*|ršt |¡t|dƒ ¡t |¡Wn ttfk rÔ|  ¡YnX|sì|j sìt| ¡ƒ‚|r|jdkrt||j ƒ|_nd|_|tttƒƒkr.d|_n"|j rPtj |¡sPd|_d|_||_dS)z;Verify that self.install_dir is .pth-capable dir, if neededúeasy-install.pthz .write-testÚwNT)r"rtr?r@rörAÚmakedirsÚOSErrorÚIOErrorÚcant_write_to_targetrÎr~Úcheck_pth_processingrør«ÚopenÚcloserÚno_default_version_msgr”r4rÚ _pythonpathr˜)rÚinstdirr”Z is_site_dirZtestfileZ test_existsr<r<r=rÑÁ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.readthedocs.io/en/latest/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érO) Ú_easy_install__cant_write_msgr¯Úexc_infortr?r@rAÚ_easy_install__not_exists_idÚ_easy_install__access_msgr)rràr<r<r=rþs z!easy_install.cant_write_to_targetc Csª|j}t d|¡| ¡d}|d}tj |¡}tdƒd}z8|rNt |¡tj  |¡}t j j |ddt |dƒ}Wn ttfk r–| ¡YnüXz¸| |jftƒŽ¡| ¡d }tj}tjd krtj |¡\}} tj |d ¡} |  ¡d kotj | ¡} | r| }d dlm} | |dddgd ƒtj |¡rNt d|¡W¢dSW5|r`| ¡tj |¡rxt |¡tj |¡rt |¡X|js¦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() 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 filesF)rtr r§rør?r@rAÚ _one_linerr«ÚdirnameÚ pkg_resourcesZ py31compatrûrrürýrþrÚwriter®r²r¯Ú executablerÞrÆröÚlowerÚdistutils.spawnrr~rÏ) rrr”Zok_fileZ ok_existsrµrrcrÚbasenameZaltZuse_altrr<r<r=rÿs\   û    þ þ    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)rvZmetadata_isdirZmetadata_listdirÚinstall_scriptZ get_metadataÚinstall_wrapper_scripts)rr´Ú script_namer<r<r=Úinstall_egg_scriptsYs þz easy_install.install_egg_scriptscCsTtj |¡rDt |¡D]*\}}}|D]}|j tj ||¡¡q$qn |j |¡dSrE)r?r@r©ÚwalkrÚrÐrö)rr@ÚbaserèÚfilesr¡r<r<r=Ú add_outputgs  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).)rir©rrðr<r<r=Ú not_editableos þÿ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)rir?r@rAröryÚkeyrr!r<r<r=Úcheck_editablews ÿÿzeasy_install.check_editablec cs:tjdd}zt|ƒVW5tj |¡o2tt|ƒƒXdS)Nz easy_install-)r‚)ÚtempfileÚmkdtempr?r@rArªrÚstr)rÚtmpdirr<r<r=Ú_tmpdirs zeasy_install._tmpdirFc CsH|js| ¡| ¡&}t|tƒsžt|ƒrb| |¡|j ||¡}|  d|||d¡W5QR£St j   |¡r–| |¡|  d|||d¡W5QR£St |ƒ}| |¡|j |||j|j|j |j¡}|dkrðd|}|jræ|d7}t|ƒ‚nJ|jtkr| |||d¡|W5QR£S|  ||j||¡W5QR£SW5QRXdS)NTz+Could not find suitable distribution for %rz2 (--always-copy skips system and development eggs)ÚUsing)riÚinstall_site_pyr)rÖr(rr"r“ÚdownloadÚ install_itemr?r@rArr$Zfetch_distributionr[r}rÕrZ precedencer/Úprocess_distributionÚlocation)rrðÚdepsr(Údlr´ràr<r<r=r3Šs<      þ  zeasy_install.easy_installcCs |p|j}|ptj |¡|k}|p,| d¡ }|pT|jdk oTtj t|ƒ¡t|jƒk}|r‚|s‚|j|jD]}|j |krjq‚qjd}t   dtj  |¡¡|rÂ|  |||¡}|D]}| |||¡q¬n | |¡g}| ||d|d¡|dk r|D]}||krð|SqðdS)Nú.eggTz Processing %srr*)r}r?r@rÚendswithr•r"rÕÚ project_namer/r r§rÚ install_eggsr.Úegg_distribution)rrðr,r(r0Zinstall_neededr´Zdistsr<r<r=r-®s2  ÿþ   zeasy_install.install_itemcCs<t|}tD]*}d|}t||ƒdkr t||||ƒq dS)z=Sets the install directories by applying the install schemes.Zinstall_N)r r rÇrâ)rrÞÚschemer#Úattrnamer<r<r=rßÒs zeasy_install.select_schemec Gs´| |¡|j |¡||j|jkr2|j |¡|j |¡| |¡||j|j<t  |j ||f|žŽ¡|  d¡rŽ|j sŽ|j  | d¡¡|sœ|jsœdS|dk rÀ|j|jkrÀt d|¡dS|dksÐ||krä| ¡}tt|ƒƒ}t  d|¡ztgƒ |g|j|j¡}Wn^tk r<}ztt|ƒƒ‚W5d}~XYn0tk rj}zt| ¡ƒ‚W5d}~XYnX|js||jr¤|D]"}|j|jkr€| | ¡¡q€t  d|¡dS)Nzdependency_links.txtzSkipping dependencies for %szProcessing dependencies for %sz'Finished processing dependencies for %s)Ú update_pthr“ÚaddrÕr#Úremoverr—r r§Úinstallation_reportÚ has_metadatar’r×Zget_metadata_linesr}rÏÚas_requirementr(r'r,Zresolver3r-rr.Zreportr•)rZ requirementr´r0r§ZdistreqZdistrosrjr<r<r=r.ÛsL       ÿÿ    ÿz!easy_install.process_distributioncCs2|jdk r|j S| d¡r dS| d¡s.dSdS)Nz not-zip-safeTzzip-safeF)rrr=©rr´r<r<r=Ú should_unzips   zeasy_install.should_unzipcCs¶tj |j|j¡}tj |¡r:d}t ||j|j|¡|Stj |¡rL|}nRtj  |¡|krft  |¡t  |¡}t |ƒdkržtj ||d¡}tj |¡rž|}t |ƒt ||¡|S)Nz<%r already exists in %s; build directory %s will not be keptrr)r?r@röryr#rAr rÏr©rr«Úlistdirrër$ÚshutilÚmove)rrðÚ dist_filenameÚ setup_baseÚdstràÚcontentsr<r<r=Ú maybe_move s$ ÿ      zeasy_install.maybe_movecCs,|jr dSt ¡ |¡D]}|j|ŽqdSrE)rvÚ ScriptWriterÚbestÚget_argsÚ write_script)rr´rzr<r<r=r"sz$easy_install.install_wrapper_scriptscCsNt| ¡ƒ}t||ƒ}|r8| |¡tƒ}t |¡|}| |t|ƒd¡dS)z/Generate a legacy script wrapper and install itrdN) r'r>Úis_python_scriptÚ_load_templater²rIÚ get_headerrLrH)rr´rÚ script_textÚdev_pathrðZ is_scriptZbodyr<r<r=r(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)rQrÞZ raw_bytesr<r<r=rN2s   zeasy_install._load_templateÚtr<c s¦ˆ ‡fdd„|Dƒ¡t d|ˆj¡tj ˆj|¡}ˆ |¡ˆjrLdSt ƒ}t |ƒtj  |¡rpt  |¡t |d|ƒ}| |¡W5QRXt|d|ƒdS)z1Write an executable file to the scripts directorycsg|]}tj ˆj|¡‘qSr<)r?r@röru©r r_rœr<r=rÂDsz-easy_install.write_script..zInstalling %s script to %sNrúiÿ)r¦r r§rur?r@rör r¨Ú current_umaskr$rAr«rrÚchmod)rrrGÚmoder¥ÚtargetÚmaskrcr<rœr=rLAsÿ   zeasy_install.write_scriptcCs^| ¡ d¡r| ||¡gS| ¡ d¡r8| ||¡gS| ¡ d¡rT| ||¡gS|}tj |¡r~| d¡s~t|||j ƒntj  |¡r–tj  |¡}|  |¡r¼|j r¼|dk r¼| |||¡}tj |d¡}tj |¡s0ttj |dd¡ƒ}|stdtj  |¡ƒ‚t|ƒdkr(td tj  |¡ƒ‚|d }|jrNt | ||¡¡gS| ||¡SdS) Nr2ú.exez.whlú.pyzsetup.pyrÄz"Couldn't find a setup script in %srzMultiple setup scripts in %sr)rr3Ú install_eggÚ install_exeÚ install_wheelr?r@ÚisfilerÚunpack_progressr©ÚabspathÚ startswithryrHrörArrrërir r§Úreport_editableÚbuild_and_install)rrðrDr(rEÚ setup_scriptZsetupsr<r<r=r5UsJ   ÿÿ ÿÿ ÿÿzeasy_install.install_eggscCs>tj |¡r"t|tj |d¡ƒ}ntt |¡ƒ}tj ||dS)NúEGG-INFO)Úmetadata) r?r@r©r*rör+Ú zipimportÚ zipimporterr)Z from_filename)rÚegg_pathrhr<r<r=r6s   ÿzeasy_install.egg_distributionc CsŽtj |jtj |¡¡}tj |¡}|js2t|ƒ| |¡}t ||ƒsztj  |¡rrtj  |¡srt j ||jdn"tj |¡r”| tj|fd|¡zÀd}tj  |¡rÌ| |¡r¾tjd}}n tjd}}nL| |¡rî| |¡|jd}}n*d}| |¡r tjd}}n tjd}}| |||f|dtj |¡tj |¡f¡t||d Wn$tk rxt|dd ‚YnX| |¡| |¡S) N©r¨ú Removing FZMovingZCopyingZ ExtractingTz %s to %s©Úfix_zipimporter_caches)r?r@rörtrrbr¨r$r6r2r©rŸr Ú remove_treerArîr«rcrBrCZcopytreer@ZmkpathÚunpack_and_compileZcopy2rÚupdate_dist_cachesrór )rrkr(Ú destinationr´Znew_dist_is_zippedrcrZr<r<r=r]‰s^ þ    ý        þýþ   zeasy_install.install_eggc sPt|ƒ}|dkrtd|ƒ‚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 .exerhrÞrp)r4rpÚplatformr2z.tmprgúPKG-INFOrúzMetadata-Version: 1.0 Útarget_versionz%s: %s Ú_ú-rcsg|]}tj ˆ|d¡‘qS)r)r?r@rö)r rz©rur<r=rÂásÿz,easy_install.install_exe..)ršr¨)r5rr)Úgetrr?r@röÚegg_namer/r$r*Z _providerÚ exe_to_eggrArrÚitemsrSÚtitlerr¦rIrKrZ make_zipfileršr¨r]) rrDr(Úcfgr´rkÚegg_tmpZ _egg_infoZpkg_infrcÚkÚvr<ryr=r^¿sJÿ  ý     þÿzeasy_install.install_exec s6t|ƒ‰g‰g‰i‰‡‡‡‡‡fdd„}t|ˆ|ƒg}ˆD]l}| ¡ d¡r<| d¡}|d}t |d¡d|d<tjj ˆf|žŽ}ˆ  |¡|  |¡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ˆf|žŽ}| ¡}| d¡sj| 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éÿÿÿÿrrr\úSCRIPTS/r zWARNING: can't process %s)rrcrërÆr?r@rör3rÚ strip_moduleÚsplitextrÐr rÏ)ÚsrcrFrGÚoldÚnewÚpartsr1©r€Ú native_libsÚprefixesÚ to_compileÚ top_levelr<r=Úprocessôs$        z(easy_install.exe_to_egg..processr„rƒr†r\rg)r’rz.txtrúrON)r7rrr3rÆrrˆr?r@rörÐZ write_stubÚ byte_compileZwrite_safety_flagZ analyze_eggr²rArrr) rrDr€r“ZstubsÚresrÚresourceZpyfilerÞZtxtrcr<rŽr=r|ìs8       þ   zeasy_install.exe_to_eggc CsÔt|ƒ}tj |j| ¡¡}tj |¡}|js6t|ƒtj  |¡r`tj  |¡s`t j ||jdn"tj  |¡r‚| tj|fd|¡z.| |j|fdtj |¡tj |¡f¡W5t|ddX| |¡| |¡S)NrlrmFrnzInstalling %s to %s)r r?r@rörtr{rbr¨r$r©rŸr rprArîr«rrZinstall_as_eggrrr r6)rZ wheel_pathr(Zwheelrsr<r<r=r_!s2  ý  þý  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ƒkr>|d|j7}|j }|j }|j }d}|t ƒS)z9Helpful installation message for display to package usersz %(what)s %(eggloc)s%(extras)srOr») r~rƒÚ_easy_install__mv_warningrtrr"r¯r@Ú_easy_install__id_warningr/r4rpr²) rZreqr´ZwhatràZegglocrÞrpZextrasr<r<r=r<Os 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@rr¯rÚ_easy_install__editable_msgr²)rrðrfrÚpythonr<r<r=rdhs zeasy_install.report_editablec Csätj dt¡tj dt¡t|ƒ}|jdkrNd|jd}| dd|¡n|jdkrd| dd¡|jrv| dd ¡t   d |t |ƒdd…d   |¡¡zt ||ƒWn6tk rÞ}ztd |jdfƒ‚W5d}~XYnXdS) Nzdistutils.command.bdist_eggzdistutils.command.egg_infor¹r‚rrrxú-qz-nz Running %s %sú zSetup script exited with %s)r¯ÚmodulesÚ setdefaultrrr£ršrÓr¨r r§rërörr³rrz)rrfrErzr‚r<r<r=rms&    ÿzeasy_install.run_setupc Cs¼ddg}tjdtj |¡d}z‚|  tj |¡¡|  |¡|  |||¡t |gƒ}g}|D]&}||D]}|  |  |j|¡¡qhq\|sš|jsšt d|¡|W¢St|ƒt |j¡XdS)Nrz --dist-dirz egg-dist-tmp-)r‚Údirz+No eggs found in %s (setup script problem?))r%r&r?r@rrªr rêršÚ_set_fetcher_optionsrÐrr'r]r/r¨rÏ) rrfrErzZdist_dirZall_eggsZeggsr#r´r<r<r=res* ÿ    ÿzeasy_install.build_and_installc Csp|j d¡ ¡}d}i}| ¡D]&\}}||kr2q |d|| dd¡<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. r3)rxr–rwr{r€rrwrx)r3z setup.cfgN) r™r›Úcopyr}rSÚdictr?r@rörZ edit_config) rrZei_optsZfetch_directivesZ fetch_optionsr#råZsettingsZ cfg_filenamer<r<r=r¡™s  z!easy_install._set_fetcher_optionscCs*|jdkrdS|j|jD]H}|js0|j|jkrt d|¡|j |¡|j|jkr|j |j¡q|js¸|j|jjkr†t d|¡n2t d|¡|j  |¡|j|jkr¸|j  |j¡|j s&|j  ¡|jdkr&t j |jd¡}t j |¡rüt  |¡t|dƒ}| |j |j¡d¡| ¡dS)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#r~r/r r§r;rÒÚpathsr:rÐr¨Úsaver?r@rörtrŸr«rrÚ make_relativer)rr´r]r¡rcr<r<r=r9°s6    þ        zeasy_install.update_pthcCst d||¡|S)NzUnpacking %s to %s)r Údebug)rrŠrFr<r<r=raÕszeasy_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)Nr\ú EGG-INFO/r…z.so)r3rcrÐrar¨)rŠrF©rZto_chmodr‘r<r=ÚpfÞs    z+easy_install.unpack_and_compile..pfimií)rr”r¨r?ÚstatÚST_MODErW)rrkrsr¬rcrXr<r«r=rqÚs  zeasy_install.unpack_and_compilec Csjtjr dSddlm}z@t |jd¡||dd|jd|jrT|||jd|jdW5t |j¡XdS)Nr)r”r)r{Úforcer¨) r¯Údont_write_bytecodeÚdistutils.utilr”r rêršr¨r{)rr‘r”r<r<r=r”í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.readthedocs.io/en/latest/easy_install.html#custom-installation-locations Please make the appropriate changes for your system and try again.cCs|j}||jtj dd¡fS©NZ PYTHONPATHr»)Ú_easy_install__no_default_msgrtr?Úenvironrz)rÚtemplater<r<r=rsz#easy_install.no_default_version_msgc CsÞ|jr dStj |jd¡}tddƒ}| d¡}d}tj |¡r€t  d|j¡t   |¡}|  ¡}W5QRX|  d¡s€td |ƒ‚||krÔt d |¡|jsÈt|ƒt j |d dd }| |¡W5QRX| |g¡d |_dS)z8Make sure there's a site.py in the target dir, if neededNzsite.pyr­z site-patch.pyrRr»zChecking existing site.py in %sz def __boot():z;%s is not a setuptools-generated site.py; please remove it.z Creating %srú©ÚencodingT)r˜r?r@rörtr#rSrAr r©ÚiorÚreadrcrr§r¨r$rr”)rZsitepyÚsourceZcurrentZstrmr<r<r=r+#s0     ÿÿ  zeasy_install.install_site_pycCsd|js dSttj d¡ƒ}t |j¡D]8\}}| |¡r&tj  |¡s&|  d|¡t  |d¡q&dS)zCreate directories under ~.Nú~zos.makedirs('%s', 0o700)iÀ) rqrr?r@rÀrZ iteritemsrÈrcr©Z debug_printrû)rÚhomerÞr@r<r<r=rÝCszeasy_install.create_home_pathz/$base/lib/python$py_version_short/site-packagesz $base/binr¾©rÜz$base/Lib/site-packagesz $base/ScriptscGs¼| d¡j}|jrd| ¡}|j|d<|j tj|j¡}|  ¡D]$\}}t ||dƒdkr>t |||ƒq>ddl m }|D]B}t ||ƒ}|dk rt|||ƒ}tjdkrªtj |¡}t |||ƒqtdS)Nr¿rr)rrÜ)Zget_finalized_commandrÈr‚r¢r rzr?rÞÚDEFAULT_SCHEMEr}rÇrâr±rr@rÀ)rrãrÈr7rärårr<r<r=rÌYs        zeasy_install._expand)F)F)T)N)rTr<)r—)QÚ__name__Ú __module__Ú __qualname__Ú__doc__Ú descriptionZcommand_consumes_argumentsZ user_optionsZboolean_optionsrŒrrZhelp_msgrÐZ negative_optrrÔržr¦r¤Ú staticmethodr¶rÛrÉrærÊrËrñrørïrÑrPrQÚlstriprrr rþrÿrr r"r$Ú contextlibÚcontextmanagerr)r3r-rßr.r@rHrrrNrLr5r6r]r^r|r_r˜r™r<ršrdrrer¡r9rarqr”r³rr+rÝr£r r¾rÌr<r<r<r=r3~sÜæý  0  z   0 ;   $ $ '    ,6-5   %  þÿþcCs tj dd¡ tj¡}td|ƒSr²)r?r´rzrÆÚpathsepÚfilter)r}r<r<r=rpsrc Cs~g}| tƒ¡tjg}tjtjkr0| tj¡|D]È}|r4tjdkr^| tj  |dd¡¡nVtj dkrš| tj  |ddj tj Žd¡tj  |dd¡g¡n| |tj  |dd¡g¡tjdkr4d |kr4tj  d ¡}|r4tj  |d d d j tj Žd¡}| |¡q4tdƒtdƒf}|D]}||kr| |¡qtjrB| tj¡z| t ¡¡Wntk rjYnXttt|ƒƒ}|S)z& Return a list of 'site' dirs )Zos2emxZriscosZLibz site-packagesrƒÚlibz python{}.{}z site-pythonÚdarwinzPython.frameworkÚHOMEÚLibraryÚPythonr¬ZpurelibZplatlib)Úextendrr¯r‚r·rÐrtr?r@röÚsepr®r°r´rzrrŒrrÚgetsitepackagesÚAttributeErrorr£rr")Úsitedirsrr‚r¼Zhome_spZ lib_pathsZsite_libr<r<r=rÍus^      üù þ   û   rÍccsâi}|D]Ô}t|ƒ}||krqd||<tj |¡s4qt |¡}||fV|D]Ž}| d¡s\qL|dkrfqLttj ||¡ƒ}tt |ƒƒ}|  ¡|D]H}|  d¡st|  ¡ƒ}||krd||<tj |¡sÈq|t |¡fVqqLqdS)zBYield sys.path directories that might contain "old-style" packagesrr )rùr¤ÚimportN) r"r?r@r©rAr3rrör£r!rrcÚrstrip)ZinputsÚseenrrrÞrcÚlinesÚliner<r<r=Ú expand_paths¶s4        rÙc Cs@t|dƒ}z$t |¡}|dkr*W¢ dS|d|d|d}|dkrRW¢ädS| |d¡t d| d¡¡\}}}|dkrˆW¢®dS| |d|¡d d d œ}t  |¡}z<| |¡} |   d d ¡d } |   t   ¡¡} | t | ¡¡Wntjk rYW¢.dSX| d¡r"| d¡s*W¢ dS|W¢S| ¡XdS)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¹rurz .egg-inforNrªr z -nspkg.pth)ZPURELIBZPLATLIBú\rÔz%s/%s/r»cSsg|]\}}| ¡|f‘qSr<)r)r r_Úyr<r<r=rÂ)sz$get_exe_prefixes..)ràZZipFilerZinfolistr¡rÆrër3rÓröÚupperr¹rZPY3rSr!rRrSrcrÐÚsortÚreverse)Z exe_filenamerrXr§rÞrrGZpthr<r<r=r7s@û       " c@sReZdZdZdZddd„Zdd„Zdd „Zed d „ƒZ d d „Z dd„Z dd„Z dS)r4z)A .pth file with Distribution paths in itFr<cCsl||_ttt|ƒƒ|_ttj |j¡ƒ|_|  ¡t   |gdd¡t |j ƒD]}tt|jt|dƒƒƒqLdS)NT)r¡r£rr"rÓr?r@rÚbasedirÚ_loadr'Ú__init__r!r¦r:r&)rr¡rÓr@r<r<r=rï4szPthDistributions.__init__cCsþg|_d}t |j¡}tj |j¡rÊt|jdƒ}|D]Œ}|  d¡rHd}q4|  ¡}|j  |¡|  ¡r4|  ¡  d¡rtq4t tj |j|¡ƒ}|jd<tj |¡r¦||kr¸|j ¡d|_q4d||<q4| ¡|jrÚ|sÚd|_|jrú|jd  ¡sú|j ¡qÚdS)NFZrtrÔTú#r†r)r¦r£ÚfromkeysrÓr?r@r`r¡rrcrÕrÐrRr"rörírAÚpopÚdirtyr)rZ saw_importrÖrcrØr@r<r<r=rî=s4    ÿ   zPthDistributions._loadc Cs¶|js dStt|j|jƒƒ}|r„t d|j¡| |¡}d  |¡d}t j   |j¡r`t   |j¡t|jdƒ}| |¡W5QRXn(t j  |j¡r¬t d|j¡t   |j¡d|_dS)z$Write changed .pth file back to diskNz Saving %srOr¥zDeleting empty %sF)rór£rr¨r¦r r©r¡Ú _wrap_linesrör?r@rŸr«rrrA)rZ rel_pathsr×Údatarcr<r<r=r§\s   zPthDistributions.savecCs|SrEr<)r×r<r<r=rôrszPthDistributions._wrap_linescCsN|j|jko$|j|jkp$|jt ¡k}|r>|j |j¡d|_t ||¡dS)z"Add `dist` to the distribution mapTN) r/r¦rÓr?ÚgetcwdrÐrór'r:)rr´Únew_pathr<r<r=r:vs   üzPthDistributions.addcCs2|j|jkr"|j |j¡d|_qt ||¡dS)z'Remove `dist` from the distribution mapTN)r/r¦r;rór'r?r<r<r=r;„s zPthDistributions.removecCsŒtj t|ƒ¡\}}t|jƒ}|g}tjdkr2dp6tj}t|ƒ|krˆ||jkrl| tj ¡|  ¡|  |¡Stj |¡\}}| |¡q8|S)Nrƒ) r?r@rÆr"rëríÚaltseprÐrÐÚcurdirrìrö)rr@ZnpathZlastZbaselenrrÐr<r<r=r¨‹s      zPthDistributions.make_relativeN)r<) r¿rÀrÁrÂrórïrîr§rÄrôr:r;r¨r<r<r<r=r4/s  c@s(eZdZedd„ƒZedƒZedƒZdS)ÚRewritePthDistributionsccs$|jV|D] }|Vq |jVdSrE)ÚpreludeÚpostlude)Úclsr×rØr<r<r=rôœ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ôrrûrür<r<r<r=rú›s rúZSETUPTOOLS_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ÚcompilerSr<r<r<r=Ú_first_line_reµs rcCsd|tjtjfkr.tjdkr.t|tjƒ||ƒSt ¡\}}}t   ||d|dd||ff¡dS)Nrárrz %s %s) r?r«r;rÞrWr­ÚS_IWRITEr¯rrZreraise)ÚfuncÚargÚexcZetZevrwr<r<r=Ú auto_chmodÁs  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_pathroÚnormalized_pathr<r<r=rrÉs <  rrcCsPg}t|ƒ}|D]:}t|ƒ}| |¡r|||d…tjdfkr| |¡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ër"rcr?rÐrÐ)r ÚcacheÚresultÚ prefix_lenÚpZnpr<r<r=Ú"_collect_zipimporter_cache_entriess  ÿ rcCs@t||ƒD]0}||}||=|o(|||ƒ}|dk r |||<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)r rÚupdaterrÚ old_entryZ new_entryr<r<r=Ú_update_zipimporter_cache/s  rcCst||ƒdSrE)r)r rr<r<r=r Osr cCsdd„}t|tj|ddS)NcSs | ¡dSrE)Úclear©r@rr<r<r=Ú2clear_and_remove_cached_zip_archive_directory_dataTszf_remove_and_clear_zip_directory_cache_data..clear_and_remove_cached_zip_archive_directory_data©r©rriÚ_zip_directory_cache)r rr<r<r=r Ss þr Z__pypy__cCsdd„}t|tj|ddS)NcSs&| ¡t |¡| tj|¡|SrE)rrirjÚupdaterrr<r<r=Ú)replace_cached_zip_archive_directory_datajs zT_replace_zip_directory_cache_data..replace_cached_zip_archive_directory_datarr)r rr<r<r=r is  þr úc Cs4zt||dƒWnttfk r*YdSXdSdS)z%Is this string a valid Python script?ÚexecFTN)rÚ SyntaxErrorÚ TypeError)rTr¡r<r<r=Ú is_python|s r"c CsNz(tj|dd}| d¡}W5QRXWnttfk rD|YSX|dkS)zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1r¶r¹ú#!)r¸rr¹rürý)rÚfpÚmagicr<r<r=Úis_sh†s  r&cCs t |g¡S)z@Quote a command line argument according to Windows parsing rules©Ú subprocessÚ list2cmdline)rr<r<r=Ú nt_quote_argsr*cCsH| d¡s| d¡rdSt||ƒr&dS| d¡rDd| ¡d ¡kSdS)zMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc. r\ú.pywTr#r›rF)r3r"rcÚ splitlinesr)rPr¡r<r<r=rM•s  rM)rWcGsdSrEr<)rzr<r<r=Ú_chmod§sr-c CsRt d||¡zt||ƒWn0tjk rL}zt d|¡W5d}~XYnXdS)Nzchanging mode of %s to %ozchmod failed: %s)r r©r-r?Úerror)r@rXrjr<r<r=rW«s rWc@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. r<©rýr<r<r=rJ¼szCommandSpec.bestcCstj tj¡}tj d|¡S)NÚ__PYVENV_LAUNCHER__)r?r@rCr¯rr´rz)rýZ_defaultr<r<r=Ú_sys_executableÃszCommandSpec._sys_executablecCs:t||ƒr|St|tƒr ||ƒS|dkr0| ¡S| |¡S)zg Construct a CommandSpec from a parameter to build_scripts, which may be None. N)rÖr£Úfrom_environmentÚ from_string)rýZparamr<r<r=Ú from_paramÈs  zCommandSpec.from_paramcCs|| ¡gƒSrE)r2r0r<r<r=r3×szCommandSpec.from_environmentcCstj|f|jŽ}||ƒS)z} Construct a command spec from a simple string representing a command line parseable by shlex.split. )ÚshlexrÆÚ split_args)rýÚstringr}r<r<r=r4ÛszCommandSpec.from_stringcCs8t | |¡¡|_t |¡}t|ƒs4dg|jdd…<dS)Nz-xr)r6rÆÚ_extract_optionsÚoptionsr(r)rL)rrPÚcmdliner<r<r=Úinstall_optionsäs zCommandSpec.install_optionscCs:|d ¡d}tƒ |¡}|r.| d¡p0dnd}| ¡S)zH Extract any options from the first line of the script. rOrrr»)r,rÚmatchÚgrouprR)Z orig_scriptÚfirstr=r:r<r<r=r9ês zCommandSpec._extract_optionscCs| |t|jƒ¡SrE)Ú_renderr£r:rœr<r<r=Ú as_headerôszCommandSpec.as_headercCs6d}|D](}| |¡r| |¡r|dd…Sq|S)Nz"'rr†)rcr3)ÚitemZ_QUOTESÚqr<r<r=Ú _strip_quotes÷s zCommandSpec._strip_quotescCs t dd„|Dƒ¡}d|dS)Ncss|]}t | ¡¡VqdSrE)r/rDrR)r rBr<r<r=r¢sz&CommandSpec._render..r#rOr')r}r;r<r<r=r@ÿs ÿzCommandSpec._renderN)r¿rÀrÁrÂr:r£r7rþrJr2r5r3r4r<rÄr9rArDr@r<r<r<r=r/³s*       r/c@seZdZeddZdS)ÚWindowsCommandSpecFr½N)r¿rÀrÁr£r7r<r<r<r=rE srEc@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)rIz` Encapsulates behavior around writing entry point scripts for console and gui apps. a– # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r __requires__ = %(spec)r import re import sys from pkg_resources import 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¡|rtnt ¡}| d||¡}| ||¡S)Nz Use get_argsr»)ÚwarningsrÏÚEasyInstallDeprecationWarningÚWindowsScriptWriterrIrJÚget_script_headerrK)rýr´rÚwininstÚwriterÚheaderr<r<r=Úget_script_args$s zScriptWriter.get_script_argscCs$tjdtdd|rd}| ||¡S)NzUse get_headerr¹)Ú stacklevelr )rFrÏrGrO)rýrPrrJr<r<r=rI,szScriptWriter.get_script_headerc cs€|dkr| ¡}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) rOr'r>Z get_entry_mapr}Ú_ensure_safe_namerµr²Ú_get_script_args) rýr´rLrðÚtype_r>rÞZeprPrzr•r<r<r=rK4s   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_sepr<r<r=rQFs zScriptWriter._ensure_safe_namecCs t dt¡|rt ¡S| ¡S©NzUse best)rFrÏrGrHrJ)rýZ force_windowsr<r<r=Ú get_writerOs zScriptWriter.get_writercCs.tjdkstjdkr&tjdkr&t ¡S|SdS)zD Select the best ScriptWriter for this environment. Úwin32ÚjavaráN)r¯rtr?rÞÚ_namerHrJr0r<r<r=rJUszScriptWriter.bestccs|||fVdSrEr<)rýrSrÞrLrPr<r<r=rR_szScriptWriter._get_script_argsr»cCs"|j ¡ |¡}| |¡| ¡S)z;Create a #! line, getting options (if any) from script_text)Úcommand_spec_classrJr5r<rA)rýrPrÚcmdr<r<r=rOds zScriptWriter.get_header)NF)NF)N)r»N)r¿rÀrÁrÂrPrQrÅrµr/rZrþrMrIrKrÄrQrVrJrRrOr<r<r<r=rIs&       rIc@sLeZdZeZedd„ƒZedd„ƒZedd„ƒZedd„ƒZ e d d „ƒZ d S) rHcCst dt¡| ¡SrU)rFrÏrGrJr0r<r<r=rVos zWindowsScriptWriter.get_writercCs"tt|d}tj dd¡}||S)zC Select the best ScriptWriter suitable for Windows )rZnaturalZSETUPTOOLS_LAUNCHERr)r£ÚWindowsExecutableLauncherWriterr?r´rz)rýZ writer_lookupZlauncherr<r<r=rJus þzWindowsScriptWriter.bestc #s–tddd|}|tjd ¡ d¡krBdjftƒŽ}t |t ¡dddd d dd g}|  |¡|  ||¡}‡fd d „|Dƒ}ˆ|||d|fVdS)z For Windows, add a .py extensionz.pyar+rOZPATHEXTú;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.r\ú -script.pyú.pycú.pyor[csg|] }ˆ|‘qSr<r<rU©rÞr<r=rÂsz8WindowsScriptWriter._get_script_args..rTN) r£r?r´rrÆr®r²rFrÏÚ UserWarningr;Ú_adjust_header) rýrSrÞrLrPÚextràr‹r¥r<rar=rR‚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 and 'python' is used for console (regardless of what sys.executable is). r r rP)r8Úrepl)rrÚescapeÚ IGNORECASEÚsubÚ _use_header)rýrSZ orig_headerrreZ pattern_obÚ new_headerr<r<r=rc’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†ú"rW)rRr¯rtr)rjZ clean_headerr<r<r=ri s zWindowsScriptWriter._use_headerN) r¿rÀrÁrErZrþrVrJrRrcrÄrir<r<r<r=rHls    rHc@seZdZedd„ƒZdS)r\c #s”|dkrd}d}dg}nd}d}dddg}| ||¡}‡fd d „|Dƒ} ˆ|||d | fVˆd t|ƒd fVtƒsˆd} | tˆƒd fVdS)zG For Windows, add a .py extension and an .exe launcher rPz -script.pywr+Zclir^r\r_r`csg|] }ˆ|‘qSr<r<rUrar<r=r¼szDWindowsExecutableLauncherWriter._get_script_args..rTr[rdz .exe.manifestN)rcÚget_win_launcherr>Úload_launcher_manifest) rýrSrÞrLrPZ launcher_typerdr‹Zhdrr¥Zm_namer<rar=rR®s"  þz0WindowsExecutableLauncherWriter._get_script_argsN)r¿rÀrÁrþrRr<r<r<r=r\­sr\cCs2d|}tƒr| 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.exeÚ.z-64.z-32.r­)r>rSr#)ÚtypeZ launcher_fnr<r<r=rlÑs  rlcCs0t td¡}tjr|tƒS| d¡tƒSdS)Nzlauncher manifest.xmlrR)rr#r¿rÚPY2ÚvarsrS)rÞZmanifestr<r<r=rmás  rmFcCst |||¡SrE)rBrª)r@Ú ignore_errorsÚonerrorr<r<r=rªésrªcCst d¡}t |¡|S)Né)r?Úumask)Ztmpr<r<r=rVís  rVcCs:ddl}tj |jd¡}|tjd<tj |¡tƒdS)Nr) r­r?r@rÚ__path__r¯ÚargvrÐr6)r­Zargv0r<r<r=Ú bootstrapós   rxc s‚ddlm}ddlm‰G‡fdd„dˆƒ}|dkrBtjdd…}tƒ0|fddd g|tjdpfd|d œ|—ŽW5QRXdS) Nr)Úsetup©r)cseZdZdZ‡fdd„ZdS)z-main..DistributionWithoutHelpCommandsr»c s(tƒˆj|f|ž|ŽW5QRXdSrE)Ú _patch_usageÚ _show_help)rrzÚkwrzr<r=r| sz8main..DistributionWithoutHelpCommands._show_helpN)r¿rÀrÁZ common_usager|r<rzr<r=ÚDistributionWithoutHelpCommands sr~rrœr3z-v)Z script_argsrZ distclass)r­ryZsetuptools.distr)r¯rwr{)rwr}ryr~r<rzr=r6ýs    ýüc#sLddl}t d¡ ¡‰‡fdd„}|jj}||j_z dVW5||j_XdS)Nrze usage: %(script)s [options] requirement_or_url ... or: %(script)s --help csˆttj |¡dS)N)Zscript)r£r?r@r)r©ZUSAGEr<r=Ú gen_usage s ÿz_patch_usage..gen_usage)Zdistutils.corerPrQrÅZcorer€)rír€Zsavedr<rr=r{ s  r{c@seZdZdZdS)rGzuClass for warning about deprecations in EasyInstall in SetupTools. Not ignored by default, unlike DeprecationWarning.N)r¿rÀrÁrÂr<r<r<r=rG( srG)N)r)N)ŠrÂrr±rrrZdistutils.errorsrrrr Zdistutils.command.installr r rír r Zdistutils.command.build_scriptsrrrr¯r?rirBr%ràrr­rôrPrFrŒr:rÆr(r6r¸Z sysconfigrrr­rZsetuptools.externrZsetuptools.extern.six.movesrrrZsetuptools.sandboxrZsetuptools.py27compatrZsetuptools.commandrZsetuptools.archive_utilrZsetuptools.package_indexrrrrrZsetuptools.wheelr rr!r"r#r$r%r&r'r(r)r*r+r,r-r.r/Zpkg_resources.py31compatroZ __metaclass__ÚfilterwarningsZ PEP440WarningÚ__all__r>r2rprHrLrr3rrÍrÙr5r7r4rúr´rzrrrrrrr r Úbuiltin_module_namesr r"r&r*rMrWr-Ú ImportErrorr£r/r2Zsys_executablerErIrHr\rMrIrlrmrªrVrxr6rÇr{rGr<r<r<r=Úsà            Dþ {A))'l R  ÿ  T^A