î
½1kdÀ% ã               @   s³  d  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 m Z d d l Z d d l m Z m Z d d l m Z d d l m Z 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, m. Z. d d l( m/ Z/ m0 Z0 d d l1 m2 Z2 m3 Z3 m4 Z4 m5 Z5 m6 Z6 d d l m7 Z7 m8 Z8 m9 Z9 m: Z: m; Z; m< Z< m= Z= m> Z> m? Z? m@ Z@ mA ZA mB ZB mC ZC mD ZD mE ZE e jF jG d e jH jI e jJ ƒ ƒ ZK d d d d d d g ZL d d „  ZM d d „  ZN e jO d f k rÝd d „  ZP d  d! „  ZQ n d" d „  ZP d# d! „  ZQ Gd$ d „  d e ƒ ZR d% d& „  ZS d' d( „  ZT d) d „  ZU d* d „  ZV d+ d, „  ZW Gd- d „  d e= ƒ ZX eK d. d/ d0 „ ZY d1 d2 „  ZZ d3 d4 „  Z[ d5 d6 „  Z\ d7 d8 d9 „ Z] d: d; „  Z^ d< d= „  Z_ d> d? „  Z` y d d@ l ma Zb Wn ec k
 rúdA dB „  Zb Yn XdC dD „  Za dE dF „  Zd GdG dH „  dH ee ƒ Zf GdI dJ „  dJ ef ƒ Zg GdK dL „  dL eg ƒ Zh ef ji Zi dM dN „  Zj dO dP „  Zk d. eZ dQ dR „ Zl dS dT „  Zm dU dV „  Zn d dW d „ Zo d S)Xa  
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://pythonhosted.org/setuptools/easy_install.html

é    N)Úglob)ÚlogÚdir_util)ÚCommandÚ_dont_write_bytecode)Ú	run_setup)Úget_pathÚget_config_vars)Úget_platform)Úconvert_pathÚ
subst_vars)ÚDistutilsArgErrorÚDistutilsOptionErrorÚDistutilsErrorÚDistutilsPlatformError)ÚINSTALL_SCHEMESÚSCHEME_KEYS)Úsetopt)Úunpack_archive)ÚPackageIndex)Ú
URL_SCHEME)Ú	bdist_eggÚegg_info)Ú	iteritemsÚmaxsizeÚ
basestringÚunicodeÚreraise)Úyield_linesÚnormalize_pathÚresource_stringÚensure_directoryÚget_distributionÚfind_distributionsÚEnvironmentÚRequirementÚDistributionÚPathMetadataÚEggMetadataÚ
WorkingSetÚDistributionNotFoundÚVersionConflictÚDEVELOP_DISTÚ__PYVENV_LAUNCHER__ÚsamefileÚeasy_installÚPthDistributionsÚextract_wininst_cfgÚmainÚget_exe_prefixesc               C   s   t  j d ƒ d k S)NÚPé   )ÚstructÚcalcsize© r8   r8   úU/var/www/pythonscrapper/code/venv/build/setuptools/setuptools/command/easy_install.pyÚis_64bit@   s    r:   c             C   s›   t  j j |  ƒ o! t  j j | ƒ } t t  j d ƒ o9 | } | rU t  j j |  | ƒ St  j j t  j j |  ƒ ƒ } t  j j t  j j | ƒ ƒ } | | k S)Nr.   )ÚosÚpathÚexistsÚhasattrr.   ÚnormpathÚnormcase)Zp1Zp2Z
both_existZuse_samefileZnorm_p1Znorm_p2r8   r8   r9   r.   C   s    $é   c             C   s   |  S)Nr8   )Úsr8   r8   r9   Ú	_to_asciiM   s    rC   c             C   s2   y t  |  d ƒ d SWn t k
 r- d SYn Xd  S)NÚasciiTF)r   ÚUnicodeError)rB   r8   r8   r9   ÚisasciiO   s
    rF   c             C   s   |  j  d ƒ S)NrD   )Úencode)rB   r8   r8   r9   rC   V   s    c             C   s2   y |  j  d ƒ d SWn t k
 r- d SYn Xd  S)NrD   TF)rG   rE   )rB   r8   r8   r9   rF   X   s
    c               @   s®  e  Z d  Z d Z d Z d Z d´ dµ d¶ d· d¸ d¹ dº d» d¼ d½ d¾ d¿ dÀ dÁ dÂ dÃ dÄ dÅ dÆ dÇ dÈ dÉ dÊ g Z d d
 d d d d0 d3 d9 d< d@ g
 Z e j	 rÉ dE e j
 Z e j dF d e f ƒ e j dF ƒ n  i d d* 6Z e Z dG dH „  Z dI dJ „  Z dK dL „  Z dM dN „  Z dO dP „  Z dQ dR „  Z dS dT „  Z dU dV „  Z dW dX „  Z dY dZ „  Z d[ d\ „  Z d] d^ „  Z d_ d` „  Z da db „  Z dc dd „  Z de df „  Z dg dh di „ Z  dg dj dk „ Z! dl dm „  Z" d dn do „ Z# dp dq „  Z$ dr ds „  Z% dt du „  Z& d dv dw „ Z' dx f  dy dz „ Z( d{ d| „  Z) d} d~ „  Z* d d€ „  Z+ d� d‚ „  Z, dƒ d„ „  Z- d… d† d‡ „ Z. dˆ d‰ „  Z/ dŠ d‹ „  Z0 dŒ d� „  Z1 dŽ d� „  Z2 d� d‘ „  Z3 d’ d“ „  Z4 d” d• „  Z5 d– d— „  Z6 d˜ d™ „  Z7 dš d› „  Z8 dœ d� „  Z9 e: j; d dž … dË k sd¢ e: j< k rd£ Z= n d¤ Z= e> d¥ e> d¦ d§ d¨ d© ƒ dª e> d¦ d« e= d¨ d¬ ƒ d­ e> d¦ d« e= d¨ d¬ ƒ d® e> d¦ d¯ e= d¨ d© ƒ ƒ Z? e> d¦ d° d¨ d± ƒ Z@ d² d³ „  ZA d S)Ìr/   z'Manage a download/build/install processz Find/get/install Python packagesTúprefix=Núinstallation prefixúzip-okÚzúinstall package as a zipfileúmulti-versionÚmú%make apps have to require() a versionÚupgradeÚUú1force upgrade (searches PyPI for latest versions)úinstall-dir=Údúinstall package to DIRúscript-dir=rB   úinstall scripts to DIRúexclude-scriptsÚxúDon't install scriptsúalways-copyÚaú'Copy all needed packages to install dirú
index-url=Úiú base URL of Python Package Indexúfind-links=Úfú(additional URL(s) to search for packagesúbuild-directory=Úbú/download/extract/build in DIR; keep the resultsú	optimize=ÚOúlalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]úrecord=ú3filename in which to record list of installed filesúalways-unzipÚZú*don't install as a zipfile, no matter whatú
site-dirs=ÚSú)list of directories where .pth files workÚeditableÚeú+Install specified packages in editable formúno-depsÚNúdon't install dependenciesúallow-hosts=ÚHú$pattern(s) that hostnames must matchúlocal-snapshots-okÚlú(allow building eggs from local checkoutsÚversionú"print version information and exitúinstall-layout=ú1installation layout to choose (known values: deb)ú"force-installation-into-system-dirÚ0úforce installation into /usrúno-find-linksú9Don't load find-links defined in packages being installedz!install in user site-package '%s'Úuserc             C   sö  t  j r3 t j j t ƒ } | j t  j ƒ |  _ n	 d |  _ d  |  _	 |  _
 d  |  _ |  _ |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ |  _ d  |  _ |  _ |  _ d  |  _ |  _ |  _ d  |  _ |  _ |  _ d  |  _ d  |  _ d  |  _ d  |  _  d  |  _! d  |  _" d  |  _# d  |  _$ d  |  _% t  j rQt  j& |  _' t  j |  _( n d  |  _' d  |  _( d  |  _) d  |  _* d  |  _+ |  _, d  |  _- i  |  _. d |  _/ d  |  _0 d  |  _1 d  |  _2 d  |  _3 |  j4 j5 |  _5 |  j4 j6 |  |  j4 j7 d ƒ ƒ d  S)Nr   Fr/   )8ÚsiteÚENABLE_USER_SITEr;   r<   ÚabspathÚ__file__Ú
startswithÚ	USER_SITEr‡   Úzip_okÚlocal_snapshots_okÚinstall_dirÚ
script_dirÚexclude_scriptsÚ	index_urlÚ
find_linksÚbuild_directoryÚargsÚoptimizeÚrecordrP   Úalways_copyÚmulti_versionrr   Úno_depsÚallow_hostsÚrootÚprefixÚ	no_reportr~   Úinstall_purelibÚinstall_platlibÚinstall_headersÚinstall_libÚinstall_scriptsÚinstall_dataÚinstall_baseÚinstall_platbaseÚ	USER_BASEÚinstall_userbaseÚinstall_usersiteÚno_find_linksÚpackage_indexÚpth_fileÚalways_copy_fromÚ	site_dirsÚinstalled_projectsÚsitepy_installedÚinstall_layoutÚ"force_installation_into_system_dirÚ	multiarchÚ_dry_runÚdistributionÚverboseÚ_set_command_optionsÚget_option_dict)ÚselfZwhereamir8   r8   r9   Úinitialize_options‘   sR    																												zeasy_install.initialize_optionsc             C   s—   x� | D]ˆ } t  j j | ƒ s1 t  j j | ƒ r t j d | ƒ |  j s� t  j j | ƒ r| t  j j | ƒ r| t | ƒ qŒ t  j	 | ƒ q� q q Wd  S)NzDeleting %s)
r;   r<   r=   Úislinkr   ÚinfoÚdry_runÚisdirÚrmtreeÚunlink)rº   ÚblockersÚfilenamer8   r8   r9   Údelete_blockersÉ   s    $	%zeasy_install.delete_blockersc       
      C   s
  |  j  r- t d t d ƒ j  ƒ t j ƒ  n  t j  j ƒ  d } t d d ƒ \ } } i |  j j ƒ  d 6|  j j	 ƒ  d 6|  j j
 ƒ  d 6| d	 6| d d
 … d 6| d | d d 6| d 6| d 6| d 6| d 6t t d d ƒ d 6|  _ t j r|  j |  j d <|  j |  j d <n  |  j r—t j r—|  j ƒ  |  j d  k rNt d ƒ ‚ n  |  j |  _ |  _ t j d k r€|  j d ƒ q—|  j t j d ƒ n  |  j ƒ  |  j ƒ  |  j r|  j j ƒ  d4 k rØt d ƒ ‚ n  d d  l } t j d  d … d5 k r| j  d ƒ |  _! qn  |  j" d d d d ƒ |  j# d  k rI|  j$ |  _# n  |  j% d  k rdd |  _% n  |  j& d  d6 ƒ |  j& d! d7 ƒ |  j r±|  j' r±|  j' |  _$ |  j( |  _# n  |  j) d" k rÙ|  j* rÙt d# ƒ ‚ n  |  j& d$ d8 ƒ t+ t, t j- ƒ } t. ƒ  |  _/ |  j0 d  k	 r©d& d' „  |  j0 j d( ƒ Dƒ } xq | D]f } t j- j1 | ƒ sgt2 j3 d) | ƒ q<t, | ƒ | k rŒt | d* ƒ ‚ q<|  j/ j4 t, | ƒ ƒ q<Wn  |  j5 s¿|  j6 ƒ  n  |  j7 pËd+ |  _7 |  j/ d  d  … |  _8 xE |  j$ t, |  j# ƒ f D]+ } | |  j8 k r |  j8 j9 d | ƒ q q W|  j: d  k	 r`d, d' „  |  j: j d( ƒ Dƒ }	 n	 d- g }	 |  j; d  k rŸ|  j< |  j7 d. |  j8 d/ |	 ƒ|  _; n  t= |  j8 t j- ƒ |  _> |  j? d  k	 rñt@ |  j? tA ƒ rú|  j? j ƒ  |  _? qún	 g  |  _? |  jB r |  j; jC |  j8 t j- ƒ n  |  j% s?|  j; jD |  j? ƒ n  |  j& d  d9 ƒ t@ |  jE tF ƒ sÃy> tF |  jE ƒ |  _E d |  jE k o�d k n sžtG ‚ n  WqÃtG k
 r¿t d1 ƒ ‚ YqÃXn  |  j5 rå|  jH råtI d2 ƒ ‚ n  |  jJ sýtI d3 ƒ ‚ n  g  |  _K d  S):Nzsetuptools %sÚ
setuptoolsr   rž   Úexec_prefixÚ	dist_nameÚdist_versionÚdist_fullnameÚ
py_versionrA   Úpy_version_shorté   Úpy_version_nodotÚ
sys_prefixÚsys_exec_prefixÚabiflagsÚ ÚuserbaseÚusersitez$User base directory is not specifiedÚposixÚ	unix_userÚ_userÚdebz"unknown value for --install-layoutÚ	MULTIARCHr�   r‘   r•   r¯   Fr£   r¤   z/usrzÞinstallation into /usr

Trying to install into the system managed parts of the file system. Please
consider to install to another location, or use the option
--force-installation-into-system-dir to overwrite this warning.
Úinstallr˜   c             S   s(   g  |  ] } t  j j | j ƒ  ƒ ‘ q Sr8   )r;   r<   Ú
expanduserÚstrip)Ú.0rB   r8   r8   r9   ú
<listcomp>-  s   	 z1easy_install.finalize_options.<locals>.<listcomp>ú,z"%s (in --site-dirs) does not existz$ (in --site-dirs) is not on sys.pathzhttps://pypi.python.org/simplec             S   s   g  |  ] } | j  ƒ  ‘ q Sr8   )rÛ   )rÜ   rB   r8   r8   r9   rÝ   @  s   	 Ú*Úsearch_pathÚhostsr—   z--optimize must be 0, 1, or 2z9Must specify a build directory (-b) when using --editablez:No urls, filenames, or requirements specified (see --help))zdeb)rA   rA   )úinstall_dirrâ   )râ   z
script_dir)úrecordrã   )úoptimizerä   )Lr~   Úprintr"   ÚsysÚexitÚsplitr	   r¶   Úget_nameÚget_versionÚget_fullnameÚgetattrÚconfig_varsrˆ   r‰   r©   rª   r‡   Úcreate_home_pathr   r¦   r§   r;   ÚnameÚselect_schemeÚexpand_basedirsÚexpand_dirsr²   Úlowerr   Ú	sysconfigÚversion_infoÚget_config_varr´   Ú_expandr‘   r�   r«   Úset_undefined_optionsr    r¤   rž   r³   Úmapr   r<   Úget_site_dirsÚall_site_dirsr¯   r¿   r   ÚwarnÚappendrr   Úcheck_site_dirr“   Úshadow_pathÚinsertrœ   r¬   Úcreate_indexr$   Úlocal_indexr”   Ú
isinstancer   r�   Zscan_egg_linksÚadd_find_linksr—   ÚintÚ
ValueErrorr•   r   r–   Úoutputs)
rº   rÊ   rž   rÆ   rô   r?   r¯   rT   Ú	path_itemrá   r8   r8   r9   Úfinalize_optionsÓ   sÊ    		


				 "	!			 	zeasy_install.finalize_optionsc             C   sˆ   x� | D]y } t  |  | ƒ } | d  k	 r t j d k sF t j d k r[ t j j | ƒ } n  t | |  j ƒ } t |  | | ƒ q q Wd  S)NrÔ   Únt)rì   r;   rï   r<   rÚ   r   rí   Úsetattr)rº   ÚattrsÚattrÚvalr8   r8   r9   Ú_expand_attrsd  s    zeasy_install._expand_attrsc             C   s   |  j  d d d g ƒ d S)zNCalls `os.path.expanduser` on install_base, install_platbase and
        root.r¦   r§   r�   N)r  )rº   r8   r8   r9   rñ   m  s    zeasy_install.expand_basedirsc             C   s#   |  j  d d d d d d g ƒ d S)z+Calls `os.path.expanduser` on install dirs.r    r¡   r£   r¢   r¤   r¥   N)r  )rº   r8   r8   r9   rò   r  s    zeasy_install.expand_dirsc             C   s  |  j  |  j j  k r( t j |  j  ƒ n  zÑ x% |  j D] } |  j | |  j ƒ q5 W|  j rî |  j } |  j	 rµ t
 |  j	 ƒ } x5 t t
 | ƒ ƒ D] } | | | d  … | | <q� Wn  d d l m } |  j | j |  j | f d |  j ƒ n  |  j ƒ  Wd  t j |  j j  ƒ Xd  S)Nr   )Ú	file_utilz'writing list of installed files to '%s')r·   r¶   r   Úset_verbosityr–   r/   r›   r˜   r  r�   ÚlenÚrangeÚ	distutilsr  ÚexecuteÚ
write_fileÚwarn_deprecated_options)rº   Úspecr  Úroot_lenÚcounterr  r8   r8   r9   Úrunx  s$    			zeasy_install.runc          
   C   sG   y t  j ƒ  } Wn t j d t ƒ } Yn Xt  j j |  j d | ƒ S)zÈReturn a pseudo-tempname base in the install directory.
        This code is intentionally naive; if a malicious party can write to
        the target directory you're already in deep doodoo.
        r   ztest-easy-install-%s)r;   ÚgetpidÚrandomÚrandintr   r<   Újoinr�   )rº   Úpidr8   r8   r9   Úpseudo_tempnameŽ  s
    zeasy_install.pseudo_tempnamec             C   s   d  S)Nr8   )rº   r8   r8   r9   r  ™  s    z$easy_install.warn_deprecated_optionsc             C   sÀ  t  |  j ƒ } t j j | d ƒ } | |  j k } | rS |  j rS |  j ƒ  } n� |  j ƒ  d } t j j	 | ƒ } y: | rŽ t j
 | ƒ n  t | d ƒ j ƒ  t j
 | ƒ Wn" t t f k
 rÓ |  j ƒ  Yn X| rú |  j rú t |  j ƒ  ƒ ‚ n  | r*|  j d k r3t | |  j ƒ |  _ q3n	 d |  _ t j j d d ƒ j t j ƒ } | t t  d d „  | Dƒ ƒ k r‚d	 |  _ n1 |  j r³t j j	 | ƒ r³d	 |  _ d |  _ n  | |  _ d S)
z;Verify that self.install_dir is .pth-capable dir, if neededzeasy-install.pthz.write-testÚwNÚ
PYTHONPATHrÑ   c             S   s   g  |  ] } | r | ‘ q Sr8   r8   )rÜ   Ú_fr8   r8   r9   rÝ   ¾  s   	 z/easy_install.check_site_dir.<locals>.<listcomp>T)r   r�   r;   r<   r  rû   rš   Úcheck_pth_processingr!  r=   rÁ   ÚopenÚcloseÚOSErrorÚIOErrorÚcant_write_to_targetr   Úno_default_version_msgr­   r0   ÚenvironÚgetrè   Úpathseprù   r±   )rº   Úinstdirr­   Zis_site_dirZtestfileZtest_existsr#  r8   r8   r9   rþ   œ  s6     	!"	zeasy_install.check_site_dirc             C   s_   d } | t  j ƒ  d |  j f } t j j |  j ƒ sE | d 7} n
 | d 7} t | ƒ ‚ d  S)Na  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).
aK  
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://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again.
)ræ   Úexc_infor�   r;   r<   r=   r   )rº   ÚtemplateÚmsgr8   r8   r9   r*  Æ  s    
z!easy_install.cant_write_to_targetc             C   s.  |  j  } t j d | ƒ |  j ƒ  d } | d } t j j | ƒ } y] | r^ t j | ƒ n  t j j | ƒ } t j j | ƒ s’ t j	 | ƒ n  t
 | d ƒ } Wn" t t f k
 rÆ |  j ƒ  YnHXzì | j d | f ƒ | j ƒ  d } t j } t j d k rct j j | ƒ \ } } t j j | d ƒ }	 | j ƒ  d	 k rct j j |	 ƒ rc|	 } qcn  d
 d l m }
 |
 | d d d g d
 ƒ t j j | ƒ r²t j d | ƒ d SWd | rÉ| j ƒ  n  t j j | ƒ rët j | ƒ n  t j j | ƒ rt j | ƒ n  X|  j s*t j d | ƒ n  d S)z@Empirically verify whether .pth files are supported in inst. dirz Checking .pth file support in %sz.pthz.okr"  z7import os; f = open(%r, 'w'); f.write('OK'); f.close()
Nr
  zpythonw.exez
python.exer   )Úspawnz-Ez-cÚpassz-TEST PASSED: %s appears to support .pth filesTz+TEST FAILED: %s does NOT support .pth filesF)r�   r   r½   r!  r;   r<   r=   rÁ   ÚdirnameÚmakedirsr&  r(  r)  r*  Úwriter'  ræ   Ú
executablerï   rè   r  ró   Údistutils.spawnr4  rš   rü   )rº   r/  r­   Zok_fileZ	ok_existsr6  rb   r9  ÚbasenameZaltr4  r8   r8   r9   r%  í  sP    	
 
	$	z!easy_install.check_pth_processingc             C   s€   |  j  ro | j d ƒ ro xS | j d ƒ D]? } | j d | ƒ rH q) n  |  j | | | j d | ƒ ƒ q) Wn  |  j | ƒ d S)z=Write all the scripts for `dist`, unless scripts are excludedÚscriptszscripts/N)r’   Úmetadata_isdirÚmetadata_listdirÚinstall_scriptÚget_metadataÚinstall_wrapper_scripts)rº   ÚdistÚscript_namer8   r8   r9   Úinstall_egg_scripts  s    z easy_install.install_egg_scriptsc             C   s|   t  j j | ƒ rh xc t  j | ƒ D]? \ } } } x- | D]% } |  j j t  j j | | ƒ ƒ q8 Wq" Wn |  j j | ƒ d  S)N)r;   r<   r¿   Úwalkr  rý   r  )rº   r<   ÚbaseÚdirsÚfilesrÃ   r8   r8   r9   Ú
add_output+  s
    *zeasy_install.add_outputc             C   s#   |  j  r t d | f ƒ ‚ n  d  S)NzjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).)rr   r   )rº   r  r8   r8   r9   Únot_editable3  s    	zeasy_install.not_editablec             C   sW   |  j  s d  St j j t j j |  j | j ƒ ƒ rS t d | j |  j f ƒ ‚ n  d  S)Nz2%r already exists in %s; can't do a checkout there)rr   r;   r<   r=   r  r•   Úkeyr   )rº   r  r8   r8   r9   Úcheck_editable;  s    	'zeasy_install.check_editableFc             C   s®  t  j d d ƒ } d  } |  j s. |  j ƒ  n  zYt | t ƒ sÎ t | ƒ r‡ |  j | ƒ |  j j	 | | ƒ } |  j
 d  | | | d ƒ St j j | ƒ r¿ |  j | ƒ |  j
 d  | | | d ƒ St | ƒ } n  |  j | ƒ |  j j | | |  j |  j |  j |  j ƒ } | d  k rDd | } |  j r5| d 7} n  t | ƒ ‚ nB | j t k rm|  j | | | d ƒ | S|  j
 | | j | | ƒ SWd  t j j | ƒ r©t | ƒ n  Xd  S)Nrž   zeasy_install-Tz+Could not find suitable distribution for %rz2 (--always-copy skips system and development eggs)ÚUsing)ÚtempfileÚmkdtemprr   Úinstall_site_pyr  r%   r   rJ  r¬   ÚdownloadÚinstall_itemr;   r<   r=   Úparse_requirement_argrL  Zfetch_distributionrP   r™   r  r   Ú
precedencer,   Úprocess_distributionÚlocationrÀ   )rº   r  ÚdepsÚtmpdirrQ  rB  r3  r8   r8   r9   r/   E  s:    	 	
	zeasy_install.easy_installc             C   s�  | p |  j  } | p* t j j | ƒ | k } | p@ | j d ƒ } | p| |  j d  k	 o| t j j t | ƒ ƒ t |  j ƒ k } | rÃ | rÃ x4 |  j | j D] } | j	 | k r� Pq� q� Wd } n  t
 j d t j j | ƒ ƒ | r!|  j | | | ƒ } xP | D] } |  j | | | ƒ qWn, |  j | ƒ g } |  j | | d | d ƒ | d  k	 r}x! | D] } | | k r`| Sq`Wn  d  S)Nz.eggTzProcessing %sr   rM  )r™   r;   r<   r6  Úendswithr®   r   r  Úproject_namerV  r   r½   r;  Úinstall_eggsrU  Úegg_distribution)rº   r  rQ  rX  rW  Úinstall_neededrB  Údistsr8   r8   r9   rR  n  s.    	zeasy_install.install_itemc             C   sU   t  | } xD t D]< } d | } t |  | ƒ d k r t |  | | | ƒ q q Wd S)z=Sets the install directories by applying the install schemes.Úinstall_N)r   r   rì   r  )rº   rï   ÚschemerK  Úattrnamer8   r8   r9   rð   ’  s
    

zeasy_install.select_schemec             G   s6  |  j  | ƒ |  j j | ƒ |  j j | ƒ |  j | ƒ | |  j | j <t j |  j	 | | | Œ ƒ | j
 d ƒ r› |  j r› |  j j | j d ƒ ƒ n  | r° |  j r° d  S| d  k	 râ | j | j k râ t j d | ƒ d  S| d  k sú | | k r0| j ƒ  } | p| } t | j | j | j ƒ } n  t j d | ƒ y( t g  ƒ j | g |  j |  j ƒ } Wni t k
 rŸt j ƒ  d } t d | j ƒ ‚ Yn5 t k
 rÓt j ƒ  d } t d | j ƒ ‚ Yn X|  j sæ|  j r"x9 | D]. } | j |  j k rí|  j | j ƒ  ƒ qíqíWn  t j d | ƒ d  S)Nzdependency_links.txtzSkipping dependencies for %szProcessing dependencies for %sr0  z'Could not find required distribution %sz7Installed distribution %s conflicts with requirement %sz'Finished processing dependencies for %s)Ú
update_pthr¬   Úaddr  rD  r°   rK  r   r½   Úinstallation_reportÚhas_metadatar«   r  Úget_metadata_linesr™   rü   Úas_requirementr%   rZ  ÚspecsÚextrasr)   Úresolver/   r*   ræ   r1  r   r–   r+   r®   )rº   ÚrequirementrB  rW  r½   ZdistreqZdistrosrs   r8   r8   r9   rU  ›  sL    
	z!easy_install.process_distributionc             C   sA   |  j  d  k	 r |  j  S| j d ƒ r* d S| j d ƒ s= d Sd S)Nznot-zip-safeTzzip-safeF)rŽ   re  )rº   rB  r8   r8   r9   Úshould_unzipÊ  s    zeasy_install.should_unzipc             C   s  t  j j |  j | j ƒ } t  j j | ƒ rS d } t j | | j |  j | ƒ | St  j j | ƒ rn | } n€ t  j j	 | ƒ | k r– t  j
 | ƒ n  t  j | ƒ } t | ƒ d k rî t  j j | | d ƒ } t  j j | ƒ rî | } qî n  t | ƒ t j | | ƒ | S)Nz<%r already exists in %s; build directory %s will not be keptr0  r   )r;   r<   r  r•   rK  r=   r   rü   r¿   r6  rÁ   Úlistdirr  r!   ÚshutilÚmove)rº   r  Údist_filenameÚ
setup_baseÚdstr3  Úcontentsr8   r8   r9   Ú
maybe_moveÓ  s"    	
zeasy_install.maybe_movec             C   s4   |  j  s0 x$ t | ƒ D] } |  j | Œ  q Wn  d  S)N)r’   Úget_script_argsÚwrite_script)rº   rB  r–   r8   r8   r9   rA  è  s    	z$easy_install.install_wrapper_scriptsc                s—   t  | j ƒ  ƒ } t | | ƒ } ‡  f d d †  } | rz d ‰  | rZ ˆ  j d d ƒ ‰  n  t | ƒ | ˆ  ƒ t ƒ  } n  |  j | t | ƒ d ƒ d S)z/Generate a legacy script wrapper and install itc                s4   t  d ˆ  ƒ } | j d ƒ } | j d d ƒ } | S)am  
            There are a couple of template scripts in the package. This
            function loads one of them and prepares it for use.

            These templates use triple-quotes to escape variable
            substitutions so the scripts get the 2to3 treatment when build
            on Python 3. The templates cannot use triple-quotes naturally.
            rÅ   zutf-8z"""rÑ   )r    ÚdecodeÚreplace)rÃ   Z	raw_bytesZtemplate_strZclean_template)Útemplate_namer8   r9   Úget_templateò  s    	z1easy_install.install_script.<locals>.get_templatezscript template.pyz.pyz	 (dev).pyre   N)Ústrrg  Úis_python_scriptrx  Úget_script_headerÚlocalsrv  rC   )rº   rB  rC  Úscript_textZdev_pathr  Z	is_scriptrz  r8   )ry  r9   r?  í  s    	zeasy_install.install_scriptÚtc                sÛ   ˆ  j  ‡  f d d †  | Dƒ ƒ t j d | ˆ  j ƒ t j j ˆ  j | ƒ } ˆ  j | ƒ t ƒ  } ˆ  j	 s× t
 | ƒ t j j | ƒ r™ t j | ƒ n  t | d | ƒ } | j | ƒ | j ƒ  t | d | ƒ n  d S)z1Write an executable file to the scripts directoryc                s(   g  |  ] } t  j j ˆ  j | ƒ ‘ q Sr8   )r;   r<   r  r‘   )rÜ   rY   )rº   r8   r9   rÝ     s   	 z-easy_install.write_script.<locals>.<listcomp>zInstalling %s script to %sr"  iÿ  N)rÄ   r   r½   r‘   r;   r<   r  rI  Úcurrent_umaskr¾   r!   r=   rÁ   r&  r8  r'  Úchmod)rº   rC  rs  ÚmoderÂ   ÚtargetÚmaskrb   r8   )rº   r9   rv  
  s    		

zeasy_install.write_scriptc             C   sÓ  | j  ƒ  j d ƒ r( |  j | | ƒ g S| j  ƒ  j d ƒ rP |  j | | ƒ g S| } t j j | ƒ rŽ | j d ƒ rŽ t | | |  j ƒ n' t j j	 | ƒ rµ t j j
 | ƒ } n  | j | ƒ rñ |  j rñ | d  k	 rñ |  j | | | ƒ } n  t j j | d ƒ } t j j | ƒ s™t t j j | d d ƒ ƒ } | s[t d t j j
 | ƒ ƒ ‚ n  t | ƒ d k rŒt d t j j
 | ƒ ƒ ‚ n  | d	 } n  |  j r¿t j |  j | | ƒ ƒ g  S|  j | | ƒ Sd  S)
Nz.eggz.exez.pyzsetup.pyrß   z"Couldn't find a setup script in %sr0  zMultiple setup scripts in %sr   )ró   rY  Úinstall_eggÚinstall_exer;   r<   Úisfiler   Úunpack_progressr¿   rŠ   rŒ   r•   rt  r  r=   r   r   r  rr   r   r½   Úreport_editableÚbuild_and_install)rº   r  rp  rX  rq  Úsetup_scriptZsetupsr8   r8   r9   r[    s4    "	zeasy_install.install_eggsc             C   s[   t  j j | ƒ r3 t | t  j j | d ƒ ƒ } n t t j | ƒ ƒ } t j	 | d | ƒS)NzEGG-INFOÚmetadata)
r;   r<   r¿   r'   r  r(   Ú	zipimportÚzipimporterr&   Úfrom_filename)rº   Úegg_pathr�  r8   r8   r9   r\  D  s    !zeasy_install.egg_distributionc             C   sè  t  j j |  j t  j j | ƒ ƒ } t  j j | ƒ } |  j sL t | ƒ n  |  j | ƒ } t	 | | ƒ sÎt  j j
 | ƒ r¨ t  j j | ƒ r¨ t j | d |  j ƒn2 t  j j | ƒ rÚ |  j t  j | f d | ƒ n  t | ƒ t  j j
 | ƒ r+| j | ƒ rt j d } } qŒt j d } } na |  j | ƒ rZ|  j | ƒ |  j d } } n2 | j | ƒ r|t j d } } n t j d } } |  j | | | f | d t  j j | ƒ t  j j | ƒ f ƒ n  |  j | ƒ |  j | ƒ S)Nr¾   z	Removing ZMovingZCopyingZ
Extractingz	 %s to %s)r;   r<   r  r�   r;  rŠ   r¾   r!   r\  r.   r¿   r¼   r   Úremove_treer=   r  rÁ   Úuncache_zipdirrŒ   rn  ro  Úcopytreerl  ÚmkpathÚunpack_and_compileÚcopy2r6  rI  )rº   r‘  rX  ÚdestinationrB  rb   rN   r8   r8   r9   r†  K  s4    $	% 
)zeasy_install.install_eggc                sê  t  | ƒ } | d  k r+ t d | ƒ ‚ n  t d  d | j d d ƒ d | j d d ƒ d t ƒ  ƒ} t j j | | j ƒ  d ƒ } | _	 | d } t j j | d	 ƒ } t j j | d
 ƒ } t
 | ƒ t | | ƒ | _ |  j | | ƒ t j j | ƒ s}t | d ƒ }	 |	 j d ƒ xU | j d ƒ D]D \ }
 } |
 d k r(|	 j d |
 j d d ƒ j ƒ  | f ƒ q(q(W|	 j ƒ  n  t j j | d ƒ ‰  |  j ‡  f d d †  t | ƒ Dƒ ƒ t j | | d |  j d |  j ƒ|  j | | ƒ S)Nz(%s is not a valid distutils Windows .exerZ  r�  rï   r~   Úplatformz.eggz.tmpzEGG-INFOzPKG-INFOr"  zMetadata-Version: 1.0
Útarget_versionz%s: %s
Ú_ú-r<  c                s)   g  |  ] } t  j j ˆ  | d  ƒ ‘ q S)r   )r;   r<   r  )rÜ   r–   )r‘   r8   r9   rÝ   �  s   	 z,easy_install.install_exe.<locals>.<listcomp>r·   r¾   )r1   r   r&   r-  r
   r;   r<   r  Úegg_namerV  r!   r'   Ú	_providerÚ
exe_to_eggr=   r&  r8  Úitemsrx  Útitler'  rÄ   ru  r   Úmake_zipfiler·   r¾   r†  )rº   rp  rX  ÚcfgrB  r‘  Úegg_tmpZ	_egg_infoZpkg_infrb   ÚkÚvr8   )r‘   r9   r‡  l  s8    &

0 zeasy_install.install_exec                s¶  t  | ƒ ‰ g  ‰ g  ‰ i  ‰ ‡  ‡ ‡ ‡ ‡ f d d †  } t | ˆ  | ƒ g  } x™ ˆ D]‘ } | j ƒ  j d ƒ rY | j d ƒ } | d } t j | d ƒ d | d <t j j	 ˆ  | Œ } ˆ j
 | ƒ | j
 | ƒ t j | | ƒ qY qY W|  j ˆ ƒ t j t j j	 ˆ  d ƒ t j ˆ  | ƒ ƒ x‰ d D]� }	 t ƒ  |	 r-t j j	 ˆ  d |	 d
 ƒ }
 t j j |
 ƒ s®t |
 d ƒ } | j d j	 t ƒ  |	 ƒ d ƒ | j ƒ  q®q-q-Wd S)z;Extract a bdist_wininst to the directories an egg would usec                sR  |  j  ƒ  } xˆ D]\ } } | j | ƒ r | |  t | ƒ d  … }  |  j d ƒ } t j j ˆ  | Œ } | j  ƒ  } | j d ƒ s– | j d ƒ rÛ t j	 | d
 ƒ | d <d ˆ t j j
 | d ƒ d <ˆ j |  ƒ nI | j d ƒ r$| d k r$d ˆ t j j
 | d ƒ d <ˆ j | ƒ n  | Sq W|  j d ƒ sNt j d	 |  ƒ n  d  S)Nú/z.pydz.dllr0  r   z.pyzSCRIPTS/z.pthzWARNING: can't process %séÿÿÿÿr¨  )ró   rŒ   r  rè   r;   r<   r  rY  r   Ústrip_moduleÚsplitextrý   r   rü   )Úsrcrr  rB   ÚoldÚnewÚpartsÚdl)r¤  Únative_libsÚprefixesÚ
to_compileÚ	top_levelr8   r9   Úprocess�  s$    z(easy_install.exe_to_egg.<locals>.processz.pydr§  r0  z.pyzEGG-INFOr³  r°  z.txtr"  Ú
Nr¨  r¨  r¨  )z	top_levelznative_libs)r3   r   ró   rY  rè   r   r©  r;   r<   r  rý   Z
write_stubÚbyte_compileZwrite_safety_flagZanalyze_eggr~  r=   r&  r8  r'  )rº   rp  r¤  r´  ZstubsÚresr®  ÚresourceZpyfilerï   Ztxtrb   r8   )r¤  r°  r±  r²  r³  r9   rŸ  –  s4    
!zeasy_install.exe_to_eggZ	Installedc       	      C   sz   d } |  j  rN |  j rN | d 7} |  j t t t j ƒ k rN | d 7} qN n  | j } | j } | j	 } d } | t
 ƒ  S)z9Helpful installation message for display to package usersz
%(what)s %(eggloc)s%(extras)saé  

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.)
rÑ   )rš   rŸ   r�   rù   r   ræ   r<   rV  rZ  r~   r~  )	rº   ÚreqrB  Úwhatr3  Zegglocrï   r~   ri  r8   r8   r9   rd  È  s    
			z easy_install.installation_reportc             C   s&   t  j j | ƒ } t j } d t ƒ  S)Na"  
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.
)r;   r<   r6  ræ   r9  r~  )rº   r  rŒ  r6  Úpythonr8   r8   r9   rŠ  ä  s    		zeasy_install.report_editablec             C   s+  t  j j d t ƒ t  j j d t ƒ t | ƒ } |  j d k ri d |  j d } | j d d | ƒ n" |  j d k  r‹ | j d d ƒ n  |  j r§ | j d d	 ƒ n  t	 j
 d
 | t | ƒ d d  … d j | ƒ ƒ y t | | ƒ Wn< t k
 r&t  j ƒ  d } t d | j d f ƒ ‚ Yn Xd  S)Nzdistutils.command.bdist_eggzdistutils.command.egg_inforÌ   r¦  r0  r   rœ  z-qz-nzRunning %s %sú zSetup script exited with %s)ræ   ÚmodulesÚ
setdefaultr   r   Úlistr·   r   r¾   r   r½   r  r  r   Ú
SystemExitr1  r   r–   )rº   rŒ  rq  r–   r¦  r8   r8   r9   r   ñ  s"    	*zeasy_install.run_setupc       	      C   s  d d g } t  j d d d t j j | ƒ ƒ } z¼ |  j t j j | ƒ ƒ | j | ƒ |  j | | | ƒ t | g ƒ } g  } x? | D]7 } x. | | D]" } | j |  j	 | j
 | ƒ ƒ q™ Wqˆ W| rç |  j rç t j d | ƒ n  | SWd  t | ƒ t j |  j ƒ Xd  S)Nr   z
--dist-dirrž   zegg-dist-tmp-Údirz+No eggs found in %s (setup script problem?))rN  rO  r;   r<   r6  Ú_set_fetcher_optionsrý   r   r$   r†  rV  r¾   r   rü   rÀ   r  r·   )	rº   rŒ  rq  r–   Zdist_dirZall_eggsÚeggsrK  rB  r8   r8   r9   r‹    s$    	$	

zeasy_install.build_and_installc       	      C   s¥   |  j  j d ƒ j ƒ  } d } i  } xF | j ƒ  D]8 \ } } | | k rO q1 n  | d | | j d d	 ƒ <q1 Wt d | ƒ } t j 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/   r”   r¯   r“   r—   rœ   r0  r›  rœ  z	setup.cfgN)z
find_linksú	site_dirsz	index_urlzoptimizerÄ  zallow_hosts)r¶   r¹   Úcopyr   rx  Údictr;   r<   r  r   Zedit_config)	rº   rF  Zei_optsZfetch_directivesZfetch_optionsrK  r  ZsettingsZcfg_filenamer8   r8   r9   rÂ    s    	  z!easy_install._set_fetcher_optionsc             C   s²  |  j  d  k r d  Sx~ |  j  | j D]l } |  j sE | j | j k r$ t j d | ƒ |  j  j | ƒ | j |  j k r� |  j j | j ƒ q� q$ q$ W|  j s| j |  j  j k rÅ t j d | ƒ qt j d | ƒ |  j  j	 | ƒ | j |  j k r|  j j
 | j ƒ qn  |  j s®|  j  j ƒ  | j d k r®t j j |  j d ƒ } t j j | ƒ rot j | ƒ n  t | d ƒ } | j |  j  j | j ƒ d ƒ | j ƒ  q®n  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Å   zsetuptools.pthÚwtrµ  )r­   rK  rš   rV  r   r½   Úremoverÿ   Úpathsrc  rý   r¾   Úsaver;   r<   r  r�   r¼   rÁ   r&  r8  Úmake_relativer'  )rº   rB  rT   rÃ   rb   r8   r8   r9   rb  5  s4    	
	  zeasy_install.update_pthc             C   s   t  j d | | ƒ | S)NzUnpacking %s to %s)r   Údebug)rº   r«  rr  r8   r8   r9   r‰  Y  s    zeasy_install.unpack_progressc                s�   g  ‰ g  ‰ ‡  ‡ ‡ f d d †  } t  | | | ƒ ˆ  j ˆ ƒ ˆ  j s‰ x< ˆ D]1 } t j | ƒ t j d Bd @} t | | ƒ qQ Wn  d  S)Nc                s�   | j  d ƒ r/ |  j d ƒ r/ ˆ j | ƒ n. | j  d ƒ sM | j  d ƒ r] ˆ j | ƒ n  ˆ  j |  | ƒ ˆ  j r} | p€ d  S)Nz.pyz	EGG-INFO/z.dllz.so)rY  rŒ   rý   r‰  r¾   )r«  rr  )rº   Úto_chmodr²  r8   r9   Úpfb  s    z+easy_install.unpack_and_compile.<locals>.pfim  ií  )r   r¶  r¾   r;   ÚstatÚST_MODEr‚  )rº   r‘  r˜  rÎ  rb   rƒ  r8   )rº   rÍ  r²  r9   r–  ^  s    	zeasy_install.unpack_and_compilec             C   s¤   t  r |  j d ƒ d  Sd d l m } ze t j |  j d ƒ | | d d d d d |  j ƒ|  j r‹ | | d |  j d d d |  j ƒn  Wd  t j |  j ƒ Xd  S)Nz%byte-compiling is disabled, skipping.r   )r¶  r0  r—   Úforcer¾   )	r   rü   Údistutils.utilr¶  r   r  r·   r¾   r—   )rº   r²  r¶  r8   r8   r9   r¶  q  s    	zeasy_install.byte_compilec             C   s&   d } | |  j  t j j d d ƒ f S)Naæ  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://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

Please make the appropriate changes for your system and try again.r#  rÑ   )r�   r;   r,  r-  )rº   r2  r8   r8   r9   r+  „  s    z#easy_install.no_default_version_msgc             C   s?  |  j  r d St j j |  j d ƒ } t d d ƒ } d } t j j | ƒ rÇ t j d |  j ƒ t	 | d ƒ } | j
 ƒ  } t j d k r˜ | j ƒ  } n  | j ƒ  | j d	 ƒ sÇ t d
 | ƒ ‚ qÇ n  | | k r2t j d | ƒ |  j st | ƒ t	 | d ƒ } | j | ƒ | j ƒ  n  |  j | g ƒ n  d |  _  d S)z8Make sure there's a site.py in the target dir, if neededNzsite.pyrÅ   zsite-patch.pyrÑ   zChecking existing site.py in %sÚrbrA   zdef __boot():z;%s is not a setuptools-generated site.py; please remove it.zCreating %sÚwbT)rA   )r±   r;   r<   r  r�   r    r=   r   rÌ  r&  Úreadræ   rõ   rw  r'  rŒ   r   r½   r¾   r!   r8  r¶  )rº   ZsitepyÚsourceÚcurrentrb   r8   r8   r9   rP  £  s2    	
	
zeasy_install.install_site_pyc             C   s�   |  j  s d St t j j d ƒ ƒ } xc t |  j ƒ D]R \ } } | j | ƒ r5 t j j | ƒ r5 |  j	 d | ƒ t j
 | d ƒ q5 q5 Wd S)zCreate directories under ~.Nú~zos.makedirs('%s', 0700)iÀ  )r‡   r   r;   r<   rÚ   r   rí   rŒ   r¿   Údebug_printr7  )rº   Úhomerï   r<   r8   r8   r9   rî   Ç  s    	"zeasy_install.create_home_pathrA   ú2.3ú2.4ú2.5Úreal_prefixzsite-packageszdist-packagesrÔ   r�   z/$base/lib/python$py_version_short/site-packagesr‘   z	$base/binÚ
unix_localz*$base/local/lib/python$py_version_short/%sz$base/local/binÚposix_localÚ
deb_systemz$base/lib/python3/%sz$base/Lib/site-packagesz$base/Scriptsc             G   s€  |  j  d ƒ j } |  j s$ |  j rú |  j rT |  j j ƒ  d k rT d } d |  _ n* |  j sl d t j k rx t j } n d } | j	 ƒ  } |  j | d <|  j
 j | |  j ƒ } xH | j ƒ  D]7 \ } } t |  | d  ƒ d  k r¼ t |  | | ƒ q¼ q¼ Wn  d d	 l m } xo | D]g } t |  | ƒ } | d  k	 r| | | ƒ } t j d
 k ret j j | ƒ } n  t |  | | ƒ qqWd  S)NrÙ   r×   rá  z/usrrÞ  rà  rF  r   )r   rÔ   )zdeb)Úget_finalized_commandrí   rž   r²   ró   ræ   Ú__dict__r;   rï   rÅ  r   r-  ÚDEFAULT_SCHEMEr   rì   r  rÒ  r   r<   rÚ   )rº   r  rí   Zscheme_namer`  r  r  r   r8   r8   r9   r÷   î  s,    zeasy_install._expand)rH   NrI   )rJ   rK   rL   )rM   rN   rO   )zupgraderQ   rR   )rS   rT   rU   )rV   rB   rW   )rX   rY   rZ   )r[   r\   r]   )r^   r_   r`   )ra   rb   rc   )rd   re   rf   )rg   rh   ri   )rj   Nrk   )rl   rm   rn   )ro   rp   rq   )zeditablers   rt   )ru   rv   rw   )rx   ry   rz   )r{   r|   r}   )zversionNr   )r€   Nr�   )r‚   rƒ   r„   )r…   Nr†   )rÛ  rÜ  rÝ  )BÚ__name__Ú
__module__Ú__qualname__Ú__doc__ÚdescriptionZcommand_consumes_argumentsÚuser_optionsÚboolean_optionsrˆ   r‰   r�   Zhelp_msgrý   Únegative_optr   r  r»   rÄ   r	  r  rñ   rò   r  r!  r  rþ   r*  r%  rD  rI  rJ  rL  r/   rR  rð   rU  rl  rt  rA  r?  rv  r[  r\  r†  r‡  rŸ  rd  rŠ  r   r‹  rÂ  rb  r‰  r–  r¶  r+  rP  rî   ræ   r~   rã  Zsitedir_namerÆ  r   rä  r÷   r8   r8   r8   r9   r/   _   sÌ        		8
‘	*'0
)$	/	(!*2$$
(		
	
	
	c           
   C   sv  d d „  t  j j d d ƒ j t  j ƒ Dƒ }  t j g } t j t j k r_ | j t j ƒ n  xš| D]’} | rf t j	 d k r£ |  j t  j
 j | d d ƒ ƒ nä t  j d	 k r |  j t  j
 j | d
 d t j d  d … d ƒ t  j
 j | d
 d ƒ g ƒ n‡ t j d  d … d k r"d } n d } |  j t  j
 j | d d t j d  d … | ƒ t  j
 j | d
 d t j d  d … | ƒ g ƒ t j	 d k rød | k rõt  j j d ƒ } | rò|  j t  j
 j | d d t j d  d … d ƒ ƒ qòqõqøqf qf Wt d ƒ t d ƒ f } x* | D]" } | |  k r|  j | ƒ qqWt j r]|  j t j ƒ n  t t t |  ƒ ƒ }  |  S)Nc             S   s   g  |  ] } | r | ‘ q Sr8   r8   )rÜ   r$  r8   r8   r9   rÝ     s   	 z!get_site_dirs.<locals>.<listcomp>r#  rÑ   Úos2emxÚriscosÚLibzsite-packagesr§  Úlibr»  rA   zsite-pythonú2.3ú2.4ú2.5zdist-packagesz	local/libÚdarwinzPython.frameworkÚHOMEÚLibraryÚPythonÚpurelibÚplatlib)rí  rî  )rñ  rò  ró  )r;   r,  r-  rè   r.  ræ   rž   rÆ   rý   r™  r<   r  ÚsepÚextendr~   r   rˆ   r‰   r�   r¿  rù   r   )Úsitedirsr±  rž   ZsdirrÚ  Z	lib_pathsZsite_libr8   r8   r9   rú   
  sN    "	)0 	rú   c             c   s^  i  } xQ|  D]I} t  | ƒ } | | k r1 q n  d | | <t j j | ƒ sS q n  t j | ƒ } | | f Vxæ | D]Þ } | j d ƒ s� qt n  | d k r¡ qt n  t t j j | | ƒ ƒ } t t	 | ƒ ƒ } | j
 ƒ  xw | D]o } | j d ƒ sß t  | j ƒ  ƒ } | | k rNd | | <t j j | ƒ s4qß n  | t j | ƒ f VqNqß qß Wqt Wq Wd S)zBYield sys.path directories that might contain "old-style" packagesr0  z.pthúeasy-install.pthúsetuptools.pthÚimportN)rý  rþ  )r   r;   r<   r¿   rm  rY  r&  r  r¿  r   r'  rŒ   Úrstrip)ÚinputsÚseenr6  rH  rï   rb   ÚlinesÚliner8   r8   r9   Úexpand_paths=  s4    


r  c             C   sÉ  t  |  d ƒ } z¨t j | ƒ } | d k r1 d S| d | d | d } | d k  r[ d S| j | d ƒ d d l m } m } d d l } | j d	 | j	 d ƒ ƒ \ } } }	 | d k rÂ d S| j | d | ƒ | j
 i d d 6d d 6ƒ }
 y~ | j	 | ƒ } t j d k r't d g ƒ } n t d ƒ } | j | d ƒ d } | j t j ƒ  ƒ } |
 j | | ƒ ƒ Wn | j k
 r�d SYn X|
 j d ƒ s®|
 j d ƒ r²d S|
 SWd | j ƒ  Xd S)znExtract configuration data from a bdist_wininst .exe

    Returns a ConfigParser.RawConfigParser, or None
    rÓ  Né	   é   é   é   r   )ÚStringIOÚConfigParserz<iiiézV4é{V4rÑ   r~   rš  rÌ   r0  r�  ZSetup)r  r  )rÌ   r  )r&  ÚzipfileÚ_EndRecDataÚseekÚsetuptools.compatr
  r  r6   ÚunpackrÕ  ÚRawConfigParserræ   rõ   ÚbytesÚchrrè   rw  ÚgetfilesystemencodingÚreadfpÚErrorÚhas_sectionr'  )rp  rb   ÚendrecZ	prependedr
  r  r6   ÚtagZcfglenZbmlenr£  ÚpartÚ	null_byteÚconfigr8   r8   r9   r1   f  s<    $	 c             C   sÚ  d d d d d g } t  j |  ƒ } z}xv| j ƒ  D]h} | j } | j d ƒ } t | ƒ d	 k r· | d
 d k r· | d j d ƒ r· | j d d j | d d
 … ƒ d f ƒ Pq· n  t | ƒ d
 k s4 | j d ƒ rß q4 n  | j d ƒ rô q4 n  | d j	 ƒ  d k r4 | j
 | ƒ } t j d  k r7| j ƒ  } n  xb t | ƒ D]Q } | j ƒ  j d d ƒ } | j d ƒ sD| j d | d | f d f ƒ qDqDWq4 q4 WWd | j ƒ  Xd d „  | Dƒ } | j ƒ  | j ƒ  | S)!z4Get exe->egg path translations for a given .exe fileúPURELIB/rÑ   úPLATLIB/pywin32_system32úPLATLIB/úSCRIPTS/úEGG-INFO/scripts/úDATA/lib/site-packagesr§  rA   rÌ   zPKG-INFOr0  z	.egg-infor   Nz	EGG-INFO/z.pthz
-nspkg.pthÚPURELIBÚPLATLIBú\rÿ  z%s/%s/c             S   s(   g  |  ] \ } } | j  ƒ  | f ‘ q Sr8   )ró   )rÜ   rY   Úyr8   r8   r9   rÝ   µ  s   	 z$get_exe_prefixes.<locals>.<listcomp>)r  rÑ   )r   rÑ   )r!  rÑ   )r"  r#  )r$  rÑ   )r%  r&  )rA   )r  ÚZipFileÚinfolistrÃ   rè   r  rY  r   r  ÚupperrÕ  ræ   rõ   rw  r   rÛ   rx  rŒ   rý   r'  ÚsortÚreverse)Zexe_filenamer±  rK   r½   rï   r®  rs  Úpthr8   r8   r9   r3   •  s<    		")"3

c             C   s=   y t  j |  ƒ SWn% t k
 r8 t d |  f ƒ ‚ Yn Xd  S)Nz1Not a URL, existing file, or requirement spec: %r)r%   Úparser  r   )r  r8   r8   r9   rS  »  s
    rS  c               @   sg   e  Z d  Z d Z d Z f  d d „ Z d d „  Z d d „  Z d	 d
 „  Z d d „  Z	 d d „  Z
 d S)r0   z)A .pth file with Distribution paths in itFc             C   sœ   | |  _  t t t | ƒ ƒ |  _ t t j j |  j  ƒ ƒ |  _ |  j	 ƒ  t
 j |  g  d  d  ƒ x6 t |  j ƒ D]% } t t |  j t | d ƒ ƒ ƒ qo Wd  S)NT)rÃ   r¿  rù   r   rü  r;   r<   r6  ÚbasedirÚ_loadr$   Ú__init__r   rÉ  rc  r#   )rº   rÃ   rü  r<   r8   r8   r9   r2  È  s    	
zPthDistributions.__init__c             C   s„  g  |  _  d } t j |  j ƒ } t j j |  j ƒ r3t |  j d ƒ } xÛ | D]Ó } | j	 d ƒ rp d } qO n  | j
 ƒ  } |  j  j | ƒ | j ƒ  sO | j ƒ  j	 d ƒ r´ qO n  t t j j |  j | ƒ ƒ } |  j  d <t j j | ƒ sü | | k r|  j  j ƒ  d |  _ qO n  d | | <qO W| j ƒ  n  |  j  rO| rOd |  _ n  x. |  j  r|  j  d j ƒ  r|  j  j ƒ  qRWd  S)	NFÚrtrÿ  Tú#r0  r¨  r¨  )rÉ  rÆ  Úfromkeysrü  r;   r<   rˆ  rÃ   r&  rŒ   r   rý   rÛ   r   r  r0  r=   ÚpopÚdirtyr'  )rº   Z
saw_importr  rb   r  r<   r8   r8   r9   r1  Ñ  s2    	"&	 zPthDistributions._loadc             C   sê   |  j  s d Sd j t |  j |  j ƒ ƒ } | r¢ t j d |  j ƒ d | } t j	 j
 |  j ƒ rv t j |  j ƒ n  t |  j d ƒ } | j | ƒ | j ƒ  n; t j	 j |  j ƒ rÝ t j d |  j ƒ t j |  j ƒ n  d |  _  d S)z$Write changed .pth file back to diskNrµ  z	Saving %sz¼import sys; sys.__plen = len(sys.path)
%s
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)
rÇ  zDeleting empty %sF)r7  r  rù   rË  rÉ  r   rÌ  rÃ   r;   r<   r¼   rÁ   r&  r8  r'  r=   )rº   Údatarb   r8   r8   r9   rÊ  ð  s     	zPthDistributions.savec             C   sl   | j  |  j k rX | j  |  j k s9 | j  t j ƒ  k rX |  j j | j  ƒ d |  _ n  t j |  | ƒ d S)z"Add `dist` to the distribution mapTN)	rV  rÉ  rü  r;   Úgetcwdrý   r7  r$   rc  )rº   rB  r8   r8   r9   rc    s    zPthDistributions.addc             C   sI   x2 | j  |  j k r4 |  j j | j  ƒ d |  _ q Wt j |  | ƒ d S)z'Remove `dist` from the distribution mapTN)rV  rÉ  rÈ  r7  r$   )rº   rB  r8   r8   r9   rÈ    s    zPthDistributions.removec             C   sÐ   t  j j t | ƒ ƒ \ } } t |  j ƒ } | g } t  j d k rK d pQ t  j } xu t | ƒ | k rÇ | |  j k rŸ | j t  j	 ƒ | j
 ƒ  | j | ƒ St  j j | ƒ \ } } | j | ƒ qW W| Sd  S)Nr§  )r;   r<   rè   r   r  r0  Úaltseprú  rý   Úcurdirr-  r  )rº   r<   ÚnpathÚlastZbaselenr®  rú  r8   r8   r9   rË    s    	
zPthDistributions.make_relativeN)rå  ræ  rç  rè  r7  r2  r1  rÊ  rc  rÈ  rË  r8   r8   r8   r9   r0   Ã  s   	
Fc             C   s/  d d l  m } t | j t ƒ s= t j | j j ƒ  ƒ } n  |  d j ƒ  d } | j	 | ƒ } d } | r— | j
 d ƒ p~ d } | r— d | } q— n  | r¦ d } n t | ƒ } d t ƒ  } t | ƒ s| r| j ƒ  j d	 ƒ rd
 | j ƒ  d d … } qqd
 } n  t | | ƒ } d t ƒ  } | S)z;Create a #! line, getting options (if any) from script_textr   )Úfirst_line_rerµ  rÑ   r0  r¼  z
python.exez#!%(executable)s%(options)s
rœ  z -xN)Zdistutils.command.build_scriptsr>  r  Úpatternr{  ÚreÚcompilerw  Ú
splitlinesÚmatchÚgroupÚnt_quote_argr~  rF   rÛ   rŒ   Úfix_jython_executable)r  r9  Úwininstr>  ÚfirstrC  ÚoptionsÚhdrr8   r8   r9   r}  -  s,     	 	r}  c             C   sz   |  t  j k r8 t  j d k r8 t | t j ƒ |  | ƒ St j ƒ  \ } } } t | | d | d d |  | f f ƒ d  S)Nr
  r   r0  z %s %s)	r;   rÈ  rï   r‚  rÏ  ÚS_IWRITEræ   r1  r   )ÚfuncÚargÚexcÚetÚevr›  r8   r8   r9   Ú
auto_chmodL  s
    
rQ  c             C   s1   d d l  m } t |  | ƒ t |  t j ƒ d S)z?Ensure that the importer caches dont have stale info for `path`r   )Ú_zip_directory_cacheN)rŽ  rR  Ú_uncacheræ   Úpath_importer_cache)r<   Zzdcr8   r8   r9   r“  S  s    r“  c             C   sT   |  | k r | |  =n: t  |  ƒ }  x+ | D]# } t  | ƒ |  k r) | | =d  Sq) Wd  S)N)r   )r<   ÚcacheÚpr8   r8   r9   rS  Y  s    
rS  z<string>c             C   s;   y t  |  | d ƒ Wn t t f k
 r2 d SYn Xd Sd S)z%Is this string a valid Python script?ÚexecFTN)rA  ÚSyntaxErrorÚ	TypeError)ÚtextrÃ   r8   r8   r9   Ú	is_pythonc  s
    	r[  c             C   sR   y) t  |  ƒ } | j d ƒ } | j ƒ  Wn t t f k
 rG |  SYn X| d k S)zCDetermine if the specified executable is a .sh (contains a #! line)rÌ   z#!)r&  rÕ  r'  r(  r)  )r9  ÚfpÚmagicr8   r8   r9   Úis_shl  s     	r^  c             C   s  g  } d } d } d |  k p' d |  k } | r@ | j  d ƒ n  x‚ |  D]z } | d k rf | d 7} qG | d k r” | j  d | d d	 ƒ d } qG | r´ | j  d | ƒ d } n  | j  | ƒ qG W| rß | j  d | ƒ n  | r| j  d | ƒ | j  d ƒ n  d
 j | ƒ S)z@Quote a command line argument according to Windows parsing rulesFr   r¼  ú	ú"r'  r0  rÌ   z\"rÑ   )rý   r  )rM  ÚresultÚ	needquoteÚnbÚcr8   r8   r9   rE  u  s,    		rE  c             C   sb   | j  d ƒ s | j  d ƒ r" d St |  | ƒ r5 d S|  j d ƒ r^ d |  j ƒ  d j ƒ  k Sd S)zMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc.
    z.pyz.pywTz#!r»  r   F)rY  r[  rŒ   rB  ró   )r  rÃ   r8   r8   r9   r|  –  s    r|  )r‚  c              G   s   d  S)Nr8   )r–   r8   r8   r9   Ú_chmod§  s    re  c             C   s`   t  j d |  | ƒ y t |  | ƒ Wn5 t j k
 r[ t j ƒ  d } t  j d | ƒ Yn Xd  S)Nzchanging mode of %s to %or0  zchmod failed: %s)r   rÌ  re  r;   Úerrorræ   r1  )r<   rƒ  rs   r8   r8   r9   r‚  ©  s    r‚  c             C   sn   t  j j d ƒ rj t |  ƒ rj d d  l } | j j j d ƒ d k rI |  S| r_ t j	 d ƒ qj d |  Sn  |  S)NÚjavar   zos.nameÚLinuxzœWARNING: Unable to adapt shebang line for Jython, the following script is NOT executable
         see http://bugs.jython.org/issue1112 for more information.z/usr/bin/env %s)
ræ   r™  rŒ   r^  rg  ÚlangÚSystemÚgetPropertyr   rü   )r9  rI  rg  r8   r8   r9   rF  ±  s    
rF  c               @   sg   e  Z d  Z d Z e j d ƒ j ƒ  Z e e	 d d d „ ƒ Z
 e d d „  ƒ Z e d d	 „  ƒ Z d
 S)ÚScriptWriterz`
    Encapsulates behavior around writing entry point scripts for console and
    gui apps.
    a6  
        # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r
        __requires__ = %(spec)r
        import sys
        from pkg_resources import load_entry_point

        if __name__ == '__main__':
            sys.exit(
                load_entry_point(%(spec)r, %(group)r, %(name)r)()
            )
    Fc             c   s°   |  j  | ƒ } t | j ƒ  ƒ } t d | | ƒ } xv d D]n } | d } x[ | j | ƒ j ƒ  D]D \ }	 }
 | j t ƒ  } x% | j | |	 | | ƒ D] } | Vq• Wq` Wq: Wd S)zW
        Yield write_script() argument tuples for a distribution's entrypoints
        rÑ   ÚconsoleÚguiZ_scriptsN)zconsolezgui)	Ú
get_writerr{  rg  r}  Úget_entry_mapr   r2  r~  Ú_get_script_args)ÚclsrB  r9  rG  Z	gen_classr  ÚheaderÚtype_rD  rï   Úepr  r·  r8   r8   r9   ru  Ø  s    
"zScriptWriter.get_script_argsc             C   s#   | s t  j d k r t j ƒ  S|  S)NÚwin32)ræ   r™  ÚWindowsScriptWriterro  )rr  Zforce_windowsr8   r8   r9   ro  è  s    
zScriptWriter.get_writerc             c   s   | | | f Vd  S)Nr8   )rr  rt  rï   rs  r  r8   r8   r9   rq  î  s    zScriptWriter._get_script_argsN)rå  ræ  rç  rè  ÚtextwrapÚdedentÚlstripr2  ÚclassmethodÚsys_executableru  ro  rq  r8   r8   r8   r9   rl  Æ  s   
rl  c               @   sF   e  Z d  Z e d d „  ƒ Z e d d „  ƒ Z e d d „  ƒ Z d S)rw  c             C   s2   t  d t d |  ƒ } t j j d d ƒ } | | S)z:
        Get a script writer suitable for Windows
        r9  ZnaturalZSETUPTOOLS_LAUNCHER)rÆ  ÚWindowsExecutableLauncherWriterr;   r,  r-  )rr  Zwriter_lookupÚlauncherr8   r8   r9   ro  õ  s
    	zWindowsScriptWriter.get_writerc             #   sÂ   t  d d d d ƒ | } | t j d j ƒ  j d ƒ k rR t j d | t ƒ n  d d d	 d
 d d d g } | j | ƒ |  j	 | | ƒ } ‡  f d d †  | Dƒ } ˆ  | | | d | f Vd S)z For Windows, add a .py extensionrm  z.pyarn  z.pywÚPATHEXTú;zH%s not listed in PATHEXT; scripts will not be recognized as executables.z.pyz
-script.pyz.pycz.pyoz.exec                s   g  |  ] } ˆ  | ‘ q Sr8   r8   )rÜ   rY   )rï   r8   r9   rÝ     s   	 z8WindowsScriptWriter._get_script_args.<locals>.<listcomp>r€  N)
rÆ  r;   r,  ró   rè   Úwarningsrü   ÚUserWarningrÈ  Ú_adjust_header)rr  rt  rï   rs  r  Úextr¬  rÂ   r8   )rï   r9   rq    s    "	z$WindowsScriptWriter._get_script_argsc             C   s¡   d } d } |  d k r( | | } } n  t  j t  j | ƒ t  j ƒ } | j d | d | ƒ } | d d
 … j d ƒ } t j d	 k r� t j	 j
 | ƒ r� | S| S)zŠ
        Make sure 'pythonw' is used for gui and and 'python' is used for
        console (regardless of what sys.executable is).
        zpythonw.exez
python.exern  ÚstringÚreplrÌ   r0  r`  rv  r¨  )r@  rA  ÚescapeÚ
IGNORECASEÚsubrÛ   ræ   r™  r;   r<   r=   )rt  Zorig_headerr?  r†  Z
pattern_obZ
new_headerZclean_headerr8   r8   r9   rƒ    s    "z"WindowsScriptWriter._adjust_headerN)rå  ræ  rç  r{  ro  rq  Ústaticmethodrƒ  r8   r8   r8   r9   rw  ô  s   rw  c               @   s"   e  Z d  Z e d d „  ƒ Z d S)r}  c             #   sÉ   | d k r$ d } d } d g } n d } d } d d d g } |  j  | | ƒ } ‡  f d	 d
 †  | Dƒ }	 ˆ  | | | d |	 f Vˆ  d t | ƒ d f Vt ƒ  sÅ ˆ  d }
 |
 t ˆ  ƒ d f Vn  d S)zG
        For Windows, add a .py extension and an .exe launcher
        rn  z-script.pywz.pywÚcliz
-script.pyz.pyz.pycz.pyoc                s   g  |  ] } ˆ  | ‘ q Sr8   r8   )rÜ   rY   )rï   r8   r9   rÝ   1  s   	 zDWindowsExecutableLauncherWriter._get_script_args.<locals>.<listcomp>r€  z.exere   z.exe.manifestN)rƒ  Úget_win_launcherr:   Úload_launcher_manifest)rr  rt  rï   rs  r  Zlauncher_typer„  r¬  rJ  rÂ   Zm_namer8   )rï   r9   rq  #  s    	
z0WindowsExecutableLauncherWriter._get_script_argsN)rå  ræ  rç  r{  rq  r8   r8   r8   r9   r}  "  s   r}  c             C   st   d |  } t  j ƒ  j ƒ  d k r7 | j d d ƒ } n  t ƒ  rU | j d d ƒ } n | j 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.exeÚarmÚ.z-arm.z-64.z-32.rÅ   )r™  Úmachineró   rx  r:   r    )ÚtypeZlauncher_fnr8   r8   r9   rŒ  C  s    
	rŒ  c             C   sH   t  j t d ƒ } t j d d k  r0 | t ƒ  S| j d ƒ t ƒ  Sd  S)Nzlauncher manifest.xmlr   rA   zutf-8)Úpkg_resourcesr    rå  ræ   rõ   Úvarsrw  )rï   Úmanifestr8   r8   r9   r�  T  s    r�  c             C   s~  | r d d „  } n | d k r0 d d „  } n  g  } y t  j |  ƒ } Wn. t  j k
 ry | t  j |  t j ƒ  ƒ Yn Xx» | D]³ } t  j j |  | ƒ } y t  j | ƒ j } Wn t  j k
 rÏ d } Yn Xt	 j
 | ƒ rò t | | | ƒ q� y t  j | ƒ Wq� t  j k
 r3| t  j | t j ƒ  ƒ Yq� Xq� Wy t  j |  ƒ Wn. t  j k
 ry| t  j |  t j ƒ  ƒ Yn Xd S)z¡Recursively delete a directory tree.

    This code is taken from the Python 2.4 version of 'shutil', because
    the 2.3 version doesn't really work right.
    c              W   s   d  S)Nr8   )r–   r8   r8   r9   Úonerrorb  s    zrmtree.<locals>.onerrorNc              W   s   ‚  d  S)Nr8   )r–   r8   r8   r9   r•  e  s    r   )r;   rm  rf  ræ   r1  r<   r  ÚlstatÚst_moderÏ  ÚS_ISDIRrÀ   rÈ  Úrmdir)r<   Úignore_errorsr•  Únamesrï   Úfullnamerƒ  r8   r8   r9   rÀ   [  s2    "rÀ   c              C   s    t  j d ƒ }  t  j |  ƒ |  S)Né   )r;   Úumask)Útmpr8   r8   r9   r�  ~  s    r�  c              C   sM   d d  l  }  t j j |  j d ƒ } | t j d <t j j | ƒ t ƒ  d  S)Nr   )	rÅ   r;   r<   r6  Ú__path__ræ   Úargvrý   r2   )rÅ   Zargv0r8   r8   r9   Ú	bootstrapƒ  s
    r¢  c                s½   d d l  m ‰ d d l m ‰  d d  l ‰ d ‰ ‡ f d d †  ‰ ‡ ‡ f d d †  ‰ G‡  ‡ f d	 d
 †  d
 ˆ  ƒ ‰ ˆ d  k rš t j d d  … ‰ n  ˆ ‡ ‡ ‡ ‡ f d d †  ƒ d  S)Nr   )Úsetup)r&   zLusage: %(script)s [options] requirement_or_url ...
   or: %(script)s --help
c                s   ˆ  t  d t j j |  ƒ ƒ S)NÚscript)rÆ  r;   r<   r;  )rC  )ÚUSAGEr8   r9   Ú	gen_usage•  s    	zmain.<locals>.gen_usagec                s7   ˆ  j  j } z ˆ ˆ  j  _ |  ƒ  SWd  | ˆ  j  _ Xd  S)N)Úcorer¦  )rb   Zold_gen_usage)r  r¦  r8   r9   Úwith_ei_usageš  s
    zmain.<locals>.with_ei_usagec                   s+   e  Z d  Z d Z ‡  ‡ f d d †  Z d S)z-main.<locals>.DistributionWithoutHelpCommandsrÑ   c                s#   ˆ ‡ ‡  ‡ ‡ f d d †  ƒ d  S)Nc                  s   ˆ  j  ˆ ˆ ˆ Ž S)N)Ú
_show_helpr8   )r&   r–   Úkwrº   r8   r9   Ú<lambda>¦  s    zJmain.<locals>.DistributionWithoutHelpCommands._show_help.<locals>.<lambda>r8   )rº   r–   rª  )r&   r¨  )r–   rª  rº   r9   r©  ¥  s    z8main.<locals>.DistributionWithoutHelpCommands._show_helpN)rå  ræ  rç  Úcommon_usager©  r8   )r&   r¨  r8   r9   ÚDistributionWithoutHelpCommands¢  s   r­  r0  c                  s6   ˆ d d d d g ˆ d t  j d p) d d ˆ  ˆ � S)NÚscript_argsz-qr/   z-vrC  r   Ú	distclass)ræ   r¡  r8   )r­  r¡  rª  r£  r8   r9   r«  «  s    zmain.<locals>.<lambda>)rÅ   r£  Zsetuptools.distr&   Údistutils.coreræ   r¡  )r¡  rª  r8   )	r&   r­  r¥  r¡  r  r¦  rª  r£  r¨  r9   r2   ‹  s    )prè  ræ   r;   rŽ  rn  rN  r  r@  rÏ  r  r™  rx  r�  rˆ   r6   r   r  r   r   r’  rÅ   r   r   Zsetuptools.sandboxr   Zsetuptools.py31compatr   r	   rÒ  r
   r   r   Zdistutils.errorsr   r   r   r   Údistutils.command.installr   r   Zsetuptools.commandr   Zsetuptools.archive_utilr   Zsetuptools.package_indexr   r   r   r   r  r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r,  r-  r<   r?   r9  r|  Ú__all__r:   r.   rõ   rC   rF   r/   rú   r  r1   r3   rS  r0   r}  rQ  r“  rS  r[  r^  rE  r|  r‚  re  ÚImportErrorrF  Úobjectrl  rw  r}  ru  rŒ  r�  rÀ   r�  r¢  r2   r8   r8   r8   r9   Ú<module>   sš   "(d	ÿ ÿ ÿ ÿ ¯3)/&j
		!..	#