
    09oeN                       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 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&Z&ddl&m'Z' ddl(m)Z) ddl(m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0 ddl1m2Z2m3Z3m4Z4 ddl-m5Z5m6Z6 ddl7m8Z8 ddl9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZF dd
l9Z9ddlGmHZH ddlImJZJ  ejK        de9jL                   g dZMd ZNd ZOd ZPd ZQ G d d e*          ZRd! ZSd" ZTd# ZUd$ ZVd% ZW G d& d'e>          ZX G d( d)eX          ZYejZ        [                    d*d+          d,k    reYZXd- Z\d. Z]d/ Z^d0 Z_dPd1Z`d2 Zad3 Zbd4ejc        v rebZdnd5 ZddQd7Zed8 Zfd9 Zgd: Zh	 dd;lmiZj n# ek$ r d< ZjY nw xY wd= Zi G d> d?el          Zmemn                                Zo G d@ dAem          Zp G dB dC          Zq G dD dEeq          Zr G dF dGer          Zseqjt        Zteqju        ZudH ZvdI ZwdJe]fdKZxdL ZydM Zz G dN dOe)          Z{d
S )Ra)  
Easy Install
------------

A tool for doing automatic download/extract/build of distutils-based Python
packages.  For detailed documentation, see the accompanying EasyInstall.txt
file, or visit the `EasyInstall home page`__.

__ https://setuptools.pypa.io/en/latest/deprecated/easy_install.html

    )glob)get_platform)convert_path
subst_vars)DistutilsArgErrorDistutilsOptionErrorDistutilsErrorDistutilsPlatformError)logdir_util)first_line_re)find_executable)installN)get_path)SetuptoolsDeprecationWarning)Command)	run_setup)setopt)unpack_archive)PackageIndexparse_requirement_arg
URL_SCHEME)	bdist_eggegg_info)Wheel)normalize_pathresource_stringget_distributionfind_distributionsEnvironmentRequirementDistributionPathMetadataEggMetadata
WorkingSetDistributionNotFoundVersionConflictDEVELOP_DIST   )ensure_directory)yield_linesdefault)category)easy_installPthDistributionsextract_wininst_cfgget_exe_prefixesc                  2    t          j        d          dk    S )NP   )structcalcsize     XD:\Python Project\StaffProfile\venv\Lib\site-packages\setuptools/command/easy_install.pyis_64bitr:   N   s    ?31$$r8   c                 ,    |                      d          S )Nutf8)encodess    r9   	_to_bytesr@   R   s    88Fr8   c                 T    	 |                      d           dS # t          $ r Y dS w xY w)NasciiTF)r=   UnicodeErrorr>   s    r9   isasciirD   V   s@    	t   uus    
''c                 v    t          j        |                                                               dd          S )N
z; )textwrapdedentstripreplace)texts    r9   
_one_linerrL   ^   s.    ?4  &&((00t<<<r8   c                      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ej        z  fgZg dZ	ddiZ
eZd Zd  Zd! Zed"             Zd# Zed$             Zed%             Zd& Zd' Zd( Zd) Zdad*Zd+ Zd, Zd- Z ej        d.                                          Z  ej        d/                                          Z! ej        d0                                          Z"d1 Z#d2 Z$d3 Z%d4 Z&d5 Z'd6 Z(e)j*        d7             Z+dbd9Z,dbd:Z-d; Z.	 dad<Z/d= Z0d> Z1d? Z2dcd@Z3edA             Z4dddDZ5dE Z6dF Z7dG Z8dH Z9dI Z:dJ Z; ej        dK                                          Z< ej        dL          Z=dedNZ> ej        dO                                          Z?dP Z@dQ ZAdR ZBdS ZCdT ZDdU ZEdV ZFdW ZG ej        dX          H                                ZIdY ZJ eK eKdZd[\          ]          ZL eKd^d_\          ZMd` ZNdS )fr.   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=r?   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no-find-linksNz9Don't load find-links defined in packages being installeduserNz!install in user site-package '%s')
rN   rP   rU   rR   rW   r`   rb   re   rg   rh   r]   rN   c                    t          j        dt                     d| _        d x| _        | _        d x| _        x| _        | _        d | _	        d | _
        d | _        d | _        d x| _        | _        d x| _        x| _        | _        d x| _        x| _        | _        d x| _        x| _        | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _         tB          j"        | _#        tB          j$        | _%        d | _&        d | _'        d x| _(        | _)        d | _*        i | _+        d | _,        | j-        j.        | _.        | j-        /                    | | j-        0                    d                     d S )NzVeasy_install command is deprecated. Use build and pip and other standards-based tools.r   r.   )1warningswarnEasyInstallDeprecationWarningrh   zip_oklocal_snapshots_okinstall_dir
script_direxclude_scripts	index_url
find_linksbuild_directoryargsoptimizerecordrR   always_copymulti_versionr`   no_depsallow_hostsrootprefix	no_reportrg   install_purelibinstall_platlibinstall_headersinstall_libinstall_scriptsinstall_datainstall_baseinstall_platbasesite	USER_BASEinstall_userbase	USER_SITEinstall_usersiteno_find_linkspackage_indexpth_filealways_copy_from	site_dirsinstalled_projects_dry_rundistributionverbose_set_command_optionsget_option_dictselfs    r9   initialize_optionszeasy_install.initialize_options   s   A)	
 	
 	
 	044d-DHHH4?T-A#	&**?CCCt'$*<:>>>t'7377	7DK$.####   $ $ $! "044-"$ (0..$#33NCC	
 	
 	
 	
 	
r8   c                 b    d |D             }t          t          | j        |                     d S )Nc              3      K   | ]D}t           j                            |          st           j                            |          @|V  Ed S N)ospathexistsislink).0filenames     r9   	<genexpr>z/easy_install.delete_blockers.<locals>.<genexpr>   s`       
 
!w~~h''
+-7>>(+C+C

 
 
 
 
 
r8   )listmap_delete_path)r   blockersextant_blockerss      r9   delete_blockerszeasy_install.delete_blockers   sC    
 
%-
 
 
 	S"O4455555r8   c                     t          j        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removers       r9   r   zeasy_install._delete_path   sm    %%%< 	F'--%%BbgnnT.B.B*B#2&&r8   c                       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tmpls      r9   _render_versionzeasy_install._render_version   sU    
 gnc./--Nkdk%%FHH%%&&&llr8   c                 L   | j         o|                                  t          j                                         d         }t	          t          j                              | _        | j                            | j	        
                                | j	                                        | j	                                        |t          j        j         dt          j        j         t          j        j         t          j        j         | j        d         | j        d         t!          t          dd          t!          t          dd          d	
           t#          j        t&                    5  | j                            t)          j                                                    t)          j                    d
           d d d            n# 1 swxY w Y   | j                            dt!          t          dd                              dd                     | j        | j        d<   | j        | j        d<   | j        r t8          j        st=          j        d           |                                   | !                                 | "                                 | #                    dddd           | j$        | j%        | _$        | j&        d| _&        | '                    dd           | '                    dd           | j        r| j(        r| j(        | _%        | j)        | _$        | '                    dd           tU                      | _+        | j+        ,                    | -                    | j.                             | j/        s| 0                                 tc          j2        dd          }| j3        p|| _3        | j+        d d          | _4        | j%        tk          | j$                  fD ]&}|| j4        vr| j4        6                    d|           '| j7        %d | j7                            d          D             }ndg}| j8        '| 9                    | j3        | j4        |           | _8        tu          | j4        t          j;        z             | _<        | j=        9t}          | j=        t~                    r| j=                                        | _=        ng | _=        | j@        r,| j8        A                    | j4        t          j;        z              | j&        s| j8        B                    | j=                   | '                    dd!           | C                    | jD                  | _D        | j/        r| jE        st          d"          | jG        st          d#          g | _H        d S )$Nr   .r}   exec_prefixabiflags 
platlibdirlib)
	dist_namedist_versiondist_fullname
py_versionpy_version_shortpy_version_nodot
sys_prefixsys_exec_prefixr   r   )implementation_lowerimplementationpy_version_nodot_platwindiruserbaseusersitez6WARNING: The user site-packages directory is disabled.ro   rp   rt   r   Fr   )ro   ro   r   ro   rp   r   )rw   rw   __EASYINSTALL_INDEXzhttps://pypi.org/simple/c                 6    g | ]}|                                 S r7   )rI   r   r?   s     r9   
<listcomp>z1easy_install.finalize_options.<locals>.<listcomp>0  s     DDD1QWWYYDDDr8   ,*)search_pathhosts)rv   rv   z9Must specify a build directory (-b) when using --editablez:No urls, filenames, or requirements specified (see --help))Irg   r   r   splitdict	sysconfigget_config_varsconfig_varsupdater   get_nameget_versionget_fullnamer   majorminorgetattr
contextlibsuppressAttributeErrorr   _get_implementationlower
setdefaultrJ   r   r   rh   r   ENABLE_USER_SITEr   rk   _fix_install_dir_for_user_siteexpand_basedirsexpand_dirs_expandrp   ro   r   set_undefined_optionsr   r   get_site_dirsall_site_dirsextend_process_site_dirsr   r`   check_site_dirr   getenvrr   shadow_pathr   insertr{   r   create_indexr    r   local_indexrs   
isinstancestrrn   scan_egg_linksadd_find_links_validate_optimizerv   rt   r   ru   outputs)r   r   default_index	path_itemr   s        r9   finalize_optionszeasy_install.finalize_options   s   /--//[&&((+
	 9 ; ;<<*3355 -99;;!.;;==$#&#3#9 T TC<L<R T T#&#3#9 S3;K;Q S S*84#/>Z44!#|U;;!
 !
 	 	 	  00 	 	##(/(C(E(E(K(K(M(M")"="?"?% %   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	###C2&&..sB77	
 	
 	

 (,'<$'+'<$9 	OT2 	OHMNNN++---<):	
 	
 	
 ?"".DO%!&D
 	""9	
 	
 	
 	""<	
 	
 	
 9 	3- 	3#3D"2DO""9.BCCC*__!!$"9"9$."I"IJJJ} 	"!!!	"79STT8=-aaa0)>$/+J+JJ 	6 	6I 000 ''9555'DD(8(>(>s(C(CDDDEEEE%!%!2!2D,<E "3 " "D 't'7#('BCC?&$/3// :"&/"7"7"9"9 DO" 	K--d.>.IJJJ! 	?--do>>>""=2JKKK//>>= 	!5 	#K   y 	N#LN N N s   +AG		GGc              #   j  K   | d S t          t          t          j                  }d |                     d          D             } | D ]k}t
          j                            |          st          j        d|           7t          |          |vrt          |dz             t          |          V  ld S )Nc                 p    g | ]3}t           j                            |                                          4S r7   )r   r   
expanduserrI   r   s     r9   r   z3easy_install._process_site_dirs.<locals>.<listcomp>U  s=     
 
 
./BGqwwyy))
 
 
r8   r   z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.path)
r   r   r   r   r   r   r   r   rk   r   )r   normpathrT   s      r9   r   zeasy_install._process_site_dirsO  s      F~sx00
 
OOC  
 
 
	  	( 	(A7==## (=qAAAA""(22*>>   %Q''''''	( 	(r8   c                     	 t          |           } | t          d          vrt          n"# t          $ r}t          d          |d }~ww xY w| S )N   z--optimize must be 0, 1, or 2)intrange
ValueErrorr   )valuera   s     r9   r  zeasy_install._validate_optimizec  sl    	JJEE!HH$$   % 	 	 	&/ 	
 s   '* 
A	AA	c                     | j         sdS |                                  | j        d}t          |          | j        x| _        | _        t          j         d}|                     |           dS )z;
        Fix the install_dir if "--user" was used.
        Nz$User base directory is not specified_user)	rh   create_home_pathr   r
   r   r   r   nameselect_scheme)r   msgscheme_names      r9   r   z+easy_install._fix_install_dir_for_user_sitep  s~     y 	F (8C(---484IID1''';'''''r8   c                     |D ]y}t          | |          }|et          j        dk    st          j        dk    rt          j                            |          }t          || j                  }t          | ||           zd S )Nposixnt)r   r   r  r   r
  r   r   setattr)r   attrsattrvals       r9   _expand_attrszeasy_install._expand_attrs  s     	) 	)D$%%C7g%%D',,S11C d&677dC(((	) 	)r8   c                 4    |                      g d           dS )zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.)r   r   r|   Nr   r   s    r9   r   zeasy_install.expand_basedirs  s%     	GGGHHHHHr8   c                 8    g d}|                      |           dS )z+Calls `os.path.expanduser` on install dirs.)r   r   r   r   r   r   Nr"  )r   dirss     r9   r   zeasy_install.expand_dirs  s/    
 
 
 	4     r8   c                    |r |                      dt          j                   | j        | j        j        k    rt          j        | j                   	 | j        D ]}|                     || j                    | j	        r| j
        }| j        rFt          | j                  }t          t          |                    D ]}||         |d          ||<   ddlm} |                     |j        | j	        |fd| j	        z             |                                  t          j        | j        j                   d S # t          j        | j        j                   w xY 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_verbosityru   r.   rz   rw   r  r|   lenr  	distutilsr&  execute
write_filewarn_deprecated_options)r   show_deprecationspecr  root_lencounterr&  s          r9   runzeasy_install.run  s{    	MM;  
 <4,444dl+++	9	 : :!!$DL(89999{ ,9 G"49~~H#(W#6#6 G G+27+;HII+F((//////(4;*@=K   
 ((***d/788888Cd/78888s   CD8 8 Ec                     	 t          j                    }n/# t          $ r" t          j        dt
          j                  }Y nw xY wt           j                            | j	        d|z            S )zReturn 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   joinro   )r   pids     r9   pseudo_tempnamezeasy_install.pseudo_tempname  se    
	1)++CC 	1 	1 	1.CK00CCC	1w||D,.Ds.JKKKs    )AAc                     d S r   r7   r   s    r9   r.  z$easy_install.warn_deprecated_options      r8   c                 *   t          | j                  }t          j                            |d          }t          j                            |          sA	 t          j        |           n+# t          t          f$ r | 	                                 Y nw xY w|| j
        v }|s| j        s|                                 }n|                                 dz   }t          j                            |          }	 |rt          j        |           t          |d                                           t          j        |           n+# t          t          f$ r | 	                                 Y nw xY w|sG| j        s@t          j                            dd          }t'          j        | j        | j        |           |r"| j        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   ro   r   r   r:  r   makedirsOSErrorIOErrorcant_write_to_targetr   ry   check_pth_processingr<  r   opencloseenvirongetr   rk   _easy_install__no_default_msgr   r/   )r   instdirr   is_site_dirtestfiletest_exists
pythonpaths          r9   r   zeasy_install.check_site_dir  s    !!1227<<);<<w~~g&& 	,,G$$$$W% , , ,))+++++, !33 	,4#5 	,3355KK ++--=H'..22K, (Ih'''Xs##))+++	(####W% , , ,))+++++,  	J4#5 	Jb99JHT*D,<jIII 	!}$ 04;M N N DM 	!bgnnX&>&> 	! DM"s%   A* *%BB3AE   %E('E(aS  
        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                     | j         t          j                    d         | j        fz  }t          j                            | j                  s|d| j        z   z  }n|d| j        z   z  }t          |          )N   rF   )
_easy_install__cant_write_msgr   exc_inforo   r   r   r   _easy_install__not_exists_id_easy_install__access_msgr	   )r   r  s     r9   rF  z!easy_install.cant_write_to_target  so    #s|~~a'8$:J&LLw~~d.// 	,4$...CC4$+++CS!!!r8   c                 l   | j         }t          j        d|           |                                 dz   }|dz   }t          j                            |          }t          d          dz   }	 |rt	          j        |           t          j        	                    |          }t	          j
        |d           t          |d          }	 |                     |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                            |          rt          j        d|           	 |r|                                 t          j                            |          rt	          j        |           t          j                            |          rt	          j        |           dS dS 	 |r|                                 t          j                            |          rt	          j        |           t          j                            |          rt	          j        |           n# |r|                                 t          j                            |          rt	          j        |           t          j                            |          rt	          j        |           w w xY w# t0          t2          f$ r |                                  Y nw xY w| j        st          j        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()
            rF   T)exist_okrA  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   )ro   r   r   r<  r   r   r   rL   r   dirnamerC  rH  writer   r   rI  r   
executabler  r   r:  r   distutils.spawnr]  rD  rE  rF  ry   rk   )r   rM  r   ok_file	ok_existsr   r_  rZ   ra  basenamealtuse_altr]  s                r9   rG  z!easy_install.check_pth_processing  s   "3W===''))F2U"GNN7++	   
 )	( #	'"""goog..GK$////Xs##A (//fhh//000			 ^
7d??(*j(A(A%GX',,w>>C ((L8 ,s++   )%(
111111z4v6:::7>>'**  HG     GGIII7>>'** 'Ig&&&7>>(++ (Ih'''''( (   GGIII7>>'** 'Ig&&&7>>(++ (Ih'''  GGIII7>>'** 'Ig&&&7>>(++ (Ih''''(E ! 	( 	( 	(%%'''''	(H ! 	MHBGLLLus!   +AM- D%K+ +A?M*-%NNc           	      $   | j         ss|                    d          r^|                    d          D ]H}|                    d|z             r|                     |||                    d|z                        I|                     |           dS )z=Write all the scripts for `dist`, unless scripts are excludedscriptszscripts/N)rq   metadata_isdirmetadata_listdirinstall_scriptget_metadatainstall_wrapper_scripts)r   r   script_names      r9   install_egg_scriptsz easy_install.install_egg_scriptsY  s    # 		(;(;I(F(F 		#44Y??  &&zK'?@@  ##+%%j;&>??    	$$T*****r8   c                 ,   t           j                            |          rZt          j        |          D ]C\  }}}|D ]:}| j                            t           j                            ||                     ;Dd S | j                            |           d S r   )r   r   r   walkr  appendr:  )r   r   baser$  filesr   s         r9   
add_outputzeasy_install.add_outputg  s    7== 	&%'WT]] F F!dE % F FHL''T8(D(DEEEEFF F L%%%%%r8   c                 :    | j         rt          d|d          d S )NzInvalid argument zW: you can't use filenames or URLs with --editable (except via the --find-links option).)r`   r   r   r0  s     r9   not_editablezeasy_install.not_editableo  s9    = 	## 44  	 	r8   c                     | j         sd S t          j                            t          j                            | j        |j                            rt          |j        d| j        d          d S )Nz already exists in z; can't do a checkout there)r`   r   r   r   r:  rt   keyr   rx  s     r9   check_editablezeasy_install.check_editablew  sq    } 	F7>>"',,t';TXFFGG 	#4///1  	 	r8   c              #   $  K   t          j        d          }	 t          |          V  t          j                            |          ot          |           d S  d S # t          j                            |          ot          |           w  w xY w)Nzeasy_install-)r}   )tempfilemkdtempr   r   r   r   r   )r   tmpdirs     r9   _tmpdirzeasy_install._tmpdir  s      !)9:::	6f++GNN6""5vf~~~~~555BGNN6""5vf~~~~55s   A 2BFc           	         |                                  5 }t          |t                    st          |          rU|                     |           | j                            ||          }|                     d |||d          cd d d            S t          j	        
                    |          r:|                     |           |                     d |||d          cd d d            S t          |          }|                     |           | j                            ||| j        | j        | j         | j                  }| d|z  }| j        r|dz  }t%          |          |j        t(          k    r&|                     |||d           |cd d d            S |                     ||j        ||          cd d d            S # 1 swxY w Y   d S )NTz+Could not find suitable distribution for %rz2 (--always-copy skips system and development eggs)Using)r  r   r!   r   ry  r   downloadinstall_itemr   r   r   r   r|  fetch_distributionrR   r`   rx   r   r	   
precedencer(   process_distributionlocation)r   r0  depsr  dlr   r  s          r9   r.   zeasy_install.easy_install  s   \\^^ 	LvdK00 7d## 7%%d++++44T6BBB,,T2vtTJJ	L 	L 	L 	L 	L 	L 	L 	L W^^D)) 7%%d+++,,T4tLL	L 	L 	L 	L 	L 	L 	L 	L 166D%%%%88fdlDM$$d&6 D |CdJ# POOC$S)))L00))$dGDDD9	L 	L 	L 	L 	L 	L 	L 	L< ((t}fdKK=	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	L 	Ls&   A-GAG(B#GGGGc                    |p| j         }|p"t          j                            |          |k    }|p|                    d           }|pJ| j        d uoAt          j                            t          |                    t          | j                  k    }|r&|s$| j        |j                 D ]}|j	        |k    r nd}t          j        dt          j                            |                     |r4|                     |||          }|D ]}|                     |||           n4|                     |          g}|                     ||d         |d           ||D ]}||v r|c S d S d S )N.eggTzProcessing %sr   r  )rx   r   r   r_  endswithr   r   r   project_namer  r   r   re  install_eggsr  egg_distribution)r   r0  r  r  r  install_neededr   distss           r9   r  zeasy_install.install_item  s    (;4+;'N27??8+D+D+N'Hx/@/@/H/H+H' 
!- 2GOON8445540112 	  	& 	& ():; & &=H,,E - "&"'"2"28"<"<=== 	E%%dHf==E < <))$d;;;;< **8445E%%dE!HdGDDD    4<<KKK      r8   c                     	 t          j        | |           d S # t          $ r8 t           j                             | |                    dd                     Y d S w xY w)Nr  unix)r   _select_schemer   r  rJ   )r   r  s     r9   r  zeasy_install.select_scheme  so    	O"4..... 	O 	O 	OO))$Wf0M0MNNNNNN	Os    >AAc                    |                      |           | j                            |           || j        |j                 v r| j                            |           | j                            |           |                     |           || j        |j        <   t          j	         | j
        ||g|R             |                    d          r4| j        s-| j                            |                    d                     |s	| j        sd S |'|j        |j        k    rt          j        d|           d S |||vr0|                                }t%          t'          |                    }t          j	        d|           	 t)          g                               |g| j        | j                  }n^# t.          $ r"}t1          t'          |                    |d }~wt2          $ r'}t1          |                                          |d }~ww xY w| j        s| j        r:|D ]7}|j        | j        vr'|                     |                                           8t          j	        d|           d S )Nzdependency_links.txtzSkipping dependencies for %szProcessing dependencies for %sz'Finished processing dependencies for %s)
update_pthr   addr   r{  removerp  r   r   r   installation_reporthas_metadatar   r  get_metadata_linesrx   rk   as_requirementr!   r   r%   resolver.   r&   r	   r'   reportr   )r   requirementr   r  r   distreqdistrosra   s           r9   r  z!easy_install.process_distribution  s    	t$$$4#DH---##D)))T"""  &&&,0)))+tCdCCCDDD455 	&	--''(>??    	4D, 	4F$[_)D)DH3T:::F D$;$;))++G%c'll33K1;???	4 nn,,t/1B GG $ 	0 	0 	0 Q((a/ 	4 	4 	4 ,,!3	4 	=t4 	= = =84#:::%%d&9&9&;&;<<<:KHHHHHs$   /F6 6
H GH*"HHc                     | j         | j          S |                    d          rdS |                    d          sdS dS )Nznot-zip-safeTzzip-safeF)rm   r  )r   r   s     r9   should_unzipzeasy_install.should_unzip   sO    ;"{?"^,, 	4  ,, 	4ur8   c                    t           j                            | j        |j                  }t           j                            |          r%d}t          j        ||j        | j        |           |S t           j                            |          r|}nt           j        	                    |          |k    rt          j
        |           t          j        |          }t          |          dk    rGt           j                            ||d                   }t           j                            |          r|}t          |           t          j        ||           |S )Nz<%r already exists in %s; build directory %s will not be keptrS  r   )r   r   r:  rt   r{  r   r   rk   r   r_  r   listdirr*  r*   shutilmove)r   r0  dist_filename
setup_basedstr  contentss          r9   
maybe_movezeasy_install.maybe_move	  s   gll4/::7>># 	N  HS$(D$8*EEE7=='' 
	/&JJw}--;;	-(((z*--H8}}!! "Z! E E7==// /!.JJ$$$
r8   c                     | j         rd S t                                                              |          D ]} | j        |  d S r   )rq   ScriptWriterbestget_argswrite_script)r   r   ru   s      r9   rn  z$easy_install.install_wrapper_scripts   sX     	F %%''0066 	% 	%DDt$$$	% 	%r8   c                 6   t          |                                          }t          ||          }|rA|                     |          t	                      z  }t
                              |          |z   }|                     |t          |          d           dS )z/Generate a legacy script wrapper and install itr[   N)	r   r  is_python_script_load_templater   r  
get_headerr  r@   )r   r   ro  script_textdev_pathr0  	is_scriptbodys           r9   rl  zeasy_install.install_script&  s    4&&(())$[+>>	 	F&&x00688;D&11+>>EK+y'='=sCCCCCr8   c                     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)rJ   r   decode)r  r  	raw_bytess      r9   r  zeasy_install._load_template0  sG      	8<<77D#L$77	(((r8   tr7   c                 L                           fd|D                        t          j        d| j                   t          j                             j        |          }                     |            j        rdS t                      }t          |           t          j                            |          rt	          j        |           t          |d|z             5 }|                    |           ddd           n# 1 swxY w Y   t          |d|z
             dS )z1Write an executable file to the scripts directoryc                 Z    g | ]'}t           j                            j        |          (S r7   )r   r   r:  rp   )r   rV   r   s     r9   r   z-easy_install.write_script.<locals>.<listcomp>B  s+    @@@!RW\\$/1--@@@r8   zInstalling %s script to %sNrA  i  )r   r   r   rp   r   r   r:  rv  r   current_umaskr*   r   r   rH  r`  chmod)r   ro  r  moder   targetmaskrZ   s   `       r9   r  zeasy_install.write_script?  sR   @@@@x@@@	
 	
 	
 	-{DOLLLdo{;;< 	F   7>>&!! 	If&#*%% 	GGH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	fedl#####s   $DD
D
c                    | j         | j        | j        d}	 ||                                dd                   } |||          gS # t          $ r Y nw xY w|}t
          j                            |          r,|                    d          st          ||| j
                   n>t
          j                            |          rt
          j                            |          }|                    |          r | j        r||                     |||          }t
          j                            |d          }t
          j                            |          st%          t
          j                            |dd                    }|s/t'          dt
          j                            |          z            t)          |          dk    r/t'          dt
          j                            |          z            |d	         }| j        r*t-          j        |                     ||                     g S |                     ||          S )
N)r  .exez.whl.pyzsetup.pyr   z"Couldn't find a setup script in %srS  zMultiple setup scripts in %sr   )install_egginstall_exeinstall_wheelr   KeyErrorr   r   isfiler  r   unpack_progressr   abspath
startswithrt   r  r:  r   r   r	   r*  r`   r   r   report_editablebuild_and_install)	r   r0  r  r  installer_mapinstall_distr  setup_scriptsetupss	            r9   r  zeasy_install.install_eggsS  sA    $$&
 

	9(##%%bcc*L !L7788  	 	 	D	 
7>>-(( 	81G1G1N1N 	8=&$2FGGGGW]]=)) 	877J!!&)) 	J(	J-1-=}jIIJ w||J
;;w~~l++ 	%"',,z3
CCDDF $8GOOM223   6{{Q$2GOOM223   "!9L = 	DHT))$==>>>I)),
CCCs   "A 
AAc                    t           j                            |          r/t          |t           j                            |d                    }n!t          t          j        |                    }t          j	        ||          S )NEGG-INFO)metadata)
r   r   r   r#   r:  r$   	zipimportzipimporterr"   from_filename)r   egg_pathr  s      r9   r  zeasy_install.egg_distribution  sw    7=="" 	D#Hbgll8;E/G /G H HHH #9#8#B#BCCH)(XFFFFr8   c           	         t           j                            | j        t           j                            |                    }t           j                            |          }| j        st          |           |                     |          }t           j        	                    |          r!t           j        
                    ||          st           j                            |          r;t           j                            |          st          j        || j                   nDt           j        	                    |          r%|                     t           j        |fd|z              	 d}t           j                            |          r3|                    |          rt$          j        d}}nwt$          j        d}}nh|                     |          r|                     |           | j        d}}n4d}|                    |          rt$          j        d}}nt$          j        d}}|                     |||f|dz   t           j                            |          t           j                            |          fz             t5          ||	           n # t6          $ r t5          |d	            w xY w|                     |           |                     |          S )
Nr   	Removing FMovingCopying
ExtractingTz	 %s to %sfix_zipimporter_caches)r   r   r:  ro   re  r  r   r*   r  r   samefiler   r   r   remove_treer,  r   r  r  r  copytreer  mkpathunpack_and_compilecopy2r_  update_dist_cachesr6  rv  )r   r  r  destinationr   new_dist_is_zippedrZ   rQ   s           r9   r  zeasy_install.install_egg  s   gllGX&&
 
 gook22| 	*[)))$$X..GNN;'')	,.G,<,<X{,S,S)	 w}}[)) "'..2M2M $[$,GGGGG,, I N+-  
%*"7==** 7**622 :%{H1%	1&&t,, 7KK,,,2LqAA)-&**622 7%{H1%|Y1{+_((2244)    #+=        ";uMMMM 	$$$$$[111s   ,D(J J2c                    t          |          }|t          d|z            t          d |                    dd          |                    dd          t	                                }t
          j                            ||                                dz             }||_	        |dz   }t
          j                            |d          }t
          j                            |d	          }t          |           t          ||          |_        |                     ||           t
          j                            |          st          |d
          }	|	                    d           |                    d          D ]L\  }
}|
dk    rA|	                    |
                    dd                                          d|d           M|	                                 t
          j                            |d          |                     fdt,                              |          D                        t1          j        ||| j        | j                   |                     ||          S )Nz(%s is not a valid distutils Windows .exer  r  rg   )r  rg   platformr  z.tmpr  PKG-INFOrA  zMetadata-Version: 1.0
target_version_-z: rF   ri  c                 \    g | ](}t           j                            |d                    )S )r   )r   r   r:  )r   ru   rp   s     r9   r   z,easy_install.install_exe.<locals>.<listcomp>  s=     
 
 
 GLLT!W--
 
 
r8   )r   r   )r0   r	   r"   rK  r   r   r   r:  egg_namer  r*   r#   	_provider
exe_to_eggr   rH  r`  itemsrJ   titlerI  r   r  r  r   make_zipfiler   r   r  )r   r  r  cfgr   r  egg_tmp	_egg_infopkg_infrZ   kvrp   s               @r9   r  zeasy_install.install_exe  sT   !-00; :]J   V44GGJ	22\^^
 
 
 7<<&(@AA V#GLL*55	',,y*55!!!%gy99w/// w~~g&& 	Wc""AGG-...		*-- K K1(((GG!))C*=*=*C*C*E*E*E*EqqqIJJJGGIIIW\\)Y77
 
 
 
 
$--d33
 
 
 	 	 	
 	gt|T\	
 	
 	
 	
 &111r8   c                     t          |          g g i fd}t          ||           g }D ]}|                                                    d          r|                    d          }|d         }t          j        |d                   dz   |d<   t          j        j	        g|R  }
                    |           |
                    |           t          j        ||           |                                t          j        t          j        	                    d          t          j        |                     dD ]}	t                      |	         rt          j        	                    d|	dz             }
t          j                            |
          sat#          |
d	          }|                    d
	                    t                      |	                   d
z              |                                 dS )z;Extract a bdist_wininst to the directories an egg would usec                 R   |                                  }	D ]c\  }}|                    |          rG|| t          |          d          z   } |                     d          }t	          j        j        g|R  }|                                 }|                    d          s|                    d          rat          j	        |d                   |d<   dt          j        
                    |d                   d         <                       |            n^|                    d          rI|dk    rCdt          j        
                    |d                   d         <   
                    |           |c S e|                     d	          st          j        d
|            d S )N/.pyd.dllrS  r   r  SCRIPTS/rY  zWARNING: can't process %s)r   r  r*  r   r   r   r:  r  r   strip_modulesplitextrs  r   rk   )srcr  r?   oldnewpartsr  r   native_libsprefixes
to_compile	top_levels          r9   processz(easy_install.exe_to_egg.<locals>.process  s   		A$  S<<$$ CHHII.CIIcNNE',w7777CB{{6** /bkk&.A.A /$-$:59$E$Eb	CD	"'"2"258"<"<Q"?@#**3////U++ /z0A0ACD	"'"2"258"<"<Q"?@"))#...JJJ <<'' ;4c:::4r8   r  r  r
  r  r  )r  r  z.txtrA  rF   N)r1   r   r   r  r   r   r  r   r   r:  rs  
write_stubbyte_compilewrite_safety_flaganalyze_eggr   r   rH  r`  rI  )r   r  r   r  stubsresr  resourcepyfiler  txtrZ   r  r  r  r  s     `         @@@@r9   r  zeasy_install.exe_to_egg  s    $M22
		 	 	 	 	 	 	 	 	* 	}gw777 	7 	7Cyy{{##F++ 7		# 9%259==Eb	g6666!!&)))V$$$$Xv666*%%%#GLL*--!'511	3 	3 	3 / 	 	Dxx~ gll7JvFFw~~c** S#AGGDIIfhhtn55<===GGIII	 	r8   c           
         t          |          }|                                sJ t          j                            | j        |                                          }t          j                            |          }| j        st          |           t          j        
                    |          r;t          j                            |          st          j        || j                   nDt          j                            |          r%|                     t          j        |fd|z              	 |                     |j        |fdt          j                            |          dt          j                            |                     t)          |d           n# t)          |d           w xY w|                     |           |                     |          S )Nr  r  zInstalling z to Fr  )r   is_compatibler   r   r:  ro   r  r  r   r*   r   r   r   r  r   r,  r   install_as_eggre  r_  r  rv  r  )r   
wheel_pathr  wheelr  s        r9   r  zeasy_install.install_wheel*  s   j!!""$$$$$gll4#3U^^5E5EFFgook22| 	*[)))7==%% 	bgnn[.I.I 	 dlCCCCCW^^K(( 	LL	k)  

	JLL$G$$Z0000GOOK000   {5IIIII{5IIIII$$$$$[111s   1AF   F3a(  
        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                     d}| j         rG| j        s@|d| j        z   z  }| j        t	          t
          t          j                  vr|d| j        z   z  }|j	        }|j
        }|j        }d}|t                      z  S )z9Helpful installation message for display to package usersz
%(what)s %(eggloc)s%(extras)srF   r   )ry   r~   _easy_install__mv_warningro   r   r   r   r   _easy_install__id_warningr  r  rg   r   )	r   reqr   whatr  egglocr  rg   extrass	            r9   r  z easy_install.installation_reportX  s    / 	0dn 	04$+++Cs>38'D'DDDtd/// ,VXX~r8   aR  
        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                     t           j                            |          }t          j        }d| j        t                      z  z   S )NrF   )r   r   r_  r   ra  _easy_install__editable_msgr   )r   r0  r  r_  pythons        r9   r  zeasy_install.report_editableq  s3    '//,//d)FHH444r8   c                    t           j                            dt                     t           j                            dt                     t          |          }| j        dk    r'd| j        dz
  z  }|                    dd|z              n!| j        dk     r|                    dd           | j        r|                    dd	           t          j
        d
|t          |          dz   d          d                    |                     	 t          ||           d S # t          $ r#}t          d|j        d                   |d }~ww xY w)Nzdistutils.command.bdist_eggzdistutils.command.egg_infor)   r  rS  r   r  z-qz-nzRunning %s %s zSetup script exited with )r   modulesr   r   r   r   r   r   r   r   r   r*  r:  r   r   r	   ru   )r   r  r  ru   r  s        r9   r   zeasy_install.run_setupv  sQ   <iHHH;XFFFDzz<!t|a'(AKK37####\AKK4   < 	!KK4   \#j//A*=*>*>?$	
 	
 	
	lD))))) 	 	 	 .12< 	s   D 
E(EEc                    ddg}t          j        dt          j                            |                    }	 |                     t          j                            |                     |                    |           |                     |||           t          |g          }g }|D ];}||         D ]0}|                    | 	                    |j
        |                     1<|s| j        st          j        d|           |t          |           t          j        | j                   S # t          |           t          j        | j                   w xY w)Nr   z
--dist-dirzegg-dist-tmp-)r}   dirz+No eggs found in %s (setup script problem?))r~  r  r   r   r_  _set_fetcher_optionsrs  r   r    r  r  r   r   rk   r   r)  r   )	r   r  r  ru   dist_dirall_eggseggsr{  r   s	            r9   r  zeasy_install.build_and_install  sh   \*#"(E(E
 
 
	,%%bgool&C&CDDDKK!!!NN<T:::"H:..HD M M$SM M MDKK 0 0
 K KLLLLM # #F!# # #8dl++++ 8dl++++s   CD/ /*Ec                 D   | j                             d                                          }d}i }|                                D ]\  }}||vr
|d         ||<   t	          |          }t
          j                            |d          }t          j	        ||           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.   )rs   r   rr   rv   r{   rS  )r.   z	setup.cfgN)
r   r   copyr  r   r   r   r:  r   edit_config)	r   rt  ei_optsfetch_directivesfetch_optionsr{  r  settingscfg_filenames	            r9   r5  z!easy_install._set_fetcher_options  s     #33NCCHHJJ
  	( 	(HC***!$QM#]333w||D+66<22222r8   c                    | j         d S | j         |j                 D ]v}| j        s|j        |j        k    rt	          j        d|           | j                             |           |j        | j        v r| j                            |j                   w| j        s|j        | j         j        v rt	          j        d|           n\t	          j        d|           | j         	                    |           |j        | j        vr| j        
                    |j                   | j        rd S | j                                          |j        dk    rd S t          j                            | j        d          }t          j                            |          rt          j        |           t'          |d          5 }|                    | j                             |j                  dz              d d d            d S # 1 swxY 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wtrF   )r   r{  ry   r  r   r   r  r   pathsr  rs  r   saver   r   r:  ro   r   r   rH  r`  make_relative)r   r   rT   r   rZ   s        r9   r  zeasy_install.update_pth  sI   = Ftx( 	4 	4A% !**E*EH=qAAAM  ###zT--- ''
333! 
	;} 333J   
 =tDDD!!$'''=(888$++DM:::< 	F8|##F 7<< 02BCC7>>(## 	 Ih(D!! 	GQGGDM//>>EFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	Gs   66G99G= G=c                 2    t          j        d||           |S )NzUnpacking %s to %s)r   debug)r   r  r  s      r9   r  zeasy_install.unpack_progress  s    	&S111
r8   c                      g g  fd}t          |||                                            j        s?D ]>}t          j        |          t          j                 dz  dz  }t          ||           =d S d S )Nc                 F   |                     d          r+|                     d          s                    |           n?|                     d          s|                     d          r                    |                               | |           j         r|pd S )Nr  	EGG-INFO/r	  z.so)r  r  rs  r  r   )r  r  r   to_chmodr  s     r9   pfz+easy_install.unpack_and_compile.<locals>.pf  s    ||E"" %3>>++F+F %!!#&&&&f%% %e)<)< %$$$  c***|#+3t3r8   im  i  )r   r  r   r   statST_MODEr  )r   r  r  rM  rZ   r  rL  r  s   `     @@r9   r  zeasy_install.unpack_and_compile  s    
	4 	4 	4 	4 	4 	4 	4 	xb111*%%%| 	  DL1U:fDa	 	 r8   c                 >   t           j        rd S ddlm} 	 t	          j        | j        dz
              ||dd| j                   | j        r ||| j        d| j                   t	          j        | j                   d S # t	          j        | j                   w xY w)Nr   )r  rS  )rv   forcer   )	r   dont_write_bytecodedistutils.utilr  r   r)  r   r   rv   )r   r  r  s      r9   r  zeasy_install.byte_compile  s    " 	F//////	,dlQ.///Laq$,OOOO} a L   
 dl+++++Cdl++++s   AB Ba  
        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                    | j         sdS t          t          j                            d                    }t          | j                                                  D ]c}|                    |          rLt          j        	                    |          s-| 
                    d|z             t          j        |d           ddS )zCreate directories under ~.N~zos.makedirs('%s', 0o700)i  )rh   r   r   r   r
  	only_strsr   valuesr  r   debug_printrC  )r   homer   s      r9   r  zeasy_install.create_home_path/  s    y 	FBG..s3344d.557788 	) 	)Dt$$ )RW]]4-@-@ )  !;d!BCCCD%(((	) 	)r8   z/$base/lib/python$py_version_short/site-packagesz	$base/binr   r  z$base/Lib/site-packagesz$base/Scriptsc                    |                      d          j        }| j        rt          |          }| j        |d<   | j                            t          j        | j                  }|	                                D ]'\  }}t          | |d           t          | ||           (ddlm} |D ]`}t          | |          }|L |||          }t          j        dk    rt          j                            |          }t          | ||           ad S )Nr   rt  r   )r   r  )get_finalized_commandr   r}   r   INSTALL_SCHEMESrK  r   r  DEFAULT_SCHEMEr  r   r  rS  r   r   r
  )r   r  r   schemer  r  r   s          r9   r   zeasy_install._expandE  s   00;;G; 	-{++K"&+K)--bgt7JKKF#\\^^ - -	c4t,,4D$,,,------ 	) 	)D$%%C jk227g%%',,S11CdC(((	) 	)r8   )T)Fr   )r  r7   )r%  )O__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   r3  r<  r.  r   rG   rH   lstriprT  rV  rW  rF  rG  rp  rv  ry  r|  r   contextmanagerr  r.   r  r  r  r  r  rn  rl  r  r  r  r  r  r  r  r  r'  r(  r  r.  r  r   r  r5  r  r  r  r  rI   rL  r  r   r]  r^  r   r7   r8   r9   r.   r.   b   s}       114K!% 	17GM769G?H	<	F	@KHH6E	5?	F	:T^KL9L<  O #H-LL/
 /
 /
b6 6 6     \r r rh ( ( \(& 
 
 \
( ( () ) )I I I

! 
! 
!9 9 9 9:	L 	L 	L  +# +# +#Z 'x (   VXX  &ho '   VXX	  #8? $   VXX  " " "9 9 9v+ + +& & &     6 6 6L L L LB"  "  "  " HO O O +/'I 'I 'I 'IR    .% % %D D D D ) ) \)$ $ $ $(1D 1D 1DfG G G62 62 62p+2 +2 +2\3 3 3j2 2 2: #8? 	$ 	 	 VXX  #8? $  L    %X_ 	& 	 	 VXX 5 5 5
  ,, , ,03 3 3.'G 'G 'GR  
  &, , ,& 'x (  < UWW= @) ) ) ddI"
 
 
  O T-"  N
) ) ) ) )r8   r.   c                      t           j                            dd                              t           j                  } t          d |           S )NrB  r   )r   rJ  rK  r   pathsepfilter)r  s    r9   _pythonpathro  \  s7    JNN<,,222:>>E$r8   c            
         g                      t                                 t          j        g} t          j        t          j        k    r|                     t          j                   | D ]}}|st          j        dv r5                    t          j        	                    |dd                     nt          j
        dk    ri                     t          j        	                    |d dj        t          j         d          t          j        	                    |dd          g           n6                     |t          j        	                    |dd          g           t          j        dk    r
d	|vrt          j                            d
          }|s3t          j        	                    |dd dj        t          j         d          }                    |           t          d          t          d          f}                     fd|D                        t           j        r                    t           j                   t'          j        t*                    5                       t!          j                               ddd           n# 1 swxY w Y   t/          t1          t2                              S )z&
    Return a list of 'site' dirs
    )os2emxriscosLibzsite-packagesr  r   zpython{}.{}zsite-pythondarwinzPython.frameworkHOMELibraryPythonr   purelibplatlibc              3   $   K   | ]
}|v|V  d S r   r7   )r   r?   sitedirss     r9   r   z get_site_dirs.<locals>.<genexpr>  s-      >>!AX,=,=A,=,=,=,=>>r8   N)r   ro  r   r}   r   rs  r  r   r   r:  sepr   r   rJ  rK  r   r   r   r   r   r   r   getsitepackagesr   r   r   )r  r}   rY  home_sp	lib_pathsr{  s        @r9   r   r   a  s   
 H OOKMM"""
|H
#*$$((( )! )! 	<///OOBGLLHHIIIIVs]]OO(M(#*:;#	  VUM::     OOVUO<<    <8##
 V++z~~f%% 	',,GNC,-
 
 	    ##Xi%8%88IOO>>>>y>>>>>> ('''		^	,	, 0 0,..///0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 C1122HOs   /'J""J&)J&c              #     K   i }| D ]Q}t          |          }||v rd||<   t          j                            |          s<t          j        |          }||fV  |D ]}|                    d          s|dv rt          t          j                            ||                    }t          t          |                    }|
                                 |D ]{}|                    d          rt          |                                          }||v r>d||<   t          j                            |          sc|t          j        |          fV  |SdS )zBYield sys.path directories that might contain "old-style" packagesrS  rY  )r@  rB  importN)r   r   r   r   r  r  rH  r:  r   r+   rI  r  rstrip)inputsseenr_  ru  r  rZ   lineslines           r9   expand_pathsr    s      D &- &- ))d??Ww}}W%% 	
7##un 	- 	-D==(( === RW\\'40011AQ((EGGIII  - -??8,, %dkkmm444<<T
w}}T** BJt,,,,,,,-	-&- &-r8   c                 F   t          | d          }	 t          j        |          }|	 |                                 dS |d         |d         z
  |d         z
  }|dk     r	 |                                 dS |                    |dz
             t          j        d|                    d                    \  }}}|dvr	 |                                 dS |                    |d|z   z
             d	d	d
}t          j	        |          }	 |                    |          }	|	
                    dd          d         }
|
                    t          j                              }
|                    t          j        |
                     n*# t          j        $ r Y |                                 dS w xY w|                    d          r|                    d          s	 |                                 dS ||                                 S # |                                 w xY w)znExtract configuration data from a bdist_wininst .exe

    Returns a configparser.RawConfigParser, or None
    rbN	            z<iii)izV4i{V4r   )rg   r      rS  r   r  Setup)rH  zipfile_EndRecDatarI  seekr5   unpackreadconfigparserRawConfigParserr   r  r   getfilesystemencoding	read_fileioStringIOErrorhas_section)r  rZ   endrec	prependedtagcfglenbmleninitr  partconfigs              r9   r0   r0     s   
 	]D!!A $Q''>: 	
					7 AY*fQi7	r>>2 	
					1 	
y2~#]6166"::>>VU...( 	
					% 	
yBK()))44*400		66&>>DZZq))!,F ]]3#<#>#>??FMM"+f--....! 	 	 	 	
						z** 	#//'2J2J 	 	
					  	
								sH   H
  H
 6AH
 4H
 
A>F	 H
 	F0H
 /F00-H
 4H
 
H c           	      ,   g d}t          j        |           }	 |                                D ]}|j        }|                    d          }t          |          dk    r\|d         dk    rP|d                             d          r5|                    dd                    |d	d                   d
f            nt          |          dk    s|                    d          s|                    d          r|d         	                                dv r|
                    |                                          }t          |          D ]b}|                                                    dd          }|                    d          s#|                    |d         d|ddf           c|                                 n# |                                 w xY w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  rS  z	.egg-infor   NrK  rY  z
-nspkg.pth)PURELIBPLATLIB\r  r   c                 @    g | ]\  }}|                                 |fS r7   )r   )r   rV   ys      r9   r   z$get_exe_prefixes.<locals>.<listcomp>  s(    44441aA444r8   )r  ZipFileinfolistr   r   r*  r  r   r:  upperr  r  r+   rI   rJ   r  rs  rI  sortreverse)exe_filenamer  rO   r   r  r  r  pths           r9   r1   r1     s     H 	%%AJJLL 	L 	LD=DJJsOOE5zzQ58z#9#98$$[11 OOArr(;(;['IJJJE5zzQdmmF&;&;}}\** Qx~~#99966$<<..00&x00 L LC))++--dC88C>>(33 L eAhhh*Dr(JKKK									448444HMMOOOOs   FG Gc                   d     e Zd ZdZdZd fd	Zd Zd Zed             Z	 fdZ
 fd	Zd
 Z xZS )r/   z)A .pth file with Distribution paths in itFr7   c           
         || _         t          t          t          |                    | _        t          t
          j                            | j                             | _        | 	                                 t                                          g d d            t          | j                  D ]2}t          t          | j        t          |d                               3d S )NT)r   r   r   r   r{  r   r   r_  basedir_loadsuper__init__r+   rD  r  r   )r   r   r{  r   	__class__s       r9   r  zPthDistributions.__init__(  s     S::;;%bgoodm&D&DEE

T4(((
++ 	@ 	@DTX1$==>>????	@ 	@r8   c                    g | _         d}t                              | j                  }t          j                            | j                  r8t          | j        d          }|D ]}|	                    d          rd}|
                                }| j                             |           |                                r'|                                	                    d          rt          t          j                            | j        |                    x}| j         d<   t          j                            |          r||v r"| j                                          d| _        d||<   |                                 | j         r	|sd| _        | j         r`| j         d                                         sE| j                                          | j         r#| j         d                                         ?d S d S d S d S )NFrtr  T#r
  rS  )rD  r   fromkeysr{  r   r   r  r   rH  r  r  rs  rI   r   r:  r  r   popdirtyrI  )r   
saw_importr  rZ   r  r   s         r9   r  zPthDistributions._load1  s   

}}T]++7>>$-(( 	T]D))A  ??8,, !%J{{}}
!!$'''zz|| tzz||'>'>s'C'C  )7GLLt44) ) tz"~ w~~d++ tt||JNN$$$!%DJT

GGIII: 	j 	DJj 	B!5!5!7!7 	JNN j 	B!5!5!7!7 	 	 	 	 	 	 	 	 	r8   c                    | j         sdS t          t          | j        | j                            }|rt          j        d| j                   |                     |          }d	                    |          dz   }t          j                            | j                  rt          j        | j                   t          | j        d          5 }|                    |           ddd           n# 1 swxY w Y   nWt          j                            | j                  r3t          j        d| j                   t          j        | j                   d| _         dS )z$Write changed .pth file back to diskNz	Saving %srF   rC  zDeleting empty %sF)r  r   r   rF  rD  r   rH  r   _wrap_linesr:  r   r   r   r   rH  r`  r   )r   	rel_pathsr  datarZ   s        r9   rE  zPthDistributions.saveP  s\   z 	FT/<<==	 	%Ik4=111$$Y//E99U##d*Dw~~dm,, )	$-(((dmT** a               W^^DM** 	%I)4=999Idm$$$


s   C..C25C2c                     | S r   r7   )r  s    r9   r  zPthDistributions._wrap_linesf  s    r8   c                 
   |j         | j        vo)|j         | j        vp|j         t          j                    k    }|r&| j                            |j                    d| _        t                                          |           dS )z"Add `dist` to the distribution mapTN)	r  rD  r{  r   getcwdrs  r  r  r  )r   r   new_pathr  s      r9   r  zPthDistributions.addj  s     M+ T]2 -,	 	  	Jdm,,,DJDr8   c                     |j         | j        v r4| j                            |j                    d| _        |j         | j        v 4t	                                          |           dS )z'Remove `dist` from the distribution mapTN)r  rD  r  r  r  )r   r   r  s     r9   r  zPthDistributions.removex  s`    mtz))Jdm,,,DJ mtz)) 	tr8   c                 .   t           j                            t          |                    \  }}t	          | j                  }|g}t           j        dk    rdpt           j        }t	          |          |k    r|| j        k    rH|                    t           j	                   |
                                 |                    |          S t           j                            |          \  }}|                    |           t	          |          |k    |S )Nr  )r   r   r   r   r*  r  altsepr|  rs  curdirr  r:  )r   r   npathlastbaselenr  r|  s          r9   rF  zPthDistributions.make_relative  s    gmmN4$8$899tdl##i3&30"&%jjG##$$RY'''xx&'--..KE4LL %jjG## Kr8   )r7   )r`  ra  rb  rc  r  r  r  rE  ri  r  r  r  rF  __classcell__)r  s   @r9   r/   r/   #  s        33E@ @ @ @ @ @  >  ,   \              r8   r/   c                   P    e Zd Zed             Z ed          Z ed          ZdS )RewritePthDistributionsc              #   @   K   | j         V  |D ]}|V  | j        V  d S r   )preludepostlude)clsr  r  s      r9   r  z#RewritePthDistributions._wrap_lines  sB      k 	 	DJJJJlr8   z?
        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`  ra  rb  classmethodr  rL   r  r  r7   r8   r9   r  r    sW          [ j   G z   HHHr8   r  SETUPTOOLS_SYS_PATH_TECHNIQUErawrewritec                      t          t          j        t                    rt          S t	          j        t          j                                                  S )z_
    Return a regular expression based on first_line_re suitable for matching
    strings.
    )r   r   patternr   recompiler  r7   r8   r9   _first_line_rer    s@    
 -'--  :m+2244555r8   c                     | t           j        t           j        fv r5t           j        dk    r%t	          |t
          j                    | |          S t          j                    \  }}}|d         |d         d| d|z   f)Nr  r   rS  r1  )	r   r   r  r  r  rN  S_IWRITEr   rU  )funcargexcetevr  s         r9   
auto_chmodr    sv    	29%%%"'T//c4=!!!tCyyIBAa5"Q%%tttSS12
33r8   c                     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_paths      r9   r  r    sX    x %Y//O_c5666 D)/:::::  	3?CCCCCr8   c                     g }t          |           }|D ]V}t          |          }|                    |           r0|||dz            t          j        dfv r|                    |           W|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.

    rS  r   )r*  r   r  r   r|  rs  )r  cacheresult
prefix_lenpnps         r9   "_collect_zipimporter_cache_entriesr    s}     F_%%J  AMM/** 	:j1n,-"&"==MM!Mr8   c                 l    t          | |          D ]"}||         }||= |o |||          }||||<   #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_entrys         r9   _update_zipimporter_cacher  $  s_     0GG ! ! !H	!H59 5 5	  E!H! !r8   c                 &    t          | |           d S r   )r  )r  r  s     r9   r  r  D  s    ou55555r8   c                 D    d }t          | t          j        |           d S )Nc                 .    |                                  d S r   )clearr   r  s     r9   2clear_and_remove_cached_zip_archive_directory_datazf_remove_and_clear_zip_directory_cache_data.<locals>.clear_and_remove_cached_zip_archive_directory_dataI  s    r8   r  r  r  _zip_directory_cache)r  r  s     r9   r  r  H  sE       7BD D D D D Dr8   __pypy__c                 D    d }t          | t          j        |           d S )Nc                     |                                  t          j        |            |                    t          j        |                     |S r   )r  r  r  r   r  r  s     r9   )replace_cached_zip_archive_directory_datazT_replace_zip_directory_cache_data.<locals>.replace_cached_zip_archive_directory_data_  sG     OO!$'''Y;DABBBr8   r   r  )r  r  s     r9   r  r  ^  s?    	 	 	 	"Y;=	? 	? 	? 	? 	? 	?r8   <string>c                 Z    	 t          | |d           dS # t          t          f$ r Y dS w xY w)z%Is this string a valid Python script?execTF)r  SyntaxError	TypeError)rK   r   s     r9   	is_pythonr  q  sI    h''' t #   uus    **c                     	 t          j        | d          5 }|                    d          }ddd           n# 1 swxY w Y   n# t          t          f$ r | cY S w xY w|dk    S )zCDetermine if the specified executable is a .sh (contains a #! line)zlatin-1)encodingr)   N#!)r  rH  r  rD  rE  )ra  fpmagics      r9   is_shr  {  s    WZ)444 	GGAJJE	 	 	 	 	 	 	 	 	 	 	 	 	 	 	W   D=s.   A :A >A >A AAc                 ,    t          j        | g          S )z@Quote a command line argument according to Windows parsing rules
subprocesslist2cmdline)r  s    r9   nt_quote_argr    s    "C5)))r8   c                    |                     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)r  r  r  
splitlinesr   )r  r   s     r9   r  r    s      8#4#4V#<#< th'' td## ?;1133A6<<>>>>5r8   )r  c                      d S r   r7   )ru   s    r9   _chmodr    r>  r8   c                     t          j        d| |           	 t          | |           d S # t          j        $ r }t          j        d|           Y d }~d S d }~ww xY w)Nzchanging mode of %s to %ozchmod failed: %s)r   rH  r  r   error)r   r  ra   s      r9   r  r    sx    I)4666)tT8 ) ) )	$a((((((((()s   * AAAc                       e Zd ZdZg Z e            Zed             Zed             Z	ed             Z
ed             Zed             Zd Zed             Zd	 Zed
             Zed             ZdS )CommandSpeczm
    A command spec for a #! header, specified as a list of arguments akin to
    those passed to Popen.
    c                     | S )zV
        Choose the best CommandSpec class based on environmental conditions.
        r7   r  s    r9   r  zCommandSpec.best  s	    
 
r8   c                     t           j                            t          j                  }t           j                            d|          S )N__PYVENV_LAUNCHER__)r   r   r  r   ra  rJ  rK  )r  _defaults     r9   _sys_executablezCommandSpec._sys_executable  s0    7##CN33z~~3X>>>r8   c                     t          ||           r|S t          |t                    r | |          S ||                                 S |                     |          S )zg
        Construct a CommandSpec from a parameter to build_scripts, which may
        be None.
        )r   r   from_environmentfrom_string)r  params     r9   
from_paramzCommandSpec.from_param  sd     eS!! 	LeT"" 	3u::='')))u%%%r8   c                 >     | |                                  g          S r   )r&  r"  s    r9   r(  zCommandSpec.from_environment  s!    sC''))*+++r8   c                 F    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  s      r9   r)  zCommandSpec.from_string  s+     F55cn55s5zzr8   c                     t          j        |                     |                    | _        t	          j        |           }t          |          sdg| j        d d<   d S d S )Nz-xr   )r.  r   _extract_optionsoptionsr  r  rD   )r   r  cmdlines      r9   install_optionszCommandSpec.install_options  sc    {4#8#8#E#EFF)$//w 	& $vDL!	& 	&r8   c                     | dz                                    d         }t                                          |          }|r|                    d          pdnd}|                                S )zH
        Extract any options from the first line of the script.
        rF   r   rS  r   )r  r  matchgrouprI   )orig_scriptfirstr7  r3  s       r9   r2  zCommandSpec._extract_options  sb    
 t#//11!4  &&u--*/7%++a..&BR}}r8   c                 V    |                      | t          | j                  z             S r   )_renderr   r3  r   s    r9   	as_headerzCommandSpec.as_header  s#    ||D4#5#55666r8   c                     d}|D ]8}|                      |          r!|                     |          r| dd         c S 9| S )Nz"'rS  r
  )r  r  )item_QUOTESqs      r9   _strip_quoteszCommandSpec._strip_quotes  sW     	" 	"Aq!! "dmmA&6&6 "AbDz!!!r8   c                 N    t          j        d | D                       }d|z   dz   S )Nc              3   n   K   | ]0}t                               |                                          V  1d S r   )r   rB  rI   )r   r?  s     r9   r   z&CommandSpec._render.<locals>.<genexpr>  sQ       *G *G8<K%%djjll33*G *G *G *G *G *Gr8   r  rF   r  )r  r4  s     r9   r<  zCommandSpec._render  sF    ) *G *G@E*G *G *G G Gg~$$r8   N)r`  ra  rb  rc  r3  r   r/  r  r  r&  r+  r(  r)  r5  ri  r2  r=  rB  r<  r7   r8   r9   r   r     s$        
 GJ  [ ? ? [? & & [& , , [,   [& & &   \7 7 7   \ % % \% % %r8   r   c                   &    e Zd Z ed          ZdS )WindowsCommandSpecFrZ  N)r`  ra  rb  r   r/  r7   r8   r9   rF  rF    s         E"""JJJr8   rF  c                      e Zd ZdZ ej        d                                          ZeZ	e
dd            Ze
dd            Ze
dd            Zed             Ze
d	             Ze
d
             Ze
d             Ze
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                     t          j        dt                     |rt          nt                                          }|                     d||          }|                    ||          S )NzUse get_argsr   )rj   rk   rl   WindowsScriptWriterr  r  get_script_headerr  )r  r   ra  wininstwriterheaders         r9   get_script_argszScriptWriter.get_script_args.  s^     	n&CDDD)0B%%lHHJJ&&r:w??tV,,,r8   c                 n    t          j        dt          d           |rd}|                     ||          S )NzUse get_headerr)   )
stacklevelr\  )rj   rk   rl   r  )r  r  ra  rK  s       r9   rJ  zScriptWriter.get_script_header6  sJ     	;	K 	K 	K 	K 	&%J~~k:666r8   c              #   ~  K   ||                                  }t          |                                          }dD ]}|dz   }|                    |                                          D ]Q\  }}|                     |           | j        t                      z  }|                     ||||          }	|	D ]}
|
V  Rd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   rM  r0  type_r8  r  epr  ru   r  s              r9   r  zScriptWriter.get_args?  s       >^^%%F4&&(())% 	 	EJ&E ..u55;;==  b%%d+++!lVXX5++E4MM  CIIII		 	r8   c                 R    t          j        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_seps     r9   rW  zScriptWriter._ensure_safe_nameQ  s9    
 y400 	LJKKK	L 	Lr8   c                     t          j        dt                     |rt                                          n|                                 S NzUse best)rj   rk   rl   rI  r  )r  force_windowss     r9   
get_writerzScriptWriter.get_writerZ  s<     	j"?@@@-:J"'')))

Jr8   c                     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  _namerI  r  r"  s    r9   r  zScriptWriter.best`  s@    
 <7""rw&'8'8RX=M=M&++---Jr8   c              #      K   |||z   fV  d S r   r7   )r  rZ  r  rM  r  s        r9   rY  zScriptWriter._get_script_argsj  s$       Vk)******r8   r   c                     | j                                                             |          }|                    |           |                                S )z;Create a #! line, getting options (if any) from script_text)command_spec_classr  r+  r5  r=  )r  r  ra  cmds       r9   r  zScriptWriter.get_headero  sH     $))++66zBBK(((}}r8   )NFr   )r   N)r`  ra  rb  rc  rG   rH   rj  rX  r   ri  r  rN  rJ  r  ri  rW  rb  r  rY  r  r7   r8   r9   r  r    sA        
 x !  ! !B VXXC F %- - - [- 7 7 7 [7    [" L L \L K K [K
   [ + + [+    [  r8   r  c                       e Zd ZeZed             Zed             Zed             Zed             Z	e
d             ZdS )rI  c                 ^    t          j        dt                     |                                 S r`  )rj   rk   rl   r  r"  s    r9   rb  zWindowsScriptWriter.get_writerz  s%     	j"?@@@xxzzr8   c                 ~    t          t          |           }t          j                            dd          }||         S )zC
        Select the best ScriptWriter suitable for Windows
        )ra  naturalSETUPTOOLS_LAUNCHERra  )r   WindowsExecutableLauncherWriterr   rJ  rK  )r  writer_lookuplaunchers      r9   r  zWindowsScriptWriter.best  sA    
 6
 
 

 :>>"7FFX&&r8   c              #     K   t          dd          |         }|t          j        d                                                             d          vr3 dj        di t                      }t          j        |t                     g d}|
                    |           |                     ||          }fd|D             }|z   ||z   d	|fV  d
S )z For Windows, add a .py extension.pyar  rR  PATHEXT;zK{ext} not listed in PATHEXT; scripts will not be recognized as executables.)rt  r  
-script.py.pyc.pyor  r  c                     g | ]}|z   S r7   r7   r   rV   r  s     r9   r   z8WindowsScriptWriter._get_script_args.<locals>.<listcomp>      ***D1H***r8   r  Nr7   )r   r   rJ  r   r   r   r   rj   rk   UserWarningr  _adjust_header)	r  rZ  r  rM  r  extr  r  r   s	     `      r9   rY  z$WindowsScriptWriter._get_script_args  s       6v...u5bj+113399#>>>>-! ! xx! !C M#{+++KKK

3##E622****c***Sj&;.X======r8   c                     d}d}|dk    r||}}t          j        t          j        |          t           j                  }|                    ||          }|                     |          r|n|S )z
        Make sure 'pythonw' is used for gui and 'python' is used for
        console (regardless of what sys.executable is).
        r[  r\  rT  )r0  repl)r  r  escape
IGNORECASEsub_use_header)r  rZ  orig_headerr  r  
pattern_ob
new_headers          r9   r~  z"WindowsScriptWriter._adjust_header  sm      E>> 'TGZ	' 2 2BMBB
^^;T^BB
 __Z88IzzkIr8   c                 z    | 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
  "rd  )rI   r   r  r   )r  clean_headers     r9   r  zWindowsScriptWriter._use_header  s:     "!B$'--c22|w&G/,*G*GGr8   N)r`  ra  rb  rF  ri  r  rb  r  rY  r~  ri  r  r7   r8   r9   rI  rI  w  s        +  [
 
' 
' [
' > > [> J J [J 	H 	H \	H 	H 	Hr8   rI  c                   $    e Zd Zed             ZdS )rp  c              #     K   |dk    rd}d}dg}nd}d}g d}|                      ||          }fd|D             }	|z   ||z   d|	fV  d	z   t          |          d
fV  t                      sdz   }
|
t                    dfV  dS dS )zG
        For Windows, add a .py extension and an .exe launcher
        rT  z-script.pywr  clirw  )r  rx  ry  c                     g | ]}|z   S r7   r7   r{  s     r9   r   zDWindowsExecutableLauncherWriter._get_script_args.<locals>.<listcomp>  r|  r8   r  r  r[   z.exe.manifestN)r~  get_win_launcherr:   load_launcher_manifest)r  rZ  r  rM  r  launcher_typer  r  hdrr   m_names     `        r9   rY  z0WindowsExecutableLauncherWriter._get_script_args  s      
 E>>!MC(CC!MC)))C  //****c***cz3,c8<<<<6M+M::
 	
 	
 	
 zz 	> O+F1$77======	> 	>r8   N)r`  ra  rb  r  rY  r7   r8   r9   rp  rp    s-        > > [> > >r8   rp  c                     d| z  }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-arm64r   z-arm64.z-64.z-32.r   )r:   r   rJ   r   )typelauncher_fns     r9   r  r    s{     T/Kzz 7>>[((%--c9==KK%--c6::KK!))#v66<555r8   c                 ~    t          j        t          d          }|                    d          t	                      z  S )Nzlauncher manifest.xmlr  )pkg_resourcesr   r`  r  vars)r  manifests     r9   r  r    s0    ,X7NOOH??7##dff,,r8   Fc                 .    t          j        | ||          S r   )r  r   )r   ignore_errorsonerrors      r9   r   r     s    =}g666r8   c                  V    t          j        d          } t          j        |            | S )N   )r   umask)tmps    r9   r  r    s!    
(5//CHSMMMJr8   c                 $    t          d |           S )z,
    Exclude non-str values. Ref #3063.
    c                 ,    t          | t                    S r   )r   r   )r  s    r9   <lambda>zonly_strs.<locals>.<lambda>	  s    jc22 r8   )rn  )rW  s    r9   rV  rV    s     22F;;;r8   c                       e Zd ZdZdS )rl   zF
    Warning for EasyInstall deprecations, bypassing suppression.
    N)r`  ra  rb  rc  r7   r8   r9   rl   rl   	  s           r8   rl   r   )r  )|rc  r   rS  r   r   r   distutils.errorsr   r   r	   r
   r+  r   r   distutils.command.build_scriptsr   rb  r   distutils.commandr   r   r   r  r  r~  r  r  rN  r7  rG   rj   r   r5   r   r  r.  r  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(   _pathr*   extern.jaraco.textr+   filterwarningsPEP440Warning__all__r:   r@   rD   rL   r.   ro  r   r  r0   r1   r/   r  rJ  rK  r  r  r  r  r  r  r  builtin_module_namesr  r  r  r  r  r  r  ImportErrorr   r   r&  sys_executablerF  r  rI  rp  rN  rJ  r  r  r   r  rV  rl   r7   r8   r9   <module>r     sx  
 
       ' ' ' ' ' ' 3 3 3 3 3 3 3 3            $ # # # # # # # 9 9 9 9 9 9 + + + + + + % % % % % % 



 				        				                				               3 3 3 3 3 3       ( ( ( ( ( ( % % % % % % 2 2 2 2 2 2          3 2 2 2 2 2 2 2 " " " " " "                                  $ $ $ $ $ $ , , , , , ,  	M,G H H H H  % % %    = = =w) w) w) w) w)7 w) w) w)t'  
C C CL+- +- +-\& & &R" " "Ji i i i i{ i i iX    .   , :>>1599YFF.	6 	6 	64 4 4OD OD ODd  (! ! ! !@6 6 6D D D" )))2 &%? ? ?&     * * *
  """""""       ) ) )P% P% P% P% P%$ P% P% P%h ,,..# # # # # # # #q q q q q q q qh>H >H >H >H >H, >H >H >HB> > > > >&9 > > >@ . 2 6 6 6&- - -
  %j 7 7 7 7  < < <    $@     s   'F. .F98F9