fc@sedZddlmZddlmZddlmZmZddlmZmZm Z m Z ddl m Z m Z ddlmZmZddlmZdd lmZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd l Z dd l!Z!dd l"Z"dd l#Z#dd l$Z$dd l%Z%dd l&m'Z'dd l(m)Z)m*Z*dd l+m,Z,ddl-m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9m:Z:m;Z;ddl4m<Z<m=Z=ddl>m?Z?ddl@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOdd lPZ@ejQdde@jRddddddgZSdZTd ZUe'jVrd!ZWd"ZXnd#ZWd$ZXd%ZYde,fd&YZZd'Z[d(Z\d)Z]d*Z^d+Z_deGfd,YZ`d-e`fd.YZaejbjcd/d0d1kreaZ`nd2Zdd3Zed4Zfd5Zgehd6Zid7Zjd8Zkd9ejlkrekZmn d:Zmd;d<Znd=Zod>Zpd?Zqydd@lmrZsWnetk rzdAZsnXdBZrdCeufdDYZvevjwZxdEevfdFYZydGezfdHYZ{dIe{fdJYZ|dKe|fdLYZ}e{j~Z~e{jZdMZdNZeeedOZdPZdQZehdRZe"jdSZd S(Ts% Easy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ https://setuptools.readthedocs.io/en/latest/easy_install.html i(tglob(t get_platform(t convert_patht subst_vars(tDistutilsArgErrortDistutilsOptionErrortDistutilsErrortDistutilsPlatformError(tINSTALL_SCHEMESt SCHEME_KEYS(tlogtdir_util(t first_line_re(tfind_executableN(tsix(t configparsertmap(tCommand(t run_setup(tget_pathtget_config_vars(t rmtree_safe(tsetopt(tunpack_archive(t PackageIndextparse_requirement_argt URL_SCHEME(t bdist_eggtegg_info(tWheel(t yield_linestnormalize_pathtresource_stringtensure_directorytget_distributiontfind_distributionst Environmentt Requirementt Distributiont PathMetadatat EggMetadatat WorkingSettDistributionNotFoundtVersionConflictt DEVELOP_DISTtdefaulttcategorytsamefilet easy_installtPthDistributionstextract_wininst_cfgtmaintget_exe_prefixescCstjddkS(NtPi(tstructtcalcsize(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytis_64bitIscCstjj|o!tjj|}ttjdo9|}|rUtjj||Stjjtjj|}tjjtjj|}||kS(s Determine if two paths reference the same file. Augments os.path.samefile to work on Windows and suppresses errors if the path doesn't exist. R/(tostpathtexiststhasattrR/tnormpathtnormcase(tp1tp2t both_existt use_samefiletnorm_p1tnorm_p2((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR/Ms$cCs|S(N((ts((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt _to_ascii_scCs1ytj|dtSWntk r,tSXdS(Ntascii(Rt text_typetTruet UnicodeErrortFalse(RE((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytisasciibs  cCs |jdS(NRG(tencode(RE((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRFjscCs.y|jdtSWntk r)tSXdS(NRG(RMRIRJRK(RE((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRLms   cCstj|jjddS(Ns s; (ttextwraptdedenttstriptreplace(ttext((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytutcBsreZdZdZeZdddddddddddddddddddddgZdddd dd-d0d6d9g Ze j rd=e j Z ej d>de fej d>nidd'6ZeZd?Zd@ZdAZedBZdCZdDZdEZdFZdGZdHZdIZdJZdKZej dLj!Z"ej dMj!Z#ej dNj!Z$dOZ%dPZ&dQZ'dRZ(dSZ)dTZ*e+j,dUZ-e.dVZ/e.dWZ0dXZ1edYZ2dZZ3d[Z4d\Z5dd]Z6ed^Z7d_dd`Z8daZ9dbZ:dcZ;ddZ<deZ=dfZ>ej dgj!Z?ej dhZ@didjZAej dkj!ZBdlZCdmZDdnZEdoZFdpZGdqZHdrZIdsZJej dtj!ZKduZLdvZMdwZNeOdxeOdydzd{d|ZPeOdyd}d{d~ZQdZRRS(s'Manage a download/build/install processs Find/get/install Python packagessprefix=sinstallation prefixszip-oktzsinstall package as a zipfiles multi-versiontms%make apps have to require() a versiontupgradetUs1force upgrade (searches PyPI for latest versions)s install-dir=tdsinstall package to DIRs script-dir=REsinstall scripts to DIRsexclude-scriptstxsDon't install scriptss always-copytas'Copy all needed packages to install dirs index-url=tis base URL of Python Package Indexs find-links=tfs(additional URL(s) to search for packagessbuild-directory=tbs/download/extract/build in DIR; keep the resultss optimize=tOslalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]srecord=s3filename in which to record list of installed filess always-unziptZs*don't install as a zipfile, no matter whats site-dirs=tSs)list of directories where .pth files workteditabletes+Install specified packages in editable formsno-depstNsdon't install dependenciess allow-hosts=tHs$pattern(s) that hostnames must matchslocal-snapshots-oktls(allow building eggs from local checkoutstversions"print version information and exits no-find-linkss9Don't load find-links defined in packages being installeds!install in user site-package '%s'tusercCsd|_d|_|_d|_|_|_d|_d|_d|_ d|_ d|_ |_ d|_ |_|_d|_|_|_d|_|_|_d|_d|_d|_d|_d|_d|_d|_d|_d|_tj rtj!|_"tj#|_$nd|_"d|_$d|_%d|_&d|_'|_(d|_)i|_*t+|_,d|_-|j.j/|_/|j.j0||j.j1ddS(NiR0(2RhtNonetzip_oktlocal_snapshots_okt install_dirt script_dirtexclude_scriptst index_urlt find_linkstbuild_directorytargstoptimizetrecordRWt always_copyt multi_versionRbtno_depst allow_hoststroottprefixt no_reportRgtinstall_purelibtinstall_platlibtinstall_headerst install_libtinstall_scriptst install_datat install_basetinstall_platbasetsitetENABLE_USER_SITEt USER_BASEtinstall_userbaset USER_SITEtinstall_usersitet no_find_linkst package_indextpth_filetalways_copy_fromt site_dirstinstalled_projectsRKtsitepy_installedt_dry_runt distributiontverboset_set_command_optionstget_option_dict(tself((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytinitialize_optionssF                         cCs*d|D}tt|j|dS(Ncss9|]/}tjj|s-tjj|r|VqdS(N(R9R:R;tislink(t.0tfilename((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pys s(tlistRt _delete_path(Rtblockerstextant_blockers((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytdelete_blockersscCsetjd||jrdStjj|o?tjj| }|rNtntj}||dS(Ns Deleting %s( R tinfotdry_runR9R:tisdirRtrmtreetunlink(RR:tis_treetremover((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs  %cCs=tjd }td}d}|jtGHtdS(sT Render the Setuptools version and installation details, then exit. it setuptoolss=setuptools {dist.version} from {dist.location} (Python {ver})N(tsysRgR"tformattlocalst SystemExit(tvertdistttmpl((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_render_versions   c Cs|jo|jtjjd}tdd\}}i |jjd6|jjd6|jjd6|d6|dd!d 6|d|d d 6|d 6|d6|d 6|d6t tddd6|_ t j r|j |j d<|j|j dt<|j;|_;d|j;kod knst=nWqt=k rt(d"qXn|j*r|j> rt?d#n|j@st?d$ng|_AdS()NiRzt exec_prefixt dist_namet dist_versiont dist_fullnamet py_versionitpy_version_shortitpy_version_nodott sys_prefixtsys_exec_prefixtabiflagsRTtuserbasetusersiteRlRmRqRRRtinstallRtt,s"%s (in --site-dirs) does not exists$ (in --site-dirs) is not on sys.pathshttps://pypi.python.org/simplet*t search_paththostsRss--optimize must be 0, 1, or 2s9Must specify a build directory (-b) when using --editables:No urls, filenames, or requirements specified (see --help)(RlRl(RlRm(RtRt(RsRs(BRgRRtsplitRRtget_namet get_versiont get_fullnametgetattrt config_varsRRRRt_fix_install_dir_for_user_sitetexpand_basedirst expand_dirst_expandRmRiRlRRKtset_undefined_optionsRhR|RRRR:t get_site_dirst all_site_dirsRR9t expanduserRPRR twarnRtappendRbtcheck_site_dirRot shadow_pathtinsertRxRt create_indexR$t local_indexRpt isinstanceRt string_typesRktscan_egg_linkstadd_find_linksRstintt ValueErrorRqRRrtoutputs( RRRzRR=RERRYt path_itemR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytfinalize_optionss          4    . !        cCs|j stj rdS|j|jdkrFd}t|n|j|_|_t j j ddd}|j |dS(s; Fix the install_dir if "--user" was used. Ns$User base directory is not specifiedtposixtunixt_user( RhRRtcreate_home_pathRRiRRRR9tnameRQt select_scheme(Rtmsgt scheme_name((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRms cCsx|D]y}t||}|dk rtjdksFtjdkr[tjj|}nt||j}t|||qqWdS(NRtnt( RRiR9RR:RRRtsetattr(Rtattrstattrtval((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt _expand_attrs|s  cCs|jdddgdS(sNCalls `os.path.expanduser` on install_base, install_platbase and root.RRRyN(R(R((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRscCs)ddddddg}|j|dS(s+Calls `os.path.expanduser` on install dirs.R|R}RR~RRN(R(Rtdirs((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs cCs|j|jjkr(tj|jnzx%|jD]}|j||j q5W|jr|j}|j rt |j }x/t t |D]}||||||jr dSx*tjj|D]}|j|q#WdS(N(Rnt ScriptWritertbesttget_argst write_script(RRRr((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR)s cCspt|j}t||}|rS|j|t}tj||}n|j|t|ddS(s/Generate a legacy script wrapper and install itR^N( R6RRtis_python_scriptt_load_templateRRat get_headerRdRF(RRR*t script_texttdev_pathRt is_scripttbody((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR's cCs=d}|r!|jdd}ntd|}|jdS(s There are a couple of template scripts in the package. This function loads one of them and prepares it for use. s script.tmpls.tmpls (dev).tmplRsutf-8(RQR tdecode(RiRt raw_bytes((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRf&s ttc Cs|jg|D]}tjj|j|^q tjd||jtjj|j|}|j||jrzdSt }t |tjj |rtj |nt |d|}|j|WdQXt|d|dS(s1Write an executable file to the scripts directorysInstalling %s script to %sNRi(RR9R:RRmR RR/Rt current_umaskR!R;RRRtchmod( RR*R_tmodeRRZttargettmaskR]((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRd5s,    cCs|jjdr(|j||gS|jjdrP|j||gS|jjdrx|j||gS|}tjj|r|jd rt|||j n'tjj |rtjj |}n|j |r|j r|dk r|j|||}ntjj|d}tjj|sttjj|dd}|stdtjj |nt|dkrtd tjj |n|d }n|jrtj|j||gS|j||SdS( Ns.eggs.exes.whls.pyssetup.pyRs"Couldn't find a setup script in %sisMultiple setup scripts in %si(RRCt install_eggt install_exet install_wheelR9R:tisfileRtunpack_progressRtabspatht startswithRqRiR`RR;RRRRbR Rtreport_editabletbuild_and_install(RRR\R7R]t setup_scripttsetups((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyREIs<"  cCs[tjj|r3t|tjj|d}nttj|}tj |d|S(NsEGG-INFOtmetadata( R9R:RR'RR(t zipimportt zipimporterR&t from_filename(Rtegg_pathR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRFus cCs%tjj|jtjj|}tjj|}|jsLt|n|j|}t ||s tjj |rtjj | rt j |d|jn2tjj|r|jtj|fd|nyt}tjj |r*|j|rtjd}}qtjd}}ng|j|rY|j||jd}}n8t}|j|rtjd}}ntjd}}|j|||f|dtjj|tjj|ft|d|Wq tk rt|dtq Xn|j||j|S(NRs Removing tMovingtCopyingt Extractings %s to %stfix_zipimporter_caches(R9R:RRlR!RyRR!RFR/RRR t remove_treeR;RRRKRzRZR[tcopytreeRXtmkpathtunpack_and_compileRItcopy2Rtupdate_dist_cachesRR/(RRR7t destinationRtnew_dist_is_zippedR]RV((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRt}sT   %      cCst|}|dkr+td|ntdd|jddd|jdddt}tjj||j d}||_ |d}tjj|d }tjj|d }t |t |||_ |j||tjj|st|d } | jd xU|jdD]D\} } | d kr*| jd| jddj| fq*q*W| jntjj|d} |jgtj|D]} tjj| | d^qtj||d|jd|j|j||S(Ns(%s is not a valid distutils Windows .exeRDRRRgtplatforms.eggs.tmpsEGG-INFOsPKG-INFORsMetadata-Version: 1.0 ttarget_versions%s: %s t_t-R$iRR(R2RiRR&tgetRR9R:Rtegg_nameR@R!R't _providert exe_to_eggR;RRtitemsRQttitleRRRaRcRt make_zipfileRRRt(RR\R7tcfgRRtegg_tmpt _egg_infotpkg_infR]tktvRmRr((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRus<       0 3c st|ggifd}t||g}xD]}|jjdrV|jd}|d}tj|dd|d=%(version)s") # this version or higher s 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.) t Installedc Csd}|jr\|j r\|d|j7}|jtttjkr\|d|j7}q\n|j }|j }|j }d}|t S(s9Helpful installation message for display to package userss %(what)s %(eggloc)s%(extras)ss RT( RvR{t_easy_install__mv_warningRlRRRR:t_easy_install__id_warningR@RDRgR( RtreqRtwhatRtegglocRRgtextras((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyROCs   sR Extracted editable version of %(spec)s to %(dirname)s If it uses setuptools in its setup script, you can activate it in "development" mode by going to that directory and running:: %(python)s setup.py develop See the setuptools documentation for the "develop" command for more info. cCs-tjj|}tj}d|jtS(Ns (R9R:RRRt_easy_install__editable_msgR(RRR}Rtpython((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR{\s cCstjjdttjjdtt|}|jdkrid|jd}|jdd|n"|jdkr|jddn|jr|jdd nt j d |t |dd j |yt ||Wn-tk r}td |jdfnXdS( Nsdistutils.command.bdist_eggsdistutils.command.egg_infoiRiiRs-qs-ns Running %s %st sSetup script exited with %s(Rtmodulest setdefaultRRRRRRR RRRRRRRr(RR}R]RrR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRas   $c Csddg}tjdddtjj|}z|jtjj||j||j|||t|g}g}x?|D]7}x.||D]"}|j|j |j |qWqW| r|j rt j d|n|SWdt|t j|jXdS(NRs --dist-dirRzs egg-dist-tmp-tdirs+No eggs found in %s (setup script problem?)(R3R4R9R:Rt_set_fetcher_optionsRRR$RtR@RR RRRR( RR}R]Rrtdist_dirtall_eggsteggsR1R((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR|us$    $   c Cs|jjdj}d }i}xF|jD]8\}}||krOq1n|d||jdd egg path translations for a given .exe filesPURELIB/RTsPLATLIB/pywin32_system32sPLATLIB/sSCRIPTS/sEGG-INFO/scripts/sDATA/lib/site-packagesRiisPKG-INFOis .egg-infois EGG-INFO/s.pths -nspkg.pthtPURELIBtPLATLIBs\Rs%s/%s/N(sPURELIB/RT(sPLATLIB/pywin32_system32RT(sPLATLIB/RT(sSCRIPTS/sEGG-INFO/scripts/(sDATA/lib/site-packagesRT(R-R.(RtZipFiletinfolistRRRRCRRtupperRRtPY3RlRRPRQRzRRRtsorttreverse( t exe_filenameRRURRRR_tpthRZty((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR4s>  "#" 3 +  cBs\eZdZeZddZdZdZedZ dZ dZ dZ RS( s)A .pth file with Distribution paths in itcCs||_ttt||_ttjj|j|_|j t j |gddx6t |jD]%}tt|jt|tqoWdS(N(RRRRRR9R:Rtbasedirt_loadR$t__init__RiRRRMR#RI(RRRR:((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR:)s  cCsg|_t}tj|j}tjj|jr3t |jd}x|D]}|j drpt }qOn|j }|jj ||j sO|jj drqOnttjj|j|}|jdcCs7yt||dWnttfk r.tSXtSdS(s%Is this string a valid Python script?texecN(RUt SyntaxErrort TypeErrorRKRI(RRR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt is_pythonqs cCsVy1tj|dd}|jd}WdQXWnttfk rK|SX|dkS(sCDetermine if the specified executable is a .sh (contains a #! line)Rslatin-1iNs#!(RRRRR(Rtfptmagic((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytis_sh{s cCstj|gS(s@Quote a command line argument according to Windows parsing rules(t subprocesst list2cmdline(RZ((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt nt_quote_argscCsb|jds|jdr"tSt||r5tS|jdr^d|jdjkStS(sMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc. s.pys.pyws#!Ri(RCRIRxRzt splitlinesRRK(RhR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRes(RpcGsdS(N((Rr((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_chmodscCsQtjd||yt||Wn&tjk rL}tjd|nXdS(Nschanging mode of %s to %oschmod failed: %s(R RRR9terror(R:RqRc((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRps t CommandSpeccBseZdZgZeZedZedZedZ edZ edZ dZ e dZdZe d Ze d ZRS( sm A command spec for a #! header, specified as a list of arguments akin to those passed to Popen. cCs|S(sV Choose the best CommandSpec class based on environmental conditions. ((RN((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRbscCs(tjjtj}tjjd|S(Nt__PYVENV_LAUNCHER__(R9R:R=RRRR(RNt_default((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_sys_executablescCsOt||r|St|tr,||S|dkrB|jS|j|S(sg Construct a CommandSpec from a parameter to build_scripts, which may be None. N(RRRitfrom_environmentt from_string(RNtparam((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt from_params   cCs||jgS(N(R(RN((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRscCstj||j}||S(s} Construct a command spec from a simple string representing a command line parseable by shlex.split. (tshlexRt split_args(RNtstringR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRscCsMtj|j||_tj|}t|sIdg|jd*ndS(Ns-xi(RRt_extract_optionstoptionsR|R}RL(RRhtcmdline((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytinstall_optionss cCsQ|djd}tj|}|rA|jdpDdnd}|jS(sH Extract any options from the first line of the script. s iiRT(RRVtmatchtgroupRP(t orig_scripttfirstRR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs!cCs|j|t|jS(N(t_renderRR(R((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt as_headerscCsDd}x7|D]/}|j|r |j|r |dd!Sq W|S(Ns"'ii(RzRC(titemt_QUOTEStq((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt _strip_quotess  cCs%tjd|D}d|dS(Ncss$|]}tj|jVqdS(N(RRRP(RR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pys ss#!s (R|R}(RR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs(RRRRRRRORbRRRRRRRRRR(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs   tWindowsCommandSpeccBseZedeZRS(R(RRRRKR(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRsRacBseZdZejdjZeZe d e dZ e d e dZ e d dZedZe dZe dZe dZe d d d ZRS( s` Encapsulates behavior around writing entry point scripts for console and gui apps. s # EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r __requires__ = %(spec)r import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point(%(spec)r, %(group)r, %(name)r)() ) cCsMtjdt|rtntj}|jd||}|j||S(Ns Use get_argsRT(twarningsRtDeprecationWarningtWindowsScriptWriterRaRbtget_script_headerRc(RNRRtwininsttwritertheader((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytget_script_argsscCsNtjdt|rd}n|jjj|}|j||jS(NsUse get_headers python.exe(RRRtcommand_spec_classRbRRR(RNRhRRtcmd((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR!s   c cs|dkr|j}nt|j}xdD]}|d}xn|j|jD]W\}}|j||jt}|j ||||} x| D] } | VqWqZWq4WdS(s Yield write_script() argument tuples for a distribution's console_scripts and gui_scripts entry points. tconsoletguit_scriptsN(RR( RiRgR6RRt get_entry_mapRt_ensure_safe_nameRRt_get_script_args( RNRRRttype_RRtepRhRrR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRc+s   "  cCs+tjd|}|r'tdndS(s? Prevent paths in *_scripts entry point names. s[\\/]s+Path separators not allowed in script namesN(RTtsearchR(Rt has_path_sep((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR=scCs*tjdt|r tjS|jS(NsUse best(RRRRRb(RNt force_windows((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt get_writerFscCs?tjdks-tjdkr7tjdkr7tjS|SdS(sD Select the best ScriptWriter for this environment. twin32tjavaRN(RRR9Rt_nameRRb(RN((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRbLs- ccs|||fVdS(N((RNRRRRh((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRVsRTcCs/|jjj|}|j||jS(s;Create a #! line, getting options (if any) from script_text(RRbRRR(RNRhRR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRg[s N(RRRRNRORRRRRORiRKRRRcRRRRbRRg(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRas     RcBsYeZeZedZedZedZedZe dZ RS(cCstjdt|jS(NsUse best(RRRRb(RN((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRfscCs2tdtd|}tjjdd}||S(sC Select the best ScriptWriter suitable for Windows RtnaturaltSETUPTOOLS_LAUNCHER(RtWindowsExecutableLauncherWriterR9RR(RNt writer_lookuptlauncher((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRbls  c cstdddd|}|tjdjjdkr`djt}tj|t nddd d d dd g}|j ||j ||}g|D]}||^q} ||||d | fVdS(s For Windows, add a .py extensionRs.pyaRs.pywtPATHEXTt;sK{ext} not listed in PATHEXT; scripts will not be recognized as executables.s.pys -script.pys.pycs.pyos.exeRnN( RR9RRRRRRRt UserWarningRNt_adjust_header( RNRRRRhtextRRRZR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRys"  cCsud}d}|dkr(||}}ntjtj|tj}|jd|d|}|j|rq|S|S(s Make sure 'pythonw' is used for gui and and 'python' is used for console (regardless of what sys.executable is). s pythonw.exes python.exeRRtrepl(RTRUtescapet IGNORECASEtsubt _use_header(RNRt orig_headerRSRt pattern_obt new_header((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs cCs/|dd!jd}tjdkp.t|S(s 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. iit"R(RPRRR (Rt clean_header((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs ( RRRRRORRbRRRR(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRcs  RcBseZedZRS(c cs|dkr$d}d}dg}nd}d}dddg}|j||}g|D]} || ^qX} ||||d | fV|d t|d fVts|d } | t|d fVnd S(sG For Windows, add a .py extension and an .exe launcher Rs -script.pyws.pywtclis -script.pys.pys.pycs.pyoRns.exeR^s .exe.manifestN(Rtget_win_launcherR8tload_launcher_manifest( RNRRRRht launcher_typeRRthdrRZRtm_name((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs    (RRROR(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRscCsGd|}tr(|jdd}n|jdd}td|S(s Load the Windows launcher (executable) suitable for launching a script. `type` should be either 'cli' or 'gui' Returns the executable as a byte string. s%s.exet.s-64.s-32.R(R8RQR (ttypet launcher_fn((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs   cCs>tjtd}tjr&|tS|jdtSdS(Nslauncher manifest.xmlsutf-8(RR RRtPY2tvarsRl(Rtmanifest((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs  cCstj|||S(N(RZR(R:t ignore_errorstonerror((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRscCs tjd}tj||S(Ni(R9tumask(ttmp((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRos cCsMddl}tjj|jd}|tjd s"                 d             A ) ) 'l   R          T `A