U Wzf_žQã@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;jLdddddddgZMdd„ZNdd„ZOd d!„ZPd"d#„ZQd$d%„ZRGd&d„de,ƒZSd'd(„ZTd)d*„ZUd+d,„ZVd-d„ZWd.d„ZXGd/d„deBƒZYGd0d1„d1eYƒZZej[ \d2d3¡d4krŒeZZYd5d6„Z]d7d8„Z^d9d:„Z_d;d<„Z`dnd=d>„Zad?d@„ZbdAdB„ZcdCejdkrØecZendDdE„ZedodGdH„ZfdIdJ„ZgdKdL„ZhdMdN„ZizddOlmjZkWnelk r0dPdQ„ZkYnXdRdS„ZjGdTdU„dUemƒZnen o¡ZpGdVdW„dWenƒZqGdXdY„dYƒZrGdZd[„d[erƒZsGd\d]„d]esƒZterjuZuerjvZvd^d_„Zwd`da„Zxdbe^fdcdd„Zydedf„Zzdgdh„Z{dpdid„Z|e"j}djdk„ƒZ~Gdldm„dme+ƒZd S)qa% 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)Ú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ÚmainÚget_exe_prefixescCst d¡dkS)NÚPé)ÚstructÚcalcsize©r8r8úw/private/var/folders/n9/53xbvtmd7sjg1q1l55xmpg58n4mgng/T/pip-unpacked-wheel-slp6y8a5/setuptools/command/easy_install.pyÚis_64bitJsr: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. r.)ÚosÚpathÚexistsÚhasattrr.ÚnormpathÚnormcase)Úp1Úp2Z both_existZ use_samefileZnorm_p1Znorm_p2r8r8r9r.NscCs | d¡S)NÚutf8)Úencode©Úsr8r8r9Ú _to_bytes^srGcCs,z| d¡WdStk r&YdSXdS)NÚasciiTF)rDÚ UnicodeErrorrEr8r8r9Úisasciibs  rJcCst |¡ ¡ dd¡S)NÚ z; )ÚtextwrapÚdedentÚstripÚreplace)Útextr8r8r9Ú _one_linerjsrQc@sˆeZdZdZdZdZdddddd d d d d ddddddddddddddejfgZddddd d!d"d#d$dg Z d%diZ e Z d&d'„Z d(d)„Zd*d+„Zed,d-„ƒZd.d/„Zd0d1„Zd2d3„Zd4d5„Zd6d7„Zd•d8d9„Zd:d;„Zdd?„Ze d@¡ ¡Ze dA¡ ¡Ze 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„Z-dZd[„Z.d\d]„Z/d^d_„Z0d™d`da„Z1edbdc„ƒZ2dšdfdg„Z3dhdi„Z4djdk„Z5dldm„Z6dndo„Z7dpdq„Z8drds„Z9e dt¡ ¡Z:e du¡Z;d›dwdx„Zd|d}„Z?d~d„Z@d€d„ZAd‚dƒ„ZBd„d…„ZCd†d‡„ZDdˆd‰„ZEe dŠ¡ F¡ZGd‹dŒ„ZHeIeIddŽddZJeId‘d’dZKd“d”„ZLdS)œ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=rFzinstall 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'rRrTrYrVr[rdrfrirkracCs&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|_*|j+j,|_,|j+ -||j+ .d¡¡dS)Nrr/)/rlÚzip_okÚlocal_snapshots_okÚ install_dirÚ script_dirÚexclude_scriptsÚ index_urlÚ find_linksÚbuild_directoryÚargsÚoptimizeÚrecordrVÚ always_copyÚ multi_versionrdÚno_depsÚ allow_hostsÚrootÚprefixÚ no_reportrkÚ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Ú_dry_runÚ distributionÚverboseÚ_set_command_optionsÚget_option_dict©Úselfr8r8r9Úinitialize_options›sH      ÿzeasy_install.initialize_optionscCs"dd„|Dƒ}tt|j|ƒƒdS)Ncss*|]"}tj |¡stj |¡r|VqdS©N)r;r<r=Úislink)Ú.0Úfilenamer8r8r9Ú Ës ÿz/easy_install.delete_blockers..)ÚlistÚmapÚ _delete_path)r™ÚblockersZextant_blockersr8r8r9Ú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_treeZremoverr8r8r9r¢Ñ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)ÚverÚdistÚtmplr8r8r9Ú_render_versionÚs  zeasy_install._render_versionc Csˆ|jo | ¡tj ¡d}tddƒ\}}|j ¡|j ¡|j ¡||dd…|d|d||||t tddƒdœ |_ t j r–|j |j d <|j|j d <n|jr¦t d ¡| ¡| ¡| ¡| d d dd¡|jdkrà|j|_|jdkrðd|_| dd¡| dd¡|jr(|jr(|j|_|j|_| dd¡tttjƒ}tƒ|_ |j!dk r¾dd„|j! d¡Dƒ}|D]N}t"j #|¡sŽt d|¡n,t|ƒ|krªt$|dƒ‚n|j  %t|ƒ¡qn|j&sÎ| '¡|j(pØd|_(|j dd…|_)|jt|jƒfD] }||j)krü|j) *d|¡qü|j+dk rBdd„|j+ d¡Dƒ}ndg}|j,dkrj|j-|j(|j)|d|_,t.|j)tjƒ|_/|j0dk r¤t1|j0t2ƒrª|j0 ¡|_0ng|_0|j3rÆ|j, 4|j)tj¡|jsÜ|j, 5|j0¡| dd ¡t1|j6t7ƒsVz0t7|j6ƒ|_6d|j6krdks$nt8‚Wn.t8k rT} zt$d!ƒ| ‚W5d} ~ XYnX|j&rn|j9snt:d"ƒ‚|j;s~t:d#ƒ‚g|_'sz1easy_install.finalize_options..ú,z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.pathzhttps://pypi.org/simple/cSsg|] }| ¡‘qSr8)rNrÈr8r8r9rÉ=sÚ*)Ú search_pathÚhosts)rvrvz--optimize must be 0, 1, or 2z9Must specify a build directory (-b) when using --editablez:No urls, filenames, or requirements specified (see --help))=rkrµr­Úsplitrr”Úget_nameÚ get_versionÚ get_fullnameÚgetattrÚ config_varsr‡rˆrŠrŒrlr ÚwarnÚ_fix_install_dir_for_user_siteÚexpand_basedirsÚ expand_dirsÚ_expandrprorÚset_undefined_optionsrrƒr¡rr<Ú get_site_dirsÚ all_site_dirsr‘r;r§rÚappendrdÚcheck_site_dirrrÚ shadow_pathÚinsertr{rŽÚ create_indexr#Ú local_indexrsÚ isinstanceÚstrrnZscan_egg_linksÚadd_find_linksrvÚintÚ ValueErrorrtrruÚoutputs) r™r¾r}r¶r?r‘rXÚ path_itemrÍrer8r8r9Ú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ÚposixÚunixÚ_user) rlr‡rˆÚcreate_home_pathrŠr r…r†r;ÚnamerOÚ select_scheme)r™ÚmsgZ scheme_namer8r8r9rÕds  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Úvalr8r8r9Ú _expand_attrsss   zeasy_install._expand_attrscCs| dddg¡dS)zNCalls `os.path.expanduser` on install_base, install_platbase and root.r…r†r|N©rör˜r8r8r9rÖ|szeasy_install.expand_basedirscCsddddddg}| |¡dS)z+Calls `os.path.expanduser` on install dirs.rr€r‚rrƒr„Nr÷)r™Údirsr8r8r9r×súzeasy_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 ¡| ¡W5t |jj¡XdS)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_verbosityrur/rzrwrçr|ÚlenÚrangeÚ distutilsrùÚexecuteÚ write_fileÚwarn_deprecated_options)r™Zshow_deprecationÚspecrçÚroot_lenÚcounterrùr8r8r9Úruns4ý    ÿþ 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ÚrandomÚrandintr­Úmaxsizer<Újoinro)r™Úpidr8r8r9Úpseudo_tempnameªs  zeasy_install.pseudo_tempnamecCsdSr›r8r˜r8r8r9rµsz$easy_install.warn_deprecated_optionsc CsRt|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 stj dd¡}t |j|j|¡|r&|jdkr,t||j ƒ|_nd|_|j rHtj |¡sHd|_||_dS)z;Verify that self.install_dir is .pth-capable dir, if neededúeasy-install.pthz .write-testÚwÚ PYTHONPATHrºN)rror;r<r r=ÚmakedirsÚOSErrorÚIOErrorÚcant_write_to_targetrÛryÚcheck_pth_processingrr©ÚopenÚcloseÚenvironÚgetr rÔÚ_easy_install__no_default_msgrr0)r™ÚinstdirrZ is_site_dirZtestfileZ test_existsÚ pythonpathr8r8r9rݸ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érK) Ú_easy_install__cant_write_msgr­Úexc_inforor;r<r=Ú_easy_install__not_exists_idÚ_easy_install__access_msgr)r™rðr8r8r9r s z!easy_install.cant_write_to_targetc Cs¦|j}t d|¡| ¡d}|d}tj |¡}tdƒd}z6|rNt |¡tj  |¡}tj |ddt |dƒ}Wn t t fk r”| ¡YnúXz¶| |jftƒŽ¡| ¡d }tj}tjd kr tj |¡\}} tj |d ¡} |  ¡d koþtj | ¡} | r | }d dlm} | |dddgd ƒtj |¡rJt d|¡W¢dSW5|r\| ¡tj |¡rtt |¡tj |¡rŒt |¡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() rKT)Ú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)ror r¥rr;r<r=rQr©ÚdirnamerrrrrrÚwriter¬r°r­Ú executablerîrÎr ÚlowerÚdistutils.spawnr'ryrÔ) r™rrZok_fileZ ok_existsr´r)r^r+ÚbasenameZaltZuse_altr'r8r8r9rs\   û     þ þ    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)rqÚmetadata_isdirÚmetadata_listdirÚinstall_scriptÚ get_metadataÚinstall_wrapper_scripts)r™r³Ú script_namer8r8r9Úinstall_egg_scriptsMs þz easy_install.install_egg_scriptscCsTtj |¡rDt |¡D]*\}}}|D]}|j tj ||¡¡q$qn |j |¡dSr›)r;r<r§ÚwalkrçrÜr )r™r<ÚbaserøÚfilesržr8r8r9Ú 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).)rdr©r™rr8r8r9Ú not_editablecs þÿ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)rdr;r<r=r rtÚkeyrr;r8r8r9Úcheck_editableks ÿÿzeasy_install.check_editablec cs6tjdd}zt|ƒVW5tj |¡o.t|ƒXdS)Nz easy_install-)r})ÚtempfileÚmkdtempr;r<r=r¨rã)r™Útmpdirr8r8r9Ú_tmpdirus zeasy_install._tmpdirFc Cs:| ¡&}t|tƒst|ƒrT| |¡|j ||¡}| d|||d¡W5QR£Stj   |¡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)rBrâr$rr<rŽÚdownloadÚ install_itemr;r<r=rr>Zfetch_distributionrVrdrxrárÚ precedencer+Úprocess_distributionÚlocation)r™rÚdepsrAÚdlr³rðr8r8r9r/~s8      þ  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 %srrC)rxr;r<r)ÚendswithrrráÚ project_namerHr r¥r.Ú install_eggsrGÚegg_distribution)r™rrDrArIZinstall_neededr³Údistsr8r8r9rEŸs2  ÿþ   zeasy_install.install_itemcCs<t|}tD]*}d|}t||ƒdkr t||||ƒq dS)z=Sets the install directories by applying the install schemes.Úinstall_N)r r rÒrò)r™rîÚschemer=Úattrnamer8r8r9rïÃ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¡}Wnbtk r>}ztt|ƒƒ|‚W5d}~XYn2tk rn}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=Úremover6r’r r¥Úinstallation_reportÚ has_metadatarräÚget_metadata_linesrxrÔÚas_requirementr$rãr(Úresolver/r)rr*Úreportr)r™Ú requirementr³rIr¥ZdistreqZdistrosrer8r8r9rGÌsL       ÿÿ    ÿ z!easy_install.process_distributioncCs2|jdk r|j S| d¡r dS| d¡s.dSdS)Nz not-zip-safeTzzip-safeF)rmrX©r™r³r8r8r9Ú should_unzipós   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 rtr=r=r rÔr§r)r©Úlistdirrýr ÚshutilÚmove)r™rÚ dist_filenameÚ setup_baseÚdstrðÚcontentsr8r8r9Ú maybe_moveüs$ ÿ      zeasy_install.maybe_movecCs,|jr dSt ¡ |¡D]}|j|ŽqdSr›)rqÚ ScriptWriterÚbestÚget_argsÚ write_script)r™r³rur8r8r9r4sz$easy_install.install_wrapper_scriptscCsNt| ¡ƒ}t||ƒ}|r8| |¡tƒ}t |¡|}| |t|ƒd¡dS)z/Generate a legacy script wrapper and install itr_N) rãrZÚis_python_scriptÚ_load_templater°rhÚ get_headerrkrG)r™r³r5Ú script_textÚdev_pathrZ is_scriptÚbodyr8r8r9r2s   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)rOrÚdecode)rprîZ raw_bytesr8r8r9rm#s   zeasy_install._load_templateÚtr8c 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|¡‘qSr8)r;r<r rp©rrZr˜r8r9rÉ5sz-easy_install.write_script..zInstalling %s script to %sNriÿ)r¤r r¥rpr;r<r r:r¦Ú current_umaskr r=r©rr*Úchmod)r™r5rfÚmoder£ÚtargetÚmaskr^r8r˜r9rk2sÿ   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) NrKú.exez.whlú.pyzsetup.pyrËz"Couldn't find a setup script in %srzMultiple setup scripts in %sr)r,rLÚ install_eggÚ install_exeÚ install_wheelr;r<ÚisfilerÚunpack_progressr§ÚabspathÚ startswithrtrgr r=rrrýrdr r¥Úreport_editableÚbuild_and_install)r™rrcrArdÚ setup_scriptZsetupsr8r8r9rNFsJ   ÿÿ ÿÿ ÿÿzeasy_install.install_eggscCs>tj |¡r"t|tj |d¡ƒ}ntt |¡ƒ}tj ||dS)NúEGG-INFO)Úmetadata) r;r<r§r&r r'Ú zipimportÚ zipimporterr%Ú from_filename)r™Úegg_pathrˆr8r8r9rOrs   ÿ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 ror.r‚r¦r rOr.r§rœr Ú remove_treer=rr©rƒrarbÚcopytreer_ÚmkpathÚunpack_and_compileÚcopy2r)Úupdate_dist_cachesrr:)r™rŒrAÚ destinationr³Znew_dist_is_zippedr^rUr8r8r9r}zs^ þ    ý        þýþ   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 .exerˆrîrk)rMrkÚplatformrKz.tmpr‡úPKG-INFOrzMetadata-Version: 1.0 Útarget_versionz%s: %s Ú_ú-r/csg|]}tj ˆ|d¡‘qS)r)r;r<r )rru©rpr8r9rÉÒsÿz,easy_install.install_exe..)r•r¦)r1rr%rrr;r<r Úegg_namerHr r&Ú _providerÚ exe_to_eggr=rr*ÚitemsrOÚtitlerr¤rhrjrÚ make_zipfiler•r¦r}) r™rcrAÚcfgr³rŒÚegg_tmpZ _egg_infoZpkg_infr^ÚkÚvr8rr9r~°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)r,rƒrýrÎr;r<r rLrÚ strip_moduleÚsplitextrÜr rÔ)ÚsrcrerFÚoldÚnewÚpartsrJ©r¥Ú native_libsÚprefixesÚ to_compileÚ top_levelr8r9Úprocessås$        z(easy_install.exe_to_egg..processr©r¨r«r|r‡)r·r´z.txtrrKN)r3rr,rLrÎrr­r;r<r rÜZ write_stubÚ byte_compileZwrite_safety_flagZ analyze_eggr°r=rr*r) r™rcr¥r¸ZstubsÚresr²ÚresourceZpyfilerîÚtxtr^r8r³r9r Ýs8       þ   zeasy_install.exe_to_eggc Csàt|ƒ}| ¡st‚tj |j| ¡¡}tj |¡}|j sBt |ƒtj  |¡rltj  |¡slt j||j dn"tj |¡rŽ| tj|fd|¡z.| |j|fdtj |¡tj |¡f¡W5t|ddX| |¡| |¡S)NrrŽFrzInstalling %s to %s)rÚ is_compatibleÚAssertionErrorr;r<r roržr‚r¦r r§rœr r‘r=rr©r–Zinstall_as_eggr.r)r:rO)r™Ú wheel_pathrAÚwheelr—r8r8r9rs4   ý  þý  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)srKrº) ryr~Ú_easy_install__mv_warningror¡rr­r<Ú_easy_install__id_warningrHrMrkr°) r™Úreqr³ÚwhatrðZegglocrîrkÚextrasr8r8r9rW@s 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)NrK)r;r<r)r­r+Ú_easy_install__editable_msgr°)r™rr†r)Úpythonr8r8r9r„Ys zeasy_install.report_editablec Csætj dt¡tj dt¡t|ƒ}|jdkrNd|jd}| dd|¡n|jdkrd| dd¡|jrv| dd ¡t   d |t |ƒdd…d   |¡¡zt ||ƒWn8tk rà}ztd |jdfƒ|‚W5d}~XYnXdS) Nzdistutils.command.bdist_eggzdistutils.command.egg_infor¸r§rrrœú-qz-nz Running %s %sú zSetup script exited with %s)r­ÚmodulesÚ setdefaultrrr r•rßr¦r r¥rýr rr±rru)r™r†rdrur§r8r8r9r^s.    ÿÿþ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<r)r¨r rür•Ú_set_fetcher_optionsrÜrr#r}rHr¦rÔ) r™r†rdruÚdist_dirZall_eggsÚeggsr=r³r8r8r9r…ts* ÿ    ÿ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. r/)rsr‘rrrvr{rr›rœ)r/z setup.cfgN) r”r—Úcopyr¡rOÚdictr;r<r rZ edit_config) r™r8Zei_optsZfetch_directivesZ fetch_optionsr=rõÚsettingsZ cfg_filenamer8r8r9rÎŒ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ÚwtrK)rr=ryrHr r¥rVrÞÚpathsrUrÜr¦Úsaver;r<r rorœr©rr*Ú make_relativer)r™r³rXržr^r8r8r9rT£s6    þ        zeasy_install.update_pthcCst d||¡|S)NzUnpacking %s to %s)r Údebug)r™r¯rer8r8r9rÈ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)rLrƒrÜrr¦)r¯re©r™Zto_chmodr¶r8r9ÚpfÑs    z+easy_install.unpack_and_compile..pfimií)rr¹r¦r;ÚstatÚST_MODErw)r™rŒr—rÜr^rxr8rÛr9r”Ís  zeasy_install.unpack_and_compilec Csjtjr dSddlm}z@t |jd¡||dd|jd|jrT|||jd|jdW5t |j¡XdS)Nr)r¹r)rvÚforcer¦) r­Údont_write_bytecodeÚdistutils.utilr¹r rür•r¦rv)r™r¶r¹r8r8r9r¹à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. cCsb|js dSttj d¡ƒ}|j ¡D]8\}}| |¡r$tj |¡s$|  d|¡t  |d¡q$dS)zCreate directories under ~.Nú~zos.makedirs('%s', 0o700)iÀ) rlrr;r<rÇrÓr¡rƒr§Ú debug_printr)r™Úhomerîr<r8r8r9ríszeasy_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Ær8r)rrê)Úget_finalized_commandrÓr}rÑr rr;rîÚDEFAULT_SCHEMEr¡rÒròrárr<rÇ)r™rórÓrRrôrõrr8r8r9rØ)s        zeasy_install._expand)T)F)F)T)N)rtr8)rÁ)MÚ__name__Ú __module__Ú __qualname__Ú__doc__Ú descriptionZcommand_consumes_argumentsr‡r‹Ú user_optionsÚboolean_optionsÚ negative_optrràršr¤r¢Ú staticmethodrµrérÕrörÖr×rrrrÝrLrMÚlstriprr!r"rrr6r:r<r>Ú contextlibÚcontextmanagerrBr/rErïrGr_rgr4r2rmrkrNrOr}r~r rrÂrÃrWrÇr„rr…rÎrTrr”r¹rNrrírÒr rçrØr8r8r8r9r/nsÔäü/     - ;   ! $ '    ,6-5   %  þÿþcCs tj dd¡ tj¡}td|ƒS)Nrrº)r;rrrÎÚpathsepÚfilter)r¡r8r8r9Ú _pythonpath@sröc 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 )Zos2emxZriscosÚLibz site-packagesr¨Úlibz python{}.{}z site-pythonÚdarwinzPython.frameworkÚHOMEÚLibraryÚPythonrªÚpurelibÚplatlib)Úextendrör­r}r¶rÜr˜r;r<r Úsepr¬r®rrrr‡rˆr‹ÚgetsitepackagesÚAttributeErrorr r¡r)Úsitedirsrµr}räZhome_spZ lib_pathsZsite_libr8r8r9rÚEs^      üù þ   û   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#)rrÔÚimportN) rr;r<r§r`rLrr r rrrƒÚrstrip)ÚinputsÚseenr)r9rîr^ÚlinesÚliner8r8r9Ú 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¸r™rz .egg-inforNrÚr#z -nspkg.pth)ZPURELIBZPLATLIBú\rz%s/%s/rºcSsg|]\}}| ¡|f‘qSr8)r,)rrZÚyr8r8r9rÉ÷sz$get_exe_prefixes..)rÚZipFilerÚinfolistržrÎrýrLrßr ÚupperrrsrrNrOrƒrÜÚsortÚreverse)Z exe_filenamerµrSr¥rîr²rfÚpthr8r8r9r3Øs<û      " c@sReZdZdZdZddd„Zdd„Zdd „Zed d „ƒZ d d „Z dd„Z dd„Z dS)r0z)A .pth file with Distribution paths in itFr8cCsl||_ttt|ƒƒ|_ttj |j¡ƒ|_|  ¡t   |gdd¡t |j ƒD]}tt|jt|dƒƒƒqLdS)NT)ržr r¡rrr;r<r)ÚbasedirÚ_loadr#Ú__init__rrÖrUr")r™ržrr<r8r8r9r.szPthDistributions.__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)NFÚrtrTú#r«r)rÖrÒÚfromkeysrr;r<r€ržrrƒrrÜrNrr r,r=ÚpopÚdirtyr)r™Z saw_importrr^r r<r8r8r9r- 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 %srKrÕzDeleting empty %sF)r3r r¡rØrÖr rÙržÚ _wrap_linesr r;r<rœr©rr*r=)r™Z rel_pathsrÚdatar^r8r8r9r×*s   zPthDistributions.savecCs|Sr›r8)rr8r8r9r4@szPthDistributions._wrap_linescCsN|j|jko$|j|jkp$|jt ¡k}|r>|j |j¡d|_t ||¡dS)z"Add `dist` to the distribution mapTN) rHrÖrr;ÚgetcwdrÜr3r#rU)r™r³Únew_pathr8r8r9rUDs   üzPthDistributions.addcCs2|j|jkr"|j |j¡d|_qt ||¡dS)z'Remove `dist` from the distribution mapTN)rHrÖrVr3r#r^r8r8r9rVRs zPthDistributions.removecCsŒtj t|ƒ¡\}}t|jƒ}|g}tjdkr2dp6tj}t|ƒ|krˆ||jkrl| tj ¡|  ¡|  |¡Stj |¡\}}| |¡q8|S)Nr¨) r;r<rÎrrýr,ÚaltseprrÜÚcurdirr*r )r™r<ÚnpathÚlastZbaselenr²rr8r8r9rØYs      zPthDistributions.make_relativeN)r8) rèrérêrër3r.r-r×rðr4rUrVrØr8r8r8r9r0ýs  c@s(eZdZedd„ƒZedƒZedƒZdS)ÚRewritePthDistributionsccs$|jV|D] }|Vq |jVdSr›)ÚpreludeÚpostlude)Úclsrr r8r8r9r4jsz#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êÚ classmethodr4rQr=r>r8r8r8r9r<is 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Úcompilersr8r8r8r9Ú_first_line_reƒs rEcCs\|tjtjfkr.tjdkr.t|tjƒ||ƒSt ¡\}}}|d|dd||ff‚dS)Nrñrrz %s %s) r;r©rVrîrwrÝÚS_IWRITEr­r )ÚfuncÚargÚexcÚetZevr›r8r8r9Ú auto_chmods  rKcCs.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)Ú dist_pathrÚnormalized_pathr8r8r9r–˜s <  r–cCsPg}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ýrrƒr;rrÜ)rQÚcacheÚresultÚ prefix_lenÚpÚnpr8r8r9Ú"_collect_zipimporter_cache_entriesês  ÿ rWcCs@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)rW)rQrRÚupdaterrUÚ old_entryZ new_entryr8r8r9Ú_update_zipimporter_cacheþs  rZcCst||ƒdSr›)rZ)rQrRr8r8r9rLsrLcCsdd„}t|tj|ddS)NcSs | ¡dSr›)Úclear©r<rYr8r8r9Ú2clear_and_remove_cached_zip_archive_directory_data#szf_remove_and_clear_zip_directory_cache_data..clear_and_remove_cached_zip_archive_directory_data©rX©rZr‰Ú_zip_directory_cache)rQr]r8r8r9rO"s þrOZ__pypy__cCsdd„}t|tj|ddS)NcSs&| ¡t |¡| tj|¡|Sr›)r[r‰rŠÚupdater`r\r8r8r9Ú)replace_cached_zip_archive_directory_data9s zT_replace_zip_directory_cache_data..replace_cached_zip_archive_directory_datar^r_)rQrbr8r8r9rN8s  þrNúc Cs4zt||dƒWnttfk r*YdSXdSdS)z%Is this string a valid Python script?ÚexecFTN)rDÚ SyntaxErrorÚ TypeError)rPržr8r8r9Ú is_pythonKs rgc CsNz(tj|dd}| d¡}W5QRXWnttfk rD|YSX|dkS)zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1)Úencodingr¸ú#!)rrrrr)r+ÚfpÚmagicr8r8r9Úis_shUs  rlcCs t |g¡S)z@Quote a command line argument according to Windows parsing rules©Ú subprocessÚ list2cmdline)rHr8r8r9Ú nt_quote_arg_srpcCsH| 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|ú.pywTrirÈrF)rLrgrƒÚ splitlinesr,)roržr8r8r9rlds  rl)rwcGsdSr›r8)rur8r8r9Ú_chmodvsrsc CsRt d||¡zt||ƒWn0tjk rL}zt d|¡W5d}~XYnXdS)Nzchanging mode of %s to %ozchmod failed: %s)r rÙrsr;Úerror)r<rxrer8r8r9rwzs 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. r8©r?r8r8r9ri‹szCommandSpec.bestcCstj tj¡}tj d|¡S)NÚ__PYVENV_LAUNCHER__)r;r<r?r­r+rr)r?Ú_defaultr8r8r9Ú_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?Úparamr8r8r9Ú from_param—s  zCommandSpec.from_paramcCs|| ¡gƒSr›)ryrvr8r8r9rz¦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¡r8r8r9r{ªszCommandSpec.from_stringcCs8t | |¡¡|_t |¡}t|ƒs4dg|jdd…<dS)Nz-xr)r~rÎÚ_extract_optionsÚoptionsrnrorJ)r™roÚcmdliner8r8r9Úinstall_options³s zCommandSpec.install_optionscCs:|d ¡d}tƒ |¡}|r.| d¡p0dnd}| ¡S)zH Extract any options from the first line of the script. rKrrrº)rrrEÚmatchÚgrouprN)Z orig_scriptÚfirstr…r‚r8r8r9r¹s zCommandSpec._extract_optionscCs| |t|jƒ¡Sr›)Ú_renderr r‚r˜r8r8r9Ú as_headerÃszCommandSpec.as_headercCs6d}|D](}| |¡r| |¡r|dd…Sq|S)Nz"'rr«)rƒrL)ÚitemZ_QUOTESÚqr8r8r9Ú _strip_quotesÆs zCommandSpec._strip_quotescCs t dd„|Dƒ¡}d|dS)Ncss|]}t | ¡¡VqdSr›)rurŒrN)rrŠr8r8r9rŸÐsz&CommandSpec._render..rirKrm)r¡rƒr8r8r9rˆÎs ÿzCommandSpec._renderN)rèrérêrër‚rÒrr@riryr}rzr{r„rðrr‰rŒrˆr8r8r8r9ru‚s*       ruc@seZdZeddZdS)ÚWindowsCommandSpecFråN)rèrérêrÒrr8r8r8r9rÙsrc@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)rhz` 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¡|rtnt ¡}| d||¡}| ||¡S)Nz Use get_argsrº)ÚwarningsrÔÚEasyInstallDeprecationWarningÚWindowsScriptWriterrhriÚget_script_headerrj)r?r³r+ÚwininstÚwriterÚheaderr8r8r9Úget_script_argss zScriptWriter.get_script_argscCs$tjdtdd|rd}| ||¡S)NzUse get_headerr¸)Ú stacklevelr&)rŽrÔrrn)r?ror+r’r8r8r9r‘sÿzScriptWriter.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©ÚconsoleÚguiZ_scripts) rnrãrZÚ get_entry_mapr¡Ú_ensure_safe_nameÚtemplater°Ú_get_script_args) r?r³r”rÚtype_r†rîÚeprorurºr8r8r9rjs   zScriptWriter.get_argscCst d|¡}|rtdƒ‚dS)z? Prevent paths in *_scripts entry point names. z[\\/]z+Path separators not allowed in script namesN)rCÚsearchræ)rîZ has_path_sepr8r8r9r›+s zScriptWriter._ensure_safe_namecCs t dt¡|rt ¡S| ¡S©NzUse best)rŽrÔrrri)r?Z force_windowsr8r8r9Ú get_writer4s zScriptWriter.get_writercCs.tjdkstjdkr&tjdkr&t ¡S|SdS)zD Select the best ScriptWriter for this environment. Úwin32ÚjavarñN)r­r˜r;rîÚ_namerrirvr8r8r9ri:szScriptWriter.bestccs|||fVdSr›r8)r?ržrîr”ror8r8r9rDszScriptWriter._get_script_argsrºcCs"|j ¡ |¡}| |¡| ¡S)z;Create a #! line, getting options (if any) from script_text)Úcommand_spec_classrir}r„r‰)r?ror+Úcmdr8r8r9rnIs zScriptWriter.get_header)NF)NF)N)rºN)rèrérêrërLrMrñrœrur¦r@r•r‘rjrðr›r¢rirrnr8r8r8r9rhÝs&#       rhc@sLeZdZeZedd„ƒZedd„ƒZedd„ƒZedd„ƒZ e d d „ƒZ d S) rcCst dt¡| ¡Sr¡)rŽrÔrrirvr8r8r9r¢Ts zWindowsScriptWriter.get_writercCs"tt|d}tj dd¡}||S)zC Select the best ScriptWriter suitable for Windows )r+ZnaturalZSETUPTOOLS_LAUNCHERr+)rÒÚWindowsExecutableLauncherWriterr;rr)r?Z writer_lookupÚlauncherr8r8r9riZs þ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.pyarqr—ÚPATHEXTú;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.r|ú -script.pyú.pycú.pyor{csg|] }ˆ|‘qSr8r8ru©rîr8r9rÉtsz8WindowsScriptWriter._get_script_args..rtN) rÒr;rr,rÎr¬r°rŽrÔÚ UserWarningrVÚ_adjust_header) r?ržrîr”roÚextrðr°r£r8r¯r9rgsÿý   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&r™)r€Úrepl)rCrDÚescapeÚ IGNORECASEÚsubÚ _use_header)r?ržZ orig_headerrBr³Z pattern_obÚ new_headerr8r8r9r±ws 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«ú"r£)rNr­r˜r)r¸Z clean_headerr8r8r9r·…s zWindowsScriptWriter._use_headerN) rèrérêrr¦r@r¢rirr±rðr·r8r8r8r9rQs    rc@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 r™z -script.pywrqÚclir¬r|r­r®csg|] }ˆ|‘qSr8r8rur¯r8r9rÉ¡szDWindowsExecutableLauncherWriter._get_script_args..rtr{r_z .exe.manifestN)r±Úget_win_launcherr:Úload_launcher_manifest) r?ržrîr”roZ launcher_typer²r°Úhdrr£Zm_namer8r¯r9r“s"  þz0WindowsExecutableLauncherWriter._get_script_argsN)rèrérêr@rr8r8r8r9r¨’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:rOr)ÚtypeZ launcher_fnr8r8r9r»¶s  r»cCst td¡}| d¡tƒS)Nzlauncher manifest.xmlrr)Ú pkg_resourcesrrèrsÚvars)rîÚmanifestr8r8r9r¼Æs r¼FcCst |||¡Sr›)rar¨)r<Ú ignore_errorsÚonerrorr8r8r9r¨Ësr¨cCst d¡}t |¡|S)Né)r;Úumask)Útmpr8r8r9rvÏs  rvcCs:ddl}tj |jd¡}|tjd<tj |¡tƒdS)Nr) r«r;r<r)Ú__path__r­ÚargvrÜr2)r«Zargv0r8r8r9Ú bootstrapÕs   rÊc 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|ž|ŽW5QRXdSr›)Ú _patch_usageÚ _show_help)r™ruÚkwrÌr8r9rÎæsz8main..DistributionWithoutHelpCommands._show_helpN)rèrérêÚ common_usagerÎr8rÌr8r9ÚDistributionWithoutHelpCommandsãsrÑrrÉr/z-v)Ú script_argsr5Ú distclass)r«rËZsetuptools.distr%r­rÉrÍ)rÉrÏrËrÑr8rÌr9r2ß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)Úscript)rÒr;r<r.)r5©ÚUSAGEr8r9Ú gen_usageþs ÿz_patch_usage..gen_usage)Údistutils.corerLrMrñÚcorer×)rÿr×Zsavedr8rÕr9rÍös  rÍc@seZdZdZdS)rzF Warning for EasyInstall deprecations, bypassing suppression. N)rèrérêrër8r8r8r9r sr)N)rc)N)€rërrárrrÚdistutils.errorsrrrr Údistutils.command.installr r rÿr r Zdistutils.command.build_scriptsrr-rr­r;r‰rar?rrCrÝr rLrŽr‡r6ròrnr~rrÚ sysconfigrrr«rrZsetuptools.sandboxrZsetuptools.commandrZsetuptools.archive_utilrZsetuptools.package_indexrrrrrZsetuptools.wheelrrÀrrrr r!r"r#r$r%r&r'r(r)r*r+ÚfilterwarningsÚ PEP440WarningÚ__all__r:r.rGrJrQr/rörÚr r1r3r0r<rrrErKr–rWrZrLrOÚbuiltin_module_namesrNrgrlrprlrwrsÚ ImportErrorr ruryZsys_executablerrhrr¨r•r‘r»r¼r¨rvrÊr2rórÍrr8r8r8r9ÚsÔ          Dþ[A))%l  R  ÿ  TtA