9acc@sdZddlmZddlmZddlmZmZddlmZmZm 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'm(Z(dd l)m*Z*dd l+m,Z,ddl-m.Z.m/Z/ddl)m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:m;Z;m<Z<ddl5m=Z=m>Z>ddl?m@Z@ddlAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPdd lQZAeRZSejTddeAjUddddddgZVd ZWd!ZXe,jYr(d"ZZd#Z[nd$ZZd%Z[d&Z\de0fd'YZ]d(Z^d)Z_d*Z`d+Zad,ZbdeHfd-YZcd.ecfd/YZdejejfd0d1d2kredZcnd3Zgd4Zhd5Zid6Zjekd7Zld8Zmd9Znd:ejokr0enZpn d;Zpd<d=Zqd>Zrd?Zsd@ZtyddAlmuZvWnewk rdBZvnXdCZudDexfdEYZyeyjzZ{dFeyfdGYZ|dHfdIYZ}dJe}fdKYZ~dLe~fdMYZe}jZe}jZdNZdOZeehdPZdQZdRZekdSZe"jdTZdUe*fdVYZd S(Ws% 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(tget_config_varstget_path(tSetuptoolsDeprecationWarning(tsix(t configparsertmap(tCommand(t run_setup(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/dist-packages/setuptools/command/easy_install.pytis_64bitPscCstjj|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. R0(tostpathtexiststhasattrR0tnormpathtnormcase(tp1tp2t both_existt use_samefiletnorm_p1tnorm_p2((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR0Ts$cCs|S(N((ts((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyt _to_bytesfscCs1ytj|dtSWntk r,tSXdS(Ntascii(Rt text_typetTruet UnicodeErrortFalse(RF((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pytisasciiis  cCs |jdS(Ntutf8(tencode(RF((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRGqscCs.y|jdtSWntk r)tSXdS(NRH(RORJRKRL(RF((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRMts   cCstj|jjddS(Ns s; (ttextwraptdedenttstriptreplace(ttext((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyt|tcBseZdZdZeZdddddddddddddddddddddddgZdddd dd-d0d6d9d=g Ze j rdBe j Z ej dCde fej dCnidd'6ZeZdDZdEZdFZedGZdHZdIZdJZdKZdLZedMZdNZdOZdPZej dQj!Z"ej dRj!Z#ej dSj!Z$dTZ%dUZ&dVZ'dWZ(dXZ)dYZ*e+j,dZZ-e.d[Z/e.d\Z0d]Z1ed^Z2d_Z3d`Z4daZ5ddbZ6edcZ7ddddeZ8dfZ9dgZ:dhZ;diZ<djZ=dkZ>ej dlj!Z?ej dmZ@dndoZAej dpj!ZBdqZCdrZDdsZEdtZFduZGdvZHdwZIdxZJej dyj!ZKdzZLd{ZMd|ZNeOjPd} dksbdeOjQkrkdZRndZReSdeSdddddeSddeRdddeSddeRdddeSddeRddZTeSddddZUdZVRS(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=RFsinstall 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 exitsinstall-layout=s1installation layout to choose (known values: deb)s"force-installation-into-system-dirt0sforce installation into /usrs 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|_-d|_.d|_/d|_0|j1j2|_2|j1j3||j1j4ddS(NiR1(5RktNonetzip_oktlocal_snapshots_okt install_dirt script_dirtexclude_scriptst index_urlt find_linkstbuild_directorytargstoptimizetrecordRYt always_copyt multi_versionRdtno_depst allow_hoststroottprefixt no_reportRitinstall_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_projectsRLtsitepy_installedtinstall_layoutt"force_installation_into_system_dirt multiarcht_dry_runt distributiontverboset_set_command_optionstget_option_dict(tself((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pytinitialize_optionssL                            cCs*d|D}tt|j|dS(Ncss9|]/}tjj|s-tjj|r|VqdS(N(R:R;R<tislink(t.0tfilename((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pys s(tlistRt _delete_path(Rtblockerstextant_blockers((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pytdelete_blockersscCsetjd||jrdStjj|o?tjj| }|rNtntj}||dS(Ns Deleting %s( R tinfotdry_runR:R;tisdirRtrmtreetunlink(RR;tis_treetremover((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs  %cCsBdjtj}td}d}|jtGHtdS(sT Render the Setuptools version and installation details, then exit. s{}.{}t setuptoolss=setuptools {dist.version} from {dist.location} (Python {ver})N(tformattsyst version_infoR#tlocalst SystemExit(tvertdistttmpl((sC/usr/lib/python2.7/dist-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 dj?r|j<j|_<qn g|_<|j@r|j8jA|j5tj'n|js|j8jB|j<n|jdd0t=|jCtDsVy>tD|jC|_Cd|jCko$d kns2tEnWqVtEk rRtd(qVXn|j2rx|jF rxtGd)n|jHstGd*ng|_IdS(1NiR}t exec_prefixt dist_namet dist_versiont dist_fullnamet py_versionitpy_version_shortitpy_version_nodott sys_prefixtsys_exec_prefixtabiflagsRVtuserbasetusersitetdebs"unknown value for --install-layoutit MULTIARCHRoRpRtRRRs/usrsinstallation 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. tinstallRwt,s"%s (in --site-dirs) does not exists$ (in --site-dirs) is not on sys.pathshttps://pypi.org/simple/t*t search_paththostsRvs--optimize must be 0, 1, or 2s9Must specify a build directory (-b) when using --editables:No urls, filenames, or requirements specified (see --help)(R(ii(RoRo(RoRp(RwRw(RvRv(JRiRRtsplitRRtget_namet get_versiont get_fullnametgetattrt config_varsRRRRt_fix_install_dir_for_user_sitetexpand_basedirst expand_dirsRtlowerRt sysconfigRtget_config_varRt_expandRpRlRoRRLtset_undefined_optionsRkRRR}RRR R;t get_site_dirst all_site_dirsRR:t expanduserRRRR twarntappendRdtcheck_site_dirRrt shadow_pathtinsertR{Rt create_indexR%t local_indexRst isinstanceRt string_typesRntscan_egg_linkstadd_find_linksRvtintt ValueErrorRtRRutoutputs( RRR}RRR>RFRR[t path_itemR((sC/usr/lib/python2.7/dist-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( RkRRtcreate_home_pathRRlRRRR:tnameRSt select_scheme(Rtmsgt scheme_name((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs cCsx|D]y}t||}|dk rtjdksFtjdkr[tjj|}nt||j}t|||qqWdS(NRtnt( RRlR:RR;RRRtsetattr(Rtattrstattrtval((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyt _expand_attrss  cCs|jdddgdS(sNCalls `os.path.expanduser` on install_base, install_platbase and root.RRR|N(R(R((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRscCs)ddddddg}|j|dS(s+Calls `os.path.expanduser` on install dirs.RRRRRRN(R(Rtdirs((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs cCs6|r|jdtjn|j|jjkrDtj|jnzx%|jD]}|j||j qQW|j rt t |j }|j rt|j }x/tt|D]}||||||jr dSx*tjj|D]}|j|q#WdS(N(Rqt ScriptWritertbesttget_argst write_script(RRRu((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR8<s cCspt|j}t||}|rS|j|t}tj||}n|j|t|ddS(s/Generate a legacy script wrapper and install itR`N( RDR`tis_python_scriptt_load_templateRRot get_headerRrRG(RRR9t script_texttdev_pathRt is_scripttbody((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR6Bs 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(RSR!tdecode(RwRt raw_bytes((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRtLs 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(RR:R;RRpR RR>Rt current_umaskR"R<RRR+tchmod( RR9RmtmodeRR\ttargettmaskR_((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRr[s,    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(RRQt install_eggt install_exet install_wheelR:R;tisfileRtunpack_progressRtabspatht startswithRtRlRnRR<RRRRdR Rtreport_editabletbuild_and_install(RRRjRERkt setup_scripttsetups((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRSos<"  cCs[tjj|r3t|tjj|d}nttj|}tj |d|S(NsEGG-INFOtmetadata( R:R;RR(RR)t zipimportt zipimporterR't from_filename(Rtegg_pathR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRTs 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(R:R;RRoR0RRR"RTR0RRR t remove_treeR<RRRLRRhRitcopytreeRftmkpathtunpack_and_compileRJtcopy2R'tupdate_dist_cachesR R>(RRREt destinationRtnew_dist_is_zippedR_RX((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRsT   %      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 .exeRRRRRitplatforms.eggs.tmpsEGG-INFOsPKG-INFORsMetadata-Version: 1.0 ttarget_versions%s: %s t_t-R3iRR(R3RlRR'tgetRR:R;Rtegg_nameRNR"R(t _providert exe_to_eggR<RR+titemsRSttitleRRRoRqRt make_zipfileRRR(RRjREtcfgRRtegg_tmpt _egg_infotpkg_infR_tktvRpRu((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs<       0 3c st|ggifd}t||g}xD]}|jjdrV|jd}|d}tj|dd|dRT(Rt wheel_pathREtwheelR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR;s.   % s( 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 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 RV( RyR~t_easy_install__mv_warningRoRR RR;t_easy_install__id_warningRNRRRiR( RtreqRtwhatRtegglocRRitextras((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR]is   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 (R:R;R'RR,t_easy_install__editable_msgR(RRRR'tpython((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs 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 RRRRRRRu(RRRkRuR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs   $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-dirR}s egg-dist-tmp-tdirs+No eggs found in %s (setup script problem?)(RBRCR:R;R't_set_fetcher_optionsRRR%RRNRR RRRR( RRRkRutdist_dirtall_eggsteggsR@R((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs$    $   c Cs|jjdj}d }i}xF|jD]8\}}||krOq1n|d||jdd R?RAt contextlibtcontextmanagerRFRLR1RJRRMRfRnR8R6RtRrRSRTRRRRRRR]RRRRRRZRRRRRRHRRRiRt sitedir_nameRRRR(((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR1s     5       *  ;     $ $ '    ,  6 - 5          %     "         cCs.tjjddjtj}td|S(NRRV(R:RRRtpathseptfilterRl(R((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs!cCsJg}|jttjg}tjtjkrG|jtjnx[|D]S}|rNtjdkr|jtjj |ddntj dkr|jtjj |ddtj d d tjj |d d j tj d tjj |d d gn%|j|tjj |d dgtjd krd|krtjjd}|rtjj |dddj tj d}|j|qqqqNqNWtdtdf}x*|D]"}||kr|j|qqWtjr|jtjny|jtjWntk r0nXttt|}|S(s& Return a list of 'site' dirs tos2emxtriscostLibs site-packagesRs local/libRis dist-packagestlibs python{}.{}s site-pythontdarwinsPython.frameworktHOMEtLibrarytPythons{}.{}tpurelibtplatlib(RR(textendRRR}RRRR:R;RtsepRiRRRRRRRRtgetsitepackagestAttributeErrorRRR (tsitedirsRR}Rthome_spt lib_pathstsite_lib((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs`  "         ccs^i}xQ|D]I}t|}||kr1q nd||egg path translations for a given .exe filesPURELIB/RVsPLATLIB/pywin32_system32sPLATLIB/sSCRIPTS/sEGG-INFO/scripts/sDATA/lib/site-packagesRiisPKG-INFOis .egg-infois EGG-INFO/s.pths -nspkg.pthtPURELIBtPLATLIBs\R&s%s/%s/N(sPURELIB/RV(sPLATLIB/pywin32_system32RV(sPLATLIB/RV(sSCRIPTS/sEGG-INFO/scripts/(sDATA/lib/site-packagesRV(RARB(R/tZipFiletinfolistRRRRQRRtupperRRtPY3RzRRRRSRRRRtsorttreverse( t exe_filenameRRWRRRRmtpthR\ty((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR5@s>  "#" 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(RRRR R"R:R;R'tbasedirt_loadR%t__init__RlRRR[R$RJ(RRR"R;((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRNls  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(Rit SyntaxErrort TypeErrorRLRJ(RTR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyt is_pythons cCsVy1tj|dd}|jd}WdQXWnttfk rK|SX|dkS(sCDetermine if the specified executable is a .sh (contains a #! line)Rslatin-1iNs#!(RRRRR(R,tfptmagic((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pytis_shs cCstj|gS(s@Quote a command line argument according to Windows parsing rules(t subprocesst list2cmdline(Rn((sC/usr/lib/python2.7/dist-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(RQRJRRt splitlinesRRL(RvR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRss(R~cGsdS(N((Ru((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyt_chmodscCsQtjd||yt||Wn&tjk rL}tjd|nXdS(Nschanging mode of %s to %oschmod failed: %s(R RRR:terror(R;RRe((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR~s 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. ((Rb((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRpscCs(tjjtj}tjjd|S(Nt__PYVENV_LAUNCHER__(R:R;R>RR,RR(Rbt_default((sC/usr/lib/python2.7/dist-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(RRRltfrom_environmentt from_string(Rbtparam((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyt from_params   cCs||jgS(N(R(Rb((sC/usr/lib/python2.7/dist-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(RbtstringR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRscCsMtj|j||_tj|}t|sIdg|jd*ndS(Ns-xi(RRt_extract_optionstoptionsRRRM(RRvtcmdline((sC/usr/lib/python2.7/dist-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 iiRV(RRjtmatchtgroupRR(t orig_scripttfirstRR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR"s!cCs|j|t|jS(N(t_renderRR(R((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyt as_header,scCsDd}x7|D]/}|j|r |j|r |dd!Sq W|S(Ns"'ii(RRQ(titemt_QUOTEStq((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyt _strip_quotes/s  cCs%tjd|D}d|dS(Ncss$|]}tj|jVqdS(N(RRRR(RR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pys :ss#!s (RR(RR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR7s(RRRRRRRcRpRRRRRR RRRR(((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs   tWindowsCommandSpeccBseZedeZRS(R(RRRRLR(((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRBsRocBseZdZejdjZeZe 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_argsRV(twarningsRtEasyInstallDeprecationWarningtWindowsScriptWriterRoRptget_script_headerRq(RbRR,twininsttwritertheader((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pytget_script_args\scCs5tjdtdd|r%d}n|j||S(NsUse get_headert stacklevelis python.exe(RRRRu(RbRvR,R((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRds 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( RlRuRDR`t get_entry_mapRt_ensure_safe_nameRRt_get_script_args( RbRRRttype_RRtepRvRuR((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRqls   "  cCs+tjd|}|r'tdndS(s? Prevent paths in *_scripts entry point names. s[\\/]s+Path separators not allowed in script namesN(RhtsearchR(Rt has_path_sep((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR~scCs*tjdt|r tjS|jS(NsUse best(RRRRRp(Rbt force_windows((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyt get_writerscCs?tjdks-tjdkr7tjdkr7tjS|SdS(sD Select the best ScriptWriter for this environment. twin32tjavaRN(RRR:Rt_nameRRp(Rb((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRps- ccs|||fVdS(N((RbRRRRv((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRsRVcCs/|jjj|}|j||jS(s;Create a #! line, getting options (if any) from script_text(tcommand_spec_classRpRRR(RbRvR,tcmd((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRus N(RRRRPRQRRRRRcRlRLRRRqR RRRpRRu(((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRoFs    RcBsYeZeZedZedZedZedZe dZ RS(cCstjdt|jS(NsUse best(RRRRp(Rb((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRscCs2tdtd|}tjjdd}||S(sC Select the best ScriptWriter suitable for Windows R,tnaturaltSETUPTOOLS_LAUNCHER(RtWindowsExecutableLauncherWriterR:RR(Rbt writer_lookuptlauncher((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRps  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.exeR|N( RR:RRRRRRRt UserWarningR\t_adjust_header( RbRRRRvtextRRR\R((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs"  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(RhRitescapet IGNORECASEtsubt _use_header(RbRt orig_headerRgRt pattern_obt new_header((sC/usr/lib/python2.7/dist-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(RRRRR (Rt clean_header((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs ( RRRRRcRRpRRR R(((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs  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.pyoR|s.exeR`s .exe.manifestN(Rtget_win_launcherR9tload_launcher_manifest( RbRRRRvt launcher_typeRRthdrR\Rtm_name((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyRs    (RRRcR(((sC/usr/lib/python2.7/dist-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(R9RSR!(ttypet launcher_fn((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR s   cCs>tjtd}tjr&|tS|jdtSdS(Nslauncher manifest.xmlsutf-8(R(R!RRtPY2tvarsRz(Rtmanifest((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR s  cCstj|||S(N(RhR(R;t ignore_errorstonerror((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR! scCs tjd}tj||S(Ni(R:tumask(ttmp((sC/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.pyR}% s cCsMddl}tjj|jd}|tjd s"                 d           (  G ) ) 'l   R          T ^A