o
    èh¥W ã                   @   sÌ  d Z ddlmZ ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
 ddlmZmZ ddlmZmZ ddlmZ dd	lmZ dd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
lZdd
l Z dd
l!Z!dd
l"Z"dd
l#Z#dd
l$Z$dd
l%Z%dd
l&Z&ddl'm(Z(m)Z) ddl*m+Z+ ddl*m,Z, ddl-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4m5Z5m6Z6 ddl/m7Z7m8Z8 ddl9m:Z: ddl;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJ dd
l;Z;ejKde;jLd g d¢ZMdd„ ZNdd„ ZOdd„ ZPdd„ ZQd d!„ ZRG d"d#„ d#e,ƒZSd$d%„ ZTd&d'„ ZUd(d)„ ZVd*d+„ ZWd,d-„ ZXG d.d/„ d/eBƒZYG d0d1„ d1eYƒZZej[ \d2d3¡d4krBeZZYd5d6„ Z]d7d8„ Z^d9d:„ Z_d;d<„ Z`did=d>„Zad?d@„ ZbdAdB„ ZcdCejdv rhecZendDdE„ ZedjdGdH„ZfdIdJ„ ZgdKdL„ ZhdMdN„ ZizddOlmjZk W n ely“   dPdQ„ ZkY nw dRdS„ ZjG dTdU„ dUemƒZnen o¡ ZpG dVdW„ dWenƒZqG dXdY„ dYƒZrG dZd[„ d[erƒZsG d\d]„ d]esƒZterjuZuerjvZvd^d_„ Zwd`da„ Zxdbe^fdcdd„Zydedf„ ZzG dgdh„ 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_prefixesc                   C   s   t  d¡dkS )NÚPé   )ÚstructÚcalcsize© r7   r7   ú[/var/www/html/olx_land/venv/lib/python3.10/site-packages/setuptools/command/easy_install.pyÚis_64bitJ   ó   r9   c                 C   sj   t j | ¡ot j |¡}tt jdƒo|}|rt j | |¡S t j t j | ¡¡}t j t j |¡¡}||kS )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_p2r7   r7   r8   r.   N   s   r.   c                 C   s
   |   d¡S )NÚutf8)Úencode©Úsr7   r7   r8   Ú	_to_bytes^   s   
rK   c                 C   s&   z|   d¡ W dS  ty   Y dS w )NÚasciiTF)rH   ÚUnicodeErrorrI   r7   r7   r8   Úisasciib   s   
ÿrN   c                 C   s   t  | ¡ ¡  dd¡S )NÚ
z; )ÚtextwrapÚdedentÚstripÚreplace)Útextr7   r7   r8   Ú
_one_linerj   s   rU   c                   @   sÒ  e Zd ZdZdZdZdddddd	d
dddddddddddddddddddej fgZg d¢Z	dd iZ
eZd!d"„ Zd#d$„ Zd%d&„ Zed'd(„ ƒZd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zd1d2„ Zd˜d3d4„Zd5d6„ Zd7d8„ Zd9d:„ Ze d;¡ ¡ Ze d<¡ ¡ Ze 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\„Z1ed]d^„ ƒZ2d›dadb„Z3dcdd„ Z4dedf„ Z5dgdh„ Z6didj„ Z7dkdl„ Z8dmdn„ Z9e do¡ ¡ Z:e dp¡Z;dœdrds„Z<e dt¡ ¡ Z=dudv„ Z>dwdx„ Z?dydz„ Z@d{d|„ ZAd}d~„ ZBdd€„ ZCdd‚„ ZDdƒd„„ ZEe d…¡ F¡ ZGd†d‡„ ZHeIjJddˆ… d‰v s:dŠeIjKv r=d‹ZLndŒZLeMeMddŽdeMdeL d‘deMdeL d‘deMd’eL dŽdd“ZNeMd”d•dZOd–d—„ ZPdS )r/   z'Manage a download/build/install processz Find/get/install Python packagesT)zprefix=Nzinstallation prefix)úzip-okÚzzinstall 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=Údzinstall package to DIR)zscript-dir=rJ   zinstall scripts to DIR)úexclude-scriptsÚxzDon'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)zbuild-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])zrecord=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ÚNzdon'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install-layout=Nz1installation layout to choose (known values: deb))z"force-installation-into-system-dirÚ0zforce installation into /usr)zno-find-linksNz9Don't load find-links defined in packages being installedÚuserNz!install in user site-package '%s')
rV   rX   r]   rZ   r_   rh   rj   rm   ro   z&force-installation-into-system-diruserre   rV   c                 C   sD  t  dt¡ 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%| _&nd | _$d | _&d | _'d | _(d  | _)| _*d | _+i | _,d | _-d | _.d | _/d | _0| j1j2| _2| j1 3| | j1 4d¡¡ d S )NzVeasy_install command is deprecated. Use build and pip and other standards-based tools.r   r/   )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©Úselfr7   r7   r8   Úinitialize_options   sT   ý

ÿzeasy_install.initialize_optionsc                 C   s"   dd„ |D ƒ}t t| j|ƒƒ d S )Nc                 s   s,    | ]}t j |¡st j |¡r|V  qd S ©N)r;   r<   r=   Úislink)Ú.0Úfilenamer7   r7   r8   Ú	<genexpr>Ø   s   € 
þ
þ
ÿz/easy_install.delete_blockers.<locals>.<genexpr>)ÚlistÚmapÚ_delete_path)r¤   ÚblockersÚextant_blockersr7   r7   r8   Údelete_blockers×   s   ÿzeasy_install.delete_blockersc                 C   sJ   t  d|¡ | jrd S tj |¡otj |¡ }|rtntj}||ƒ d S )NzDeleting %s)	r   ÚinfoÚdry_runr;   r<   Úisdirr§   ÚrmtreeÚunlink)r¤   r<   Úis_treeÚremoverr7   r7   r8   r­   Þ   s   zeasy_install._delete_pathc                  C   s4   dj tjŽ } tdƒ}d}t|j di tƒ ¤Žƒ 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Útmplr7   r7   r8   Ú_render_versionç   s
   zeasy_install._render_versionc                 C   sÜ  | j o|  ¡  tj  ¡ d }tddƒ\}}| j ¡ | j ¡ | j ¡ ||dd… |d |d  ||||t	tddƒdœ| _
tjrK| j| j
d	< | j| j
d
< n| jrSt d¡ |  ¡  |  ¡  |  ¡  | jr†| j ¡ dvrmtdƒ‚| j ¡ | _dd l}tjd d… dkr†| d¡| _|  dddd¡ | jd u r—| j| _| jd u rŸd| _|   dd¡ |   dd¡ | jr¹| j!r¹| j!| _| j"| _| j#dkrÅ| j$sÅtdƒ‚|   dd¡ t%t&tj'ƒ}t(ƒ | _)| j*d urdd„ | j* d¡D ƒ}|D ]$}t+j' ,|¡s÷t d |¡ qèt&|ƒ|vrt|d! ƒ‚| j) -t&|ƒ¡ qè| j.s|  /¡  | j0pd"| _0| j)d d … | _1| jt&| jƒfD ]}|| j1vr;| j1 2d|¡ q,| j3d urOd#d„ | j3 d¡D ƒ}	nd$g}	| j4d u rc| j5| j0| j1|	d%| _4t6| j1tj' ƒ| _7| j8d ur€t9| j8t:ƒr| j8 ¡ | _8ng | _8| j;r‘| j4 <| j1tj' ¡ | jsœ| j4 =| j8¡ |   dd&¡ t9| j>t?ƒsÕzt?| j>ƒ| _>d| j>  kr¾dksÁt@‚ t@‚W n t@yÔ }
 ztd'ƒ|
‚d }
~
ww | j.rá| jAsátBd(ƒ‚| jCsétBd)ƒ‚g | _Dd S )*Nr   r…   Ú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Å   Ú	MULTIARCHrw   rx   r|   r™   FrŠ   )rw   rw   r‹   ©rw   rx   ú/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)r   r   c                 S   s   g | ]
}t j | ¡ ¡‘qS r7   )r;   r<   Ú
expanduserrR   ©r¨   rJ   r7   r7   r8   Ú
<listcomp>F  s    ÿz1easy_install.finalize_options.<locals>.<listcomp>ú,z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.pathzhttps://pypi.org/simple/c                 S   s   g | ]}|  ¡ ‘qS r7   )rR   rÚ   r7   r7   r8   rÛ   \  ó    Ú*)Ú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))Ero   rÃ   r»   Úsplitr   rŸ   Úget_nameÚget_versionÚget_fullnameÚgetattrÚconfig_varsr   r   r’   r”   rq   r   rs   Ú_fix_install_dir_for_user_siteÚexpand_basedirsÚexpand_dirsr›   Úlowerr   Ú	sysconfigr¼   Úget_config_varr   Ú_expandrx   rw   r•   Úset_undefined_optionsr‡   r‹   r…   rœ   r¬   r   r<   Ú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|   r   r}   Úoutputs)r¤   rÌ   r…   rÄ   rë   r?   r™   r\   Ú	path_itemrà   ri   r7   r7   r8   Úfinalize_optionsò   sè   €

ô
þ

ÿÿ
þÿ€
ÿ€ÿÿÿþ€ÿÿÿ
zeasy_install.finalize_optionsc                 C   s\   | j rtjsdS |  ¡  | jdu rd}t|ƒ‚| j | _| _tj	 
dd¡d }|  |¡ dS )z;
        Fix the install_dir if "--user" was used.
        Nz$User base directory is not specifiedÚposixÚunixÚ_user)rq   r   r   Úcreate_home_pathr’   r	   r   rŽ   r;   ÚnamerS   Úselect_scheme)r¤   ÚmsgÚscheme_namer7   r7   r8   rç   ƒ  s   
z+easy_install._fix_install_dir_for_user_sitec                 C   sX   |D ]'}t | |ƒ}|d ur)tjdkstjdkrtj |¡}t|| jƒ}t| ||ƒ qd S )Nr   Únt)rå   r;   r  r<   rÙ   r   ræ   Úsetattr)r¤   ÚattrsÚattrÚvalr7   r7   r8   Ú_expand_attrs’  s   
€úzeasy_install._expand_attrsc                 C   s   |   g d¢¡ dS )zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.)r   rŽ   r„   N©r  r£   r7   r7   r8   rè   ›  s   zeasy_install.expand_basedirsc                 C   s   g d¢}|   |¡ dS )z+Calls `os.path.expanduser` on install dirs.)r‡   rˆ   rŠ   r‰   r‹   rŒ   Nr  )r¤   Údirsr7   r7   r8   ré      s   zeasy_install.expand_dirsc              	   C   sè   |r	|   dtj¡ | j| jjkrt | j¡ zU| jD ]
}|  || j ¡ q| j	r^t
t| jƒƒ}| jrJt| jƒ}tt|ƒƒD ]}|| |d … ||< q=ddlm} |  |j| j	|fd| j	 ¡ |  ¡  W t | jj¡ d S t | jj¡ 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‚   r   r«   Úsortedrý   r„   ÚlenÚrangeÚ	distutilsr  ÚexecuteÚ
write_fileÚwarn_deprecated_options)r¤   Úshow_deprecationÚspecrý   Úroot_lenÚcounterr  r7   r7   r8   Úrun¬  s2   ý

ÿþ
"zeasy_install.runc                 C   sB   zt  ¡ }W n ty   t dtj¡}Y nw t j | 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.
        r   ztest-easy-install-%s)
r;   ÚgetpidÚ	ExceptionÚrandomÚrandintr»   Úmaxsizer<   Újoinrw   )r¤   Úpidr7   r7   r8   Úpseudo_tempnameÉ  s   ÿzeasy_install.pseudo_tempnamec                 C   ó   d S r¦   r7   r£   r7   r7   r8   r  Ô  ó   z$easy_install.warn_deprecated_optionsc              	   C   sB  t | jƒ}tj |d¡}tj |¡s)zt |¡ W n ttfy(   |  	¡  Y nw || j
v }|s8| js8|  ¡ }n1|  ¡ d }tj |¡}z|rLt |¡ t|dƒ ¡  t |¡ W n ttfyh   |  	¡  Y nw |s~| js~tj dd¡}t | j| j|¡ |r| jdu rŒt|| j
ƒ| _nd| _| jrœtj |¡sœd| _|| _dS )z;Verify that self.install_dir is .pth-capable dir, if neededúeasy-install.pthz.write-testÚwÚ
PYTHONPATHrÈ   N)r   rw   r;   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Ú
pythonpathr7   r7   r8   rò   ×  s@   
ÿ



ÿ

€
zeasy_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.
        c                 C   sR   | j t ¡ d | jf }tj | j¡s|d| j 7 }t	|ƒ‚|d| j 7 }t	|ƒ‚)Né   rO   )
Ú_easy_install__cant_write_msgr»   Úexc_inforw   r;   r<   r=   Ú_easy_install__not_exists_idÚ_easy_install__access_msgr   )r¤   r  r7   r7   r8   r0  (  s   ÿz!easy_install.cant_write_to_targetc              	   C   s  | j }t d|¡ |  ¡ d }|d }tj |¡}tdƒd }z|r't |¡ tj 	|¡}tj
|dd t|dƒ}W n ttfyI   |  ¡  Y n³w z“| |jdi tƒ ¤Ž¡ | ¡  d	}tj}tjd
kr„tj |¡\}}	tj |d¡}
|	 ¡ dkotj |
¡}|r„|
}ddlm} ||dddgdƒ tj |¡rÀt d|¡ W |r¦| ¡  tj |¡r±t |¡ tj |¡r¾t |¡ dS dS W |rÇ| ¡  tj |¡rÒt |¡ tj |¡rÝt |¡ n|rä| ¡  tj |¡rït |¡ tj |¡rût |¡ w w | jst d|¡ dS )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()
            rO   T)Ú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   )rw   r   r±   r'  r;   r<   r=   rU   rµ   Údirnamer-  r2  r.  r/  r0  Úwriterº   r¾   r3  r»   Ú
executabler  rá   r%  rê   Údistutils.spawnrE  r   rs   )r¤   r7  r—   Úok_fileÚ	ok_existsrÂ   rG  rb   rI  ÚbasenameÚaltÚuse_altrE  r7   r7   r8   r1  1  s~   û
ÿ

þþ
ÿõ

€û
ÿz!easy_install.check_pth_processingc              	   C   sV   | j s$| d¡r$| d¡D ]}| d| ¡rq|  ||| d| ¡¡ q|  |¡ dS )z=Write all the scripts for `dist`, unless scripts are excludedÚscriptszscripts/N)ry   Úmetadata_isdirÚmetadata_listdirÚinstall_scriptÚget_metadataÚinstall_wrapper_scripts)r¤   rÁ   Úscript_namer7   r7   r8   Úinstall_egg_scriptsl  s   þz easy_install.install_egg_scriptsc                 C   sV   t j |¡r#t  |¡D ]\}}}|D ]}| j t j ||¡¡ qqd S | j |¡ d S r¦   )r;   r<   r³   Úwalkrý   rñ   r%  )r¤   r<   Úbaser  Úfilesr©   r7   r7   r8   Ú
add_outputz  s   ÿÿzeasy_install.add_outputc                 C   s   | j r
td|f ƒ‚d S )NzjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).)rh   r   ©r¤   r  r7   r7   r8   Únot_editable‚  s   þÿÿzeasy_install.not_editablec                 C   s<   | j sd S tj tj | j|j¡¡rtd|j| jf ƒ‚d S )Nz2%r already exists in %s; can't do a checkout there)rh   r;   r<   r=   r%  r|   Úkeyr   r\  r7   r7   r8   Úcheck_editableŠ  s   
ÿÿÿzeasy_install.check_editablec              	   c   sT    t jdd}zt|ƒV  W tj |¡ot|ƒ d S  d S tj |¡o(t|ƒ w  w )Nzeasy_install-)r…   )ÚtempfileÚmkdtemprø   r;   r<   r=   r´   )r¤   Útmpdirr7   r7   r8   Ú_tmpdir”  s
   €8zeasy_install._tmpdirFc              	   C   sB  |   ¡ “}t|tƒsIt|ƒr*|  |¡ | j ||¡}|  d |||d¡W  d   ƒ S tj	 
|¡rE|  |¡ |  d |||d¡W  d   ƒ S t|ƒ}|  |¡ | j ||| j| j| j | j¡}|d u rqd| }| jrm|d7 }t|ƒ‚|jtkr‡|  |||d¡ |W  d   ƒ S |  ||j||¡W  d   ƒ S 1 sšw   Y  d S )NTz+Could not find suitable distribution for %rz2 (--always-copy skips system and development eggs)ÚUsing)rc  r÷   r$   r   r]  r–   ÚdownloadÚinstall_itemr;   r<   r=   r   r_  Úfetch_distributionrZ   rh   r€   rö   r   Ú
precedencer+   Úprocess_distributionÚlocation)r¤   r  Údepsrb  ÚdlrÁ   r  r7   r7   r8   r/     s8   


ú
õ

þ
ä$âzeasy_install.easy_installc                 C   s  |p| j }|ptj |¡|k}|p| d¡ }|p*| jd uo*tj t|ƒ¡t| jƒk}|rA|sA| j|j D ]	}|j	|kr> nq5d}t
 dtj |¡¡ |ra|  |||¡}|D ]	}|  |||¡ qVn|  |¡g}|  ||d |d¡ |d ur‚|D ]}||v r|  S qwd S d S )Nú.eggTzProcessing %sr   rd  )r€   r;   r<   rG  Úendswithr˜   r   rö   Úproject_namerj  r   r±   rM  Úinstall_eggsri  Úegg_distribution)r¤   r  re  rb  rk  Úinstall_neededrÁ   Údistsr7   r7   r8   rf  ¾  s<   

ÿþ
ÿÿÿþzeasy_install.install_itemc                 C   s<   t | }tD ]}d| }t| |ƒdu rt| ||| ƒ qdS )z=Sets the install directories by applying the install schemes.Úinstall_N)r
   r   rå   r	  )r¤   r  Úschemer^  Úattrnamer7   r7   r8   r  â  s   €ýzeasy_install.select_schemec              
   G   sš  |   |¡ | j |¡ || j|j v r| j |¡ | j |¡ |  |¡ || j|j< t 	| j
||g|¢R Ž ¡ | d¡rH| jsH| j | d¡¡ |sO| jsOd S |d ura|j|jkrat d|¡ d S |d u si||vrs| ¡ }tt|ƒƒ}t 	d|¡ ztg ƒ |g| j| j¡}W n% tyš } ztt|ƒƒ|‚d }~w ty¬ } zt| ¡ ƒ|‚d }~ww | js³| jrÅ|D ]}|j| jvrÄ|  | ¡ ¡ qµt 	d|¡ d S )Nzdependency_links.txtzSkipping dependencies for %szProcessing dependencies for %sz'Finished processing dependencies for %s)Ú
update_pthr–   Úaddrö   r^  ÚremoverW  rš   r   r±   Úinstallation_reportÚhas_metadatar•   rú   Úget_metadata_linesr€   rs   Úas_requirementr$   rø   r(   Úresolver/   r)   r   r*   Úreportr˜   )r¤   ÚrequirementrÁ   rk  r±   ÚdistreqÚdistrosri   r7   r7   r8   ri  ì  sP   


ÿÿ
ÿ€€ÿ€z!easy_install.process_distributionc                 C   s2   | j d ur	| j  S | d¡rdS | d¡sdS dS )Nznot-zip-safeTzzip-safeF)ru   r{  ©r¤   rÁ   r7   r7   r8   Úshould_unzip  s   


zeasy_install.should_unzipc                 C   s¶   t j | j|j¡}t j |¡rd}t ||j| j|¡ |S t j |¡r&|}n)t j 	|¡|kr3t  
|¡ t  |¡}t|ƒdkrOt j ||d ¡}t j |¡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   rs   r³   rG  rµ   Úlistdirr  r    ÚshutilÚmove)r¤   r  Údist_filenameÚ
setup_baseÚdstr  Úcontentsr7   r7   r8   Ú
maybe_move  s$   ÿ

zeasy_install.maybe_movec                 C   s,   | j rd S t ¡  |¡D ]}| j|Ž  qd S r¦   )ry   ÚScriptWriterÚbestÚget_argsÚwrite_script)r¤   rÁ   r}   r7   r7   r8   rU  5  s
   ÿz$easy_install.install_wrapper_scriptsc                 C   sN   t | ¡ ƒ}t||ƒ}|r|  |¡tƒ  }t |¡| }|  |t|ƒd¡ dS )z/Generate a legacy script wrapper and install itrc   N)	rø   r}  Úis_python_scriptÚ_load_templater¾   r  Ú
get_headerr  rK   )r¤   rÁ   rV  Úscript_textÚdev_pathr  Ú	is_scriptÚbodyr7   r7   r8   rS  ;  s   
zeasy_install.install_scriptc                 C   s(   d}| r
|  dd¡}td|ƒ}| 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)rS   r   Údecode)r•  r  Ú	raw_bytesr7   r7   r8   r’  E  s
   

zeasy_install._load_templateÚtr7   c                    sº   ˆ   ‡ fdd„|D ƒ¡ t d|ˆ j¡ tj ˆ j|¡}ˆ  |¡ ˆ jr&dS t	ƒ }t
|ƒ tj |¡r8t |¡ t|d| ƒ}| |¡ W d  ƒ n1 sOw   Y  t|d| ƒ dS )z1Write an executable file to the scripts directoryc                    s   g | ]
}t j ˆ j|¡‘qS r7   )r;   r<   r%  rx   ©r¨   r^   r£   r7   r8   rÛ   W  ó    z-easy_install.write_script.<locals>.<listcomp>zInstalling %s script to %sNr+  iÿ  )r°   r   r±   rx   r;   r<   r%  r[  r²   Úcurrent_umaskr    r=   rµ   r2  rH  Úchmod)r¤   rV  r‹  Úmoder®   ÚtargetÚmaskrb   r7   r£   r8   r  T  s    ÿ

ÿzeasy_install.write_scriptc           	      C   sH  | j | j| jdœ}z|| ¡ dd …  }W n	 ty   Y nw |||ƒgS |}tj |¡r:| d¡s:t	||| j
ƒ ntj |¡rFtj |¡}| |¡rY| jrY|d urY|  |||¡}tj |d¡}tj |¡sttj |dd¡ƒ}|s|tdtj |¡ ƒ‚t|ƒdkrŒtdtj |¡ ƒ‚|d	 }| jržt |  ||¡¡ g S |  ||¡S )
N)rm  ú.exez.whléüÿÿÿú.pyzsetup.pyrÞ   z"Couldn't find a setup script in %sr<  zMultiple setup scripts in %sr   )Úinstall_eggÚinstall_exeÚinstall_wheelrê   ÚKeyErrorr;   r<   Úisfilern  r   Úunpack_progressr³   ÚabspathÚ
startswithr|   rŒ  r%  r=   r   r   r  rh   r   r±   Úreport_editableÚbuild_and_install)	r¤   r  rˆ  rb  Úinstaller_mapÚinstall_distr‰  Úsetup_scriptÚsetupsr7   r7   r8   rp  h  sT   ýÿÿ
ÿ
ÿÿ
ÿÿzeasy_install.install_eggsc                 C   s>   t j |¡rt|t j |d¡ƒ}ntt |¡ƒ}tj	||dS )NúEGG-INFO)Úmetadata)
r;   r<   r³   r&   r%  r'   Ú	zipimportÚzipimporterr%   Úfrom_filename)r¤   Úegg_pathrµ  r7   r7   r8   rq  ›  s   ÿzeasy_install.egg_distributionc              	   C   s‚  t j | jt j |¡¡}t j |¡}| jst|ƒ |  |¡}t	||ƒs·t j 
|¡r8t j |¡s8tj|| jd nt j |¡rI|  t j|fd| ¡ z_d}t j 
|¡re| |¡r^tjd}}n,tjd}}n%|  |¡rv|  |¡ | jd}}nd}| |¡r„tjd}}ntjd}}|  |||f|d t j |¡t j |¡f ¡ t||d	 W n ty¶   t|dd	 ‚ w |  |¡ |  |¡S )
N©r²   ú	Removing FÚMovingÚCopyingÚ
ExtractingTz	 %s to %s©Úfix_zipimporter_caches)r;   r<   r%  rw   rM  r¬  r²   r    rq  r.   r³   r§   r   Úremove_treer=   r  rµ   r­  r†  r‡  Úcopytreer„  ÚmkpathÚunpack_and_compileÚcopy2rG  Úupdate_dist_cachesr!  r[  )r¤   r¹  rb  ÚdestinationrÁ   Únew_dist_is_zippedrb   rY   r7   r7   r8   r¦  ¤  s`   
þ

ý





þý
þþ

zeasy_install.install_eggc                    sN  t |ƒ}|d u rtd| ƒ‚td | dd¡| dd¡tƒ d}tj || ¡ d ¡}||_	|d }tj |d¡}tj |d	¡}t
|ƒ t||ƒ|_|  ||¡ tj |¡s€t|d
ƒ}	|	 d¡ | d¡D ]\}
}|
dkr{|	 d|
 dd¡ ¡ |f ¡ qd|	 ¡  tj |d¡‰ |  ‡ fdd„t |¡D ƒ¡ tj||| j| jd |  ||¡S )Nz(%s is not a valid distutils Windows .exerµ  r  ro   )ro  ro   Úplatformrm  z.tmpr´  úPKG-INFOr+  zMetadata-Version: 1.0
Útarget_versionz%s: %s
Ú_ú-rP  c                    s   g | ]}t j ˆ |d  ¡‘qS )r   )r;   r<   r%  )r¨   r}   ©rx   r7   r8   rÛ   ü  s    ÿÿz,easy_install.install_exe.<locals>.<listcomp>)r    r²   )r1   r   r%   r5  r   r;   r<   r%  Úegg_namerj  r    r&   Ú	_providerÚ
exe_to_eggr=   r2  rH  ÚitemsrS   Útitler3  r°   r  r  r   Úmake_zipfiler    r²   r¦  )r¤   rˆ  rb  ÚcfgrÁ   r¹  Úegg_tmpÚ	_egg_infoÚpkg_infrb   ÚkÚvr7   rÎ  r8   r§  Ú  sD   ÿ
ý

€þÿzeasy_install.install_exec                    s8  t |ƒ‰g ‰g ‰i ‰‡ ‡‡‡‡fdd„}t|ˆ |ƒ g }ˆD ]7}| ¡  d¡rU| d¡}|d }t |d ¡d |d< tjj	ˆ g|¢R Ž }ˆ 
|¡ | 
|¡ t ||¡ q|  ˆ¡ t tj 	ˆ d¡t ˆ |¡¡ dD ]-}	tƒ |	 r™tj 	ˆ d|	d	 ¡}
tj |
¡s™t|
d
ƒ}| d 	tƒ |	 ¡d ¡ | ¡  qldS )z;Extract a bdist_wininst to the directories an egg would usec                    s   |   ¡ }ˆD ]l\}}| |¡rr|| t|ƒd …  } |  d¡}tjjˆ g|¢R Ž }|  ¡ }| d¡s6| d¡rTt 	|d ¡|d< dˆtj 
|d ¡d < ˆ | ¡ |  S | d¡rn|dkrndˆtj 
|d ¡d < ˆ |¡ |  S q|  d	¡s~t d
| ¡ d S )Nú/ú.pydú.dlléÿÿÿÿr<  r   r¥  úSCRIPTS/rA  zWARNING: can't process %s)rê   r­  r  rá   r;   r<   r%  rn  r   Ústrip_moduleÚsplitextrñ   r   rs   )ÚsrcrŠ  rJ   ÚoldÚnewÚpartsrl  ©rÖ  Únative_libsÚprefixesÚ
to_compileÚ	top_levelr7   r8   Úprocess  s(   


ý
ô
z(easy_install.exe_to_egg.<locals>.processrÜ  rÛ  rÞ  r¥  r´  )rê  rç  z.txtr+  rO   N)r2   r   rê   rn  rá   r   rà  r;   r<   r%  rñ   Ú
write_stubÚbyte_compileÚwrite_safety_flagÚanalyze_eggr¾   r=   r2  rH  r3  )r¤   rˆ  rÖ  rë  ÚstubsÚresrå  ÚresourceÚpyfiler  Útxtrb   r7   ræ  r8   rÑ    s>   


€

þ

€úzeasy_install.exe_to_eggc              
   C   sì   t |ƒ}| ¡ s
J ‚tj | j| ¡ ¡}tj |¡}| js!t	|ƒ tj 
|¡r6tj |¡s6tj|| jd ntj |¡rG|  tj|fd| ¡ z|  |j|fdtj |¡tj |¡f ¡ W t|dd nt|dd w |  |¡ |  |¡S )Nrº  r»  zInstalling %s to %sFr¿  )r   Úis_compatibler;   r<   r%  rw   rÏ  r¬  r²   r    r³   r§   r   rÁ  r=   r  rµ   Úinstall_as_eggrM  rG  rÆ  r[  rq  )r¤   Ú
wheel_pathrb  ÚwheelrÇ  r7   r7   r8   r¨  =  s4   ý

þý	

zeasy_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           	      C   s^   d}| j r| js|d| j 7 }| jtttjƒvr|d| j 7 }|j	}|j
}|j}d}|tƒ  S )z9Helpful installation message for display to package usersz
%(what)s %(eggloc)s%(extras)srO   rÈ   )r   r†   Ú_easy_install__mv_warningrw   r¬   r   r»   r<   Ú_easy_install__id_warningrj  ro  ro   r¾   )	r¤   ÚreqrÁ   Úwhatr  Úegglocr  ro   Úextrasr7   r7   r8   rz  k  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.
        c                 C   s"   t j |¡}tj}d| jtƒ   S )NrO   )r;   r<   rG  r»   rI  Ú_easy_install__editable_msgr¾   )r¤   r  r²  rG  Úpythonr7   r7   r8   r®  „  s   zeasy_install.report_editablec              
   C   sÚ   t j dt¡ t j dt¡ t|ƒ}| jdkr'd| jd  }| dd| ¡ n| jdk r2| dd¡ | jr;| dd	¡ t	 
d
|t|ƒd d … d |¡¡ zt||ƒ W d S  tyl } ztd|jd f ƒ|‚d }~ww )Nzdistutils.command.bdist_eggzdistutils.command.egg_inforÆ   rÚ  r<  r   rÍ  z-qz-nzRunning %s %sú zSetup script exited with %s)r»   ÚmodulesÚ
setdefaultr   r   r«   r    rô   r²   r   r±   r  r%  r   r¿   r   r}   )r¤   r²  r‰  r}   rÚ  r7   r7   r8   r   ‰  s.   

ÿÿþ€ÿzeasy_install.run_setupc           	   	   C   sÊ   ddg}t jdtj |¡d}zJ|  tj |¡¡ | |¡ |  |||¡ t|gƒ}g }|D ]}|| D ]}| |  	|j
|¡¡ q4q.|sM| jsMt d|¡ |W t|ƒ t | j¡ S t|ƒ t | j¡ w )Nr   z
--dist-dirzegg-dist-tmp-)r…   Údirz+No eggs found in %s (setup script problem?))r`  ra  r;   r<   rG  Ú_set_fetcher_optionsrñ   r   r#   r¦  rj  r²   r   rs   r´   r  r    )	r¤   r²  r‰  r}   Údist_dirÚall_eggsÚeggsr^  rÁ   r7   r7   r8   r¯  Ÿ  s.   ÿ

ÿ
ÿÿzeasy_install.build_and_installc           	      C   sh   | j  d¡ ¡ }d}i }| ¡ D ]\}}||vrq|d ||< qt|d}tj |d¡}t 	||¡ dS )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™   rz   r~   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_filenamer7   r7   r8   r  ·  s   	
z!easy_install._set_fetcher_optionsc                 C   sJ  | j d u rd S | j |j D ]%}| js|j|jkrqt d|¡ | j  |¡ |j| jv r2| j |j¡ q| js]|j| j jv rDt d|¡ nt d|¡ | j  	|¡ |j| jvr]| j 
|j¡ | jrbd S | j  ¡  |jdkrnd S tj | jd¡}tj |¡rt |¡ t|dƒ}| | j  |j¡d ¡ W d   ƒ d S 1 sžw   Y  d S )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   rj  r   r±   ry  ró   Úpathsrx  rñ   r²   Úsaver;   r<   r%  rw   r§   rµ   r2  rH  Úmake_relative)r¤   rÁ   r\   r©   rb   r7   r7   r8   rw  Î  s>   
€þ


"ÿzeasy_install.update_pthc                 C   s   t  d||¡ |S )NzUnpacking %s to %s)r   Údebug)r¤   râ  rŠ  r7   r7   r8   r«  ÷  s   zeasy_install.unpack_progressc                    sh   g ‰g ‰‡ ‡‡fdd„}t |||ƒ ˆ  ˆ¡ ˆ js0ˆD ]}t |¡tj dB d@ }t||ƒ qd S d S )Nc                    sZ   |  d¡r|  d¡sˆ |¡ n|  d¡s|  d¡rˆ |¡ ˆ  | |¡ ˆ j r+|p,d S )Nr¥  ú	EGG-INFO/rÝ  z.so)rn  r­  rñ   r«  r²   )râ  rŠ  ©r¤   Úto_chmodré  r7   r8   Úpf   s   
z+easy_install.unpack_and_compile.<locals>.pfim  ií  )r   rí  r²   r;   ÚstatÚST_MODErŸ  )r¤   r¹  rÇ  r  rb   r   r7   r  r8   rÄ  ü  s   
ýzeasy_install.unpack_and_compilec              	   C   s†   t jrd S ddlm} z0t | jd ¡ ||dd| jd | jr3||| jd| jd W t | j¡ d S W t | j¡ d S t | j¡ w )Nr   )rí  r<  )r~   Úforcer²   )	r»   Údont_write_bytecodeÚdistutils.utilrí  r   r  r    r²   r~   )r¤   ré  rí  r7   r7   r8   rí    s   þúzeasy_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.
        c                 C   sb   | j sdS ttj d¡ƒ}| j ¡ D ]\}}| |¡r.tj |¡s.|  	d| ¡ t 
|d¡ qdS )zCreate directories under ~.Nú~zos.makedirs('%s', 0o700)iÀ  )rq   r   r;   r<   rÙ   ræ   rÒ  r­  r³   Údebug_printr-  )r¤   Úhomer  r<   r7   r7   r8   r  B  s   €ýzeasy_install.create_home_pathrÅ   )z2.3z2.4z2.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/Scriptsc                 G   sø   |   d¡j}| js| jrP| jr| jdv rd}d| _n| js"dtjv r&tj}nd}| ¡ }| j|d< | j	 
|| j¡}| ¡ D ]\}}t| |d ƒd u rOt| ||ƒ q=dd	lm} |D ]!}t| |ƒ}|d ury|||ƒ}tjd
krstj |¡}t| ||ƒ qXd S )NrØ   rÓ   r)  r×   r$  r(  rY  r   )r   r   )Úget_finalized_commandræ   r…   r›   r»   Ú__dict__r;   r  r
  r
   r5  ÚDEFAULT_SCHEMErÒ  rå   r	  r   r   r<   rÙ   )r¤   r
  ræ   r  ru  r  r  r   r7   r7   r8   rí   i  s2   
€


€úzeasy_install._expand)T)Fr¦   )r›  r7   )rù  )QÚ__name__Ú
__module__Ú__qualname__Ú__doc__ÚdescriptionÚcommand_consumes_argumentsr   r“   Úuser_optionsÚboolean_optionsÚnegative_optr   rõ   r¥   r°   r­   ÚstaticmethodrÃ   rÿ   rç   r  rè   ré   r  r'  r  rò   rP   rQ   Úlstripr=  r?  r@  r0  r1  rW  r[  r]  r_  Ú
contextlibÚcontextmanagerrc  r/   rf  r  ri  r„  rŒ  rU  rS  r’  r  rp  rq  r¦  r§  rÑ  r¨  rú  rû  rz  r   r®  r   r¯  r  rw  r«  rÄ  rí  rR   r6  r  r»   ro   r+  Úsitedir_namer  r
   r,  rí   r7   r7   r7   r8   r/   n   s    â :	

 	
-ôüò	;



!$
ÿ)	



3	6.5	÷

	÷)â  
þþþþóþr/   c                  C   s    t j dd¡ t j¡} td | ƒS )Nr,  rÈ   )r;   r4  r5  rá   ÚpathsepÚfilter)rÒ  r7   r7   r8   Ú_pythonpath‡  s   
r=  c                     s¨  g ‰ ˆ   tƒ ¡ tjg} tjtjkr|  tj¡ | D ]w}|sqtjdv r0ˆ  tj 	|dd¡¡ n:tj
dkr]ˆ   tj 	|ddtjdd…  d	¡tj 	|d
djtjŽ d	¡tj 	|d
d¡g¡ nˆ   |tj 	|d
d¡g¡ tjdkrpqd|vruqtj d¡}|s~qtj 	|dddjtjŽ d¡}ˆ  |¡ qtdƒtdƒf}ˆ   ‡ fdd„|D ƒ¡ tjr¯ˆ  tj¡ t t¡ ˆ   t ¡ ¡ W d  ƒ n1 sÆw   Y  tttˆ ƒƒ‰ ˆ S )z&
    Return a list of 'site' dirs
    )Úos2emxÚriscosÚLibr%  rÛ  z	local/libr  NrÅ   r&  Úlibzpython{}.{}zsite-pythonÚdarwinzPython.frameworkÚHOMEÚLibraryÚPythonr¸   ÚpurelibÚplatlibc                 3   s    | ]	}|ˆ vr|V  qd S r¦   r7   rÚ   ©Úsitedirsr7   r8   rª   Ë  s   € z get_site_dirs.<locals>.<genexpr>)Úextendr=  r»   r…   rÄ   rñ   rÉ  r;   r<   r%  Úsepro   rº   r¼   r4  r5  r   r   r   r“   r8  ÚsuppressÚAttributeErrorÚgetsitepackagesr«   r¬   r   )rè  r…   r#  Úhome_spÚ	lib_pathsr7   rH  r8   rï   Œ  sl   

ü
üóþ

ûÿrï   c                 c   sè    i }| D ]l}t |ƒ}||v rqd||< tj |¡sqt |¡}||fV  |D ]I}| d¡s/q'|dv r4q'ttj ||¡ƒ}tt	|ƒƒ}| 
¡  |D ]&}| d¡rQqIt | ¡ ƒ}||v r\qId||< tj |¡sgqI|t |¡fV  qIq'qdS )zBYield sys.path directories that might contain "old-style" packagesr<  rA  )r*  r  ÚimportN)r   r;   r<   r³   r…  rn  r2  r%  r«   r   r3  r­  Úrstrip)ÚinputsÚseenrG  rZ  r  rb   ÚlinesÚliner7   r7   r8   Úexpand_pathsØ  s@   €



ôòôrW  c                 C   sT  t | dƒ}zŸt |¡}|du rW | ¡  dS |d |d  |d  }|dk r-W | ¡  dS | |d ¡ t d| d¡¡\}}}|dvrKW | ¡  dS | |d|  ¡ d	d	d
œ}t 	|¡}z| |¡}	|	 
dd¡d }
|
 t ¡ ¡}
| t |
¡¡ W n tjyŒ   Y W | ¡  dS w | d¡r—| d¡sžW | ¡  dS |W | ¡  S | ¡  w )znExtract configuration data from a bdist_wininst .exe

    Returns a configparser.RawConfigParser, or None
    ÚrbNé	   é   é   é   z<iii)izV4i{V4rÈ   )ro   rË  ó    r<  r   rµ  ÚSetup)r2  ÚzipfileÚ_EndRecDatar3  Úseekr5   ÚunpackÚreadÚconfigparserÚRawConfigParserrá   r™  r»   ÚgetfilesystemencodingÚ	read_fileÚioÚStringIOÚErrorÚhas_section)rˆ  rb   ÚendrecÚ	prependedÚtagÚcfglenÚbmlenÚinitrÕ  ÚpartÚconfigr7   r7   r8   r1     s@   

åèî


ùýr1   c              	   C   s6  g d¢}t  | ¡}z{| ¡ D ]p}|j}| d¡}t|ƒdkr<|d dkr<|d  d¡r<| dd |d	d… ¡d
f¡  nCt|ƒdksG| d¡sHq| d¡rNq|d  	¡ dv r~| 
|¡ ¡ }t|ƒD ]}| ¡  dd¡}| d¡s}| d|d |f df¡ qaqW | ¡  n| ¡  w dd„ |D ƒ}| ¡  | ¡  |S )z4Get exe->egg path translations for a given .exe file))zPURELIB/rÈ   )zPLATLIB/pywin32_system32rÈ   )zPLATLIB/rÈ   )rß  zEGG-INFO/scripts/)zDATA/lib/site-packagesrÈ   rÛ  rÅ   rÆ   rÊ  r<  z	.egg-infor   Nr  rA  z
-nspkg.pth)ÚPURELIBÚPLATLIBú\rQ  z%s/%s/rÈ   c                 S   s   g | ]
\}}|  ¡ |f‘qS r7   )rê   )r¨   r^   Úyr7   r7   r8   rÛ   N  r  z$get_exe_prefixes.<locals>.<listcomp>)r_  ÚZipFileÚinfolistr©   rá   r  rn  rô   r%  Úupperrc  r™  r   rR   rS   r­  rñ   r3  ÚsortÚreverse)Úexe_filenamerè  rW   r±   r  rå  r‹  Úpthr7   r7   r8   r2   /  s4   



€r2   c                   @   sR   e Zd ZdZdZddd„Zdd„ Zdd	„ Zed
d„ ƒZ	dd„ Z
dd„ Zdd„ ZdS )r0   z)A .pth file with Distribution paths in itFr7   c                 C   sl   || _ ttt|ƒƒ| _ttj | j ¡ƒ| _|  	¡  t
 | g d d ¡ t| jƒD ]}tt| jt|dƒƒƒ q&d S )NT)r©   r«   r¬   r   rI  r;   r<   rG  ÚbasedirÚ_loadr#   Ú__init__r   r  rx  r"   )r¤   r©   rI  r<   r7   r7   r8   r  Y  s   ÿzPthDistributions.__init__c                 C   s  g | _ d}t | j¡}tj | j¡ret| jdƒ}|D ]F}| 	d¡r$d}q| 
¡ }| j  |¡ | ¡ r9| ¡  	d¡r:qttj | j|¡ƒ }| j d< tj |¡rS||v r\| j  ¡  d| _qd||< q| ¡  | j rm|smd| _| j rˆ| j d  ¡ sŒ| j  ¡  | j rŠ| j d  ¡ rwd S d S d S d S )NFÚrtrQ  Tú#rÞ  r<  )r  r  ÚfromkeysrI  r;   r<   rª  r©   r2  r­  rR  rñ   rR   r   r%  r  r=   ÚpopÚdirtyr3  )r¤   Ú
saw_importrT  rb   rV  r<   r7   r7   r8   r€  b  s6   
ÿ



$ÿzPthDistributions._loadc                 C   sÊ   | j sdS tt| j| jƒƒ}|rLt d| j¡ |  |¡}d 	|¡d }t
j | j¡r0t
 | j¡ t| jdƒ}| |¡ W d  ƒ n1 sFw   Y  nt
j | j¡r`t d| j¡ t
 | j¡ d| _ dS )z$Write changed .pth file back to diskNz	Saving %srO   r  zDeleting empty %sF)r†  r«   r¬   r  r  r   r  r©   Ú_wrap_linesr%  r;   r<   r§   rµ   r2  rH  r=   )r¤   Ú	rel_pathsrU  Údatarb   r7   r7   r8   r    s"   
ÿ€
zPthDistributions.savec                 C   ó   | S r¦   r7   )rU  r7   r7   r8   rˆ  —  s   zPthDistributions._wrap_linesc                 C   sN   |j | jvo|j | jvp|j t ¡ k}|r| j |j ¡ d| _t | |¡ dS )z"Add `dist` to the distribution mapTN)	rj  r  rI  r;   Úgetcwdrñ   r†  r#   rx  )r¤   rÁ   Únew_pathr7   r7   r8   rx  ›  s   üzPthDistributions.addc                 C   s<   |j | jv r| j |j ¡ d| _|j | jv st | |¡ dS )z'Remove `dist` from the distribution mapTN)rj  r  ry  r†  r#   rƒ  r7   r7   r8   ry  ©  s
   þzPthDistributions.removec                 C   s–   t j t|ƒ¡\}}t| jƒ}|g}t jdkrdpt j}t|ƒ|krI|| jkr6| t j	¡ | 
¡  | |¡S t j |¡\}}| |¡ t|ƒ|ks"|S )NrÛ  )r;   r<   rá   r   r  r  ÚaltseprK  rñ   Úcurdirr|  r%  )r¤   r<   ÚnpathÚlastÚbaselenrå  rK  r7   r7   r8   r  °  s   



úzPthDistributions.make_relativeN)r7   )r-  r.  r/  r0  r†  r  r€  r  r6  rˆ  rx  ry  r  r7   r7   r7   r8   r0   T  s    
	
r0   c                   @   s(   e Zd Zedd„ ƒZedƒZedƒZdS )ÚRewritePthDistributionsc                 c   s&    | j V  |D ]}|V  q| jV  d S r¦   )ÚpreludeÚpostlude)ÚclsrU  rV  r7   r7   r8   rˆ  Á  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ˆ  rU   r”  r•  r7   r7   r7   r8   r“  À  s
    
r“  ÚSETUPTOOLS_SYS_PATH_TECHNIQUEÚrawÚrewritec                   C   s    t tjtƒrtS t tj ¡ ¡S )z_
    Return a regular expression based on first_line_re suitable for matching
    strings.
    )r÷   r   Úpatternrø   ÚreÚcompiler™  r7   r7   r7   r8   Ú_first_line_reÚ  s   rž  c                 C   sX   | t jt jfv rt jdkrt|tjƒ | |ƒS t ¡ \}}}|d |d d| |f  f‚)Nr  r   r<  z %s %s)	r;   rµ   ry  r  rŸ  r  ÚS_IWRITEr»   r>  )ÚfuncÚargÚexcÚetÚevrÌ  r7   r7   r8   Ú
auto_chmodæ  s
   r¥  c                 C   s0   t | ƒ}t|tjƒ |rt|ƒ dS t|ƒ dS )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_pathr7   r7   r8   rÆ  ï  s
   <rÆ  c                 C   sP   g }t | ƒ}|D ]}t|ƒ}| | ¡r%|||d … tjdfv r%| |¡ 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È   )r  r   r­  r;   rK  rñ   )r«  ÚcacheÚresultÚ
prefix_lenÚpÚnpr7   r7   r8   Ú"_collect_zipimporter_cache_entriesA  s   


€r±  c                 C   s@   t | |ƒD ]}|| }||= |o|||ƒ}|dur|||< qdS )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_entryr7   r7   r8   Ú_update_zipimporter_cacheU  s   
€òrµ  c                 C   s   t | |ƒ d S r¦   )rµ  )r«  r¬  r7   r7   r8   r¦  u  r:   r¦  c                 C   ó   dd„ }t | tj|d d S )Nc                 S   s   |  ¡  d S r¦   )Úclear©r<   r³  r7   r7   r8   Ú2clear_and_remove_cached_zip_archive_directory_dataz  s   zf_remove_and_clear_zip_directory_cache_data.<locals>.clear_and_remove_cached_zip_archive_directory_data©r²  ©rµ  r¶  Ú_zip_directory_cache)r«  r¹  r7   r7   r8   r©  y  s
   
þr©  Ú__pypy__c                 C   r¶  )Nc                 S   s&   |  ¡  t | ¡ | tj|  ¡ |S r¦   )r·  r¶  r·  Úupdater¼  r¸  r7   r7   r8   Ú)replace_cached_zip_archive_directory_data  s   
zT_replace_zip_directory_cache_data.<locals>.replace_cached_zip_archive_directory_datarº  r»  )r«  r¿  r7   r7   r8   r¨    s
   
þr¨  ú<string>c              	   C   s,   z	t | |dƒ W dS  ttfy   Y dS w )z%Is this string a valid Python script?ÚexecFT)r  ÚSyntaxErrorÚ	TypeError)rT   r©   r7   r7   r8   Ú	is_python¢  s   ýÿrÄ  c              	   C   sh   z&t j| dd}| d¡}W d  ƒ n1 sw   Y  W |dkS W |dkS  ttfy3   |  Y S w )zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1)ÚencodingrÆ   Nú#!)rh  r2  rc  r.  r/  )rI  ÚfpÚmagicr7   r7   r8   Úis_sh¬  s   ÿüþÿrÉ  c                 C   s   t  | g¡S )z@Quote a command line argument according to Windows parsing rules©Ú
subprocessÚlist2cmdline)r¡  r7   r7   r8   Únt_quote_arg¶  s   rÍ  c                 C   sH   |  d¡s
|  d¡rdS t| |ƒrdS |  d¡r"d|  ¡ d  ¡ v S dS )zMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc.
    r¥  ú.pywTrÆ  r  r   F)rn  rÄ  r­  Ú
splitlinesrê   )r”  r©   r7   r7   r8   r‘  »  s   

r‘  )rŸ  c                  G   r(  r¦   r7   )r}   r7   r7   r8   Ú_chmodÍ  r)  rÐ  c              
   C   sT   t  d| |¡ zt| |ƒ W d S  tjy) } zt  d|¡ W Y d }~d S d }~ww )Nzchanging mode of %s to %ozchmod failed: %s)r   r  rÐ  r;   Úerror)r<   r   ri   r7   r7   r8   rŸ  Ñ  s   €ÿrŸ  c                   @   sŠ   e Zd ZdZg Zeƒ Zedd„ ƒZedd„ ƒZ	edd„ ƒZ
edd	„ ƒZed
d„ ƒZdd„ Zedd„ ƒZdd„ Zedd„ ƒZedd„ ƒZdS )ÚCommandSpeczm
    A command spec for a #! header, specified as a list of arguments akin to
    those passed to Popen.
    c                 C   r‹  )zV
        Choose the best CommandSpec class based on environmental conditions.
        r7   ©r–  r7   r7   r8   rŽ  â  s   zCommandSpec.bestc                 C   s   t j tj¡}t j d|¡S )NÚ__PYVENV_LAUNCHER__)r;   r<   r?   r»   rI  r4  r5  )r–  Ú_defaultr7   r7   r8   Ú_sys_executableé  s   zCommandSpec._sys_executablec                 C   s:   t || ƒr|S t |tƒr| |ƒS |du r|  ¡ S |  |¡S )zg
        Construct a CommandSpec from a parameter to build_scripts, which may
        be None.
        N)r÷   r«   Úfrom_environmentÚfrom_string)r–  Úparamr7   r7   r8   Ú
from_paramî  s   


zCommandSpec.from_paramc                 C   s   | |   ¡ gƒS r¦   )rÖ  rÓ  r7   r7   r8   r×  ý  s   zCommandSpec.from_environmentc                 C   s   t j|fi | j¤Ž}| |ƒS )z}
        Construct a command spec from a simple string representing a command
        line parseable by shlex.split.
        )Úshlexrá   Ú
split_args)r–  ÚstringrÒ  r7   r7   r8   rØ    s   zCommandSpec.from_stringc                 C   s<   t  |  |¡¡| _t | ¡}t|ƒsdg| jd d…< d S d S )Nz-xr   )rÛ  rá   Ú_extract_optionsÚoptionsrË  rÌ  rN   )r¤   r”  Úcmdliner7   r7   r8   Úinstall_options
  s
   
ÿzCommandSpec.install_optionsc                 C   s:   | d   ¡ d }tƒ  |¡}|r| d¡pdnd}| ¡ S )zH
        Extract any options from the first line of the script.
        rO   r   r<  rÈ   )rÏ  rž  ÚmatchÚgrouprR   )Úorig_scriptÚfirstrâ  rß  r7   r7   r8   rÞ    s   € zCommandSpec._extract_optionsc                 C   s   |   | t| jƒ ¡S r¦   )Ú_renderr«   rß  r£   r7   r7   r8   Ú	as_header  s   zCommandSpec.as_headerc                 C   s6   d}|D ]}|   |¡r|  |¡r| dd…   S q| S )Nz"'r<  rÞ  )r­  rn  )ÚitemÚ_QUOTESÚqr7   r7   r8   Ú_strip_quotes  s   €zCommandSpec._strip_quotesc                 C   s    t  dd„ | D ƒ¡}d| d S )Nc                 s   s    | ]
}t  | ¡ ¡V  qd S r¦   )rÒ  rë  rR   )r¨   rè  r7   r7   r8   rª   '  s   € 
ÿz&CommandSpec._render.<locals>.<genexpr>rÆ  rO   rÊ  )rÒ  rà  r7   r7   r8   ræ  %  s   
ÿzCommandSpec._renderN)r-  r.  r/  r0  rß  r  rÜ  r—  rŽ  rÖ  rÚ  r×  rØ  rá  r6  rÞ  rç  rë  ræ  r7   r7   r7   r8   rÒ  Ù  s,    





	
rÒ  c                   @   s   e Zd ZeddZdS )ÚWindowsCommandSpecF)r   N)r-  r.  r/  r  rÜ  r7   r7   r7   r8   rì  0  s    rì  c                   @   sŠ   e Zd ZdZe d¡ ¡ ZeZ	e
ddd„ƒZe
ddd„ƒZe
dd	d
„ƒZedd„ ƒZe
dd„ ƒZe
dd„ ƒZe
dd„ ƒZe
ddd„ƒZdS )r  z`
    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)())
        NFc                 C   s6   t  dt¡ |r
tnt ¡ }|  d||¡}| ||¡S )NzUse get_argsrÈ   )rr   rs   rt   ÚWindowsScriptWriterr  rŽ  Úget_script_headerr  )r–  rÁ   rI  ÚwininstÚwriterÚheaderr7   r7   r8   Úget_script_args_  s   zScriptWriter.get_script_argsc                 C   s$   t jdtdd |rd}|  ||¡S )NzUse get_headerrÆ   )Ú
stacklevelrD  )rr   rs   rt   r“  )r–  r”  rI  rï  r7   r7   r8   rî  g  s   ÿzScriptWriter.get_script_headerc                 c   s‚    |du r	|   ¡ }t| ¡ ƒ}dD ]-}|d }| |¡ ¡ D ]\}}|  |¡ | jtƒ  }|  ||||¡}	|	D ]}
|
V  q7qqdS )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ñ  r7   r7   r8   r  p  s   €
ÿüþzScriptWriter.get_argsc                 C   s   t  d| ¡}|rtdƒ‚dS )z?
        Prevent paths in *_scripts entry point names.
        z[\\/]z+Path separators not allowed in script namesN)rœ  Úsearchrü   )r  Úhas_path_sepr7   r7   r8   rù  ‚  s   ÿzScriptWriter._ensure_safe_namec                 C   s    t  dt¡ |rt ¡ S |  ¡ S ©NzUse best)rr   rs   rt   rí  rŽ  )r–  Úforce_windowsr7   r7   r8   Ú
get_writer‹  s   zScriptWriter.get_writerc                 C   s*   t jdkstjdkrtjdkrt ¡ S | S )zD
        Select the best ScriptWriter for this environment.
        Úwin32Újavar  )r»   rÉ  r;   r  Ú_namerí  rŽ  rÓ  r7   r7   r8   rŽ  ‘  s   zScriptWriter.bestc                 c   s    ||| fV  d S r¦   r7   )r–  rü  r  rñ  r”  r7   r7   r8   rû  ›  s   €zScriptWriter._get_script_argsrÈ   c                 C   s"   | j  ¡  |¡}| |¡ | ¡ S )z;Create a #! line, getting options (if any) from script_text)Úcommand_spec_classrŽ  rÚ  rá  rç  )r–  r”  rI  Úcmdr7   r7   r8   r“     s   
zScriptWriter.get_header)NFr¦   )rÈ   N)r-  r.  r/  r0  rP   rQ   r7  rú  rÒ  r  r—  rò  rî  r  r6  rù  r  rŽ  rû  r“  r7   r7   r7   r8   r  4  s,    !ß#


	
r  c                   @   sL   e Zd ZeZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZ	e
d	d
„ ƒZdS )rí  c                 C   s   t  dt¡ |  ¡ S r   )rr   rs   rt   rŽ  rÓ  r7   r7   r8   r  «  s   zWindowsScriptWriter.get_writerc                 C   s"   t t| d}tj dd¡}|| S )zC
        Select the best ScriptWriter suitable for Windows
        )rI  ÚnaturalÚSETUPTOOLS_LAUNCHERrI  )r  ÚWindowsExecutableLauncherWriterr;   r4  r5  )r–  Úwriter_lookupÚlauncherr7   r7   r8   rŽ  ±  s   þzWindowsScriptWriter.bestc           	      #   s’    t ddd| }|tjd  ¡  d¡vr$djdi tƒ ¤Ž}t |t	¡ g d¢}| 
|¡ |  ||¡}‡ fdd	„|D ƒ}ˆ | || d
|fV  d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 | ]}ˆ | ‘qS r7   r7   rœ  ©r  r7   r8   rÛ   Ë  rÝ   z8WindowsScriptWriter._get_script_args.<locals>.<listcomp>r›  Nr7   )r  r;   r4  rê   rá   rº   r¾   rr   rs   ÚUserWarningry  Ú_adjust_header)	r–  rü  r  rñ  r”  Úextr  rã  r®   r7   r  r8   rû  ¾  s   €ýý
z$WindowsScriptWriter._get_script_argsc                 C   sN   d}d}|dkr||}}t  t  |¡t j¡}|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).
        rC  rD  rö  )rÝ  Úrepl)rœ  r  ÚescapeÚ
IGNORECASEÚsubÚ_use_header)r–  rü  Úorig_headerr›  r  Ú
pattern_obÚ
new_headerr7   r7   r8   r  Î  s   
z"WindowsScriptWriter._adjust_headerc                 C   s$   | dd…   d¡}tjdkp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  )rR   r»   rÉ  r   )r  Úclean_headerr7   r7   r8   r  Ü  s   	zWindowsScriptWriter._use_headerN)r-  r.  r/  rì  r  r—  r  rŽ  rû  r  r6  r  r7   r7   r7   r8   rí  ¨  s    



rí  c                   @   s   e Zd Zedd„ ƒZdS )r
  c                 #   s˜    |dkrd}d}dg}nd}d}g d¢}|   ||¡}‡ fdd„|D ƒ}	ˆ | || d	|	fV  ˆ d
 t|ƒdfV  tƒ sJˆ d }
|
tˆ ƒd	fV  dS dS )zG
        For Windows, add a .py extension and an .exe launcher
        rö  z-script.pywrÎ  Úclir  )r¥  r  r  c                    r  r7   r7   rœ  r  r7   r8   rÛ   ø  rÝ   zDWindowsExecutableLauncherWriter._get_script_args.<locals>.<listcomp>r›  r£  rc   z.exe.manifestN)r  Úget_win_launcherr9   Úload_launcher_manifest)r–  rü  r  rñ  r”  Úlauncher_typer  rã  Úhdrr®   Úm_namer7   r  r8   rû  ê  s$   €þùz0WindowsExecutableLauncherWriter._get_script_argsN)r-  r.  r/  r—  rû  r7   r7   r7   r8   r
  é  s    r
  c                 C   sJ   d|  }t ƒ rtƒ dkr| dd¡}n| dd¡}n| dd¡}td|ƒ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¹   )r9   r   rS   r   )ÚtypeÚlauncher_fnr7   r7   r8   r#  	  s   

r#  c                 C   s   t  td¡}| d¡tƒ  S )Nzlauncher manifest.xmlr˜  )Úpkg_resourcesr   r-  r™  Úvars)r  Úmanifestr7   r7   r8   r$   	  s   r$  Fc                 C   s   t  | ||¡S r¦   )r†  r´   )r<   Úignore_errorsÚonerrorr7   r7   r8   r´   %	  r:   r´   c                  C   s   t  d¡} t  | ¡ | S )Né   )r;   Úumask)Útmpr7   r7   r8   rž  )	  s   

rž  c                   @   s   e Zd ZdZdS )rt   zF
    Warning for EasyInstall deprecations, bypassing suppression.
    N)r-  r.  r/  r0  r7   r7   r7   r8   rt   /	  s    rt   r¦   )rÀ  )|r0  r   r   r   r   r   Údistutils.errorsr   r   r   r	   Údistutils.command.installr
   r   r  r   r   Údistutils.command.build_scriptsr   rJ  r   r»   r;   r¶  r†  r`  r_  rœ  r  r"  rP   rr   r   r5   r8  rË  rÛ  rh  rd  rë   r   r   r¹   r   r   Úsetuptools.sandboxr   Úsetuptools.commandr   Úsetuptools.archive_utilr   Úsetuptools.package_indexr   r   r   r   r   Úsetuptools.wheelr   r+  r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   ÚfilterwarningsÚPEP440WarningÚ__all__r9   r.   rK   rN   rU   r/   r=  rï   rW  r1   r2   r0   r“  r4  r5  rž  r¥  rÆ  r±  rµ  r¦  r©  Úbuiltin_module_namesr¨  rÄ  rÉ  rÍ  r‘  rŸ  rÐ  ÚImportErrorr«   rÒ  rÖ  Úsys_executablerì  r  rí  r
  rò  rî  r#  r$  r´   rž  rt   r7   r7   r7   r8   Ú<module>   sÆ    D          #L.)%l	R
 ÿ


þTtA 