gc@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl Z ddl mZmZddlmZddlmZmZy,ddlmZmZdZd ZWn9ek r=dd lmZmZd Zd ZnXdd lmZddlmZm Z ddl!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl-m/Z/ddl)m0Z0m1Z1ddl2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8ddl m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGdejHkrejHdZInejJjKejLZIddddddgZMddlNZNejOdk oeNjPZQddlRZRd ZSd!ZTejUd"fkr:d#ZVd$ZWnd%ZVd&ZWdefd'YZXd(ZYd)ZZd*Z[d+Z\d,Z]de?fd-YZ^eIe_d.Z`d/Zad0Zbd1Zcd2d3Zdd4Zed5Zfd6Zgydd7lmhZiWnek r&d8ZinXd9Zhd:ZjeIe_d;Zkd<Zld=Zme_ead>Znd?Zod@ZpeqdAZrdS(BsEasy 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 iN(tglob(tCommandt_dont_write_bytecode(t run_setup(tlogtdir_util(tget_config_varstget_pathcCs tdS(Ntplatlib(R(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt _get_platlibscCs tdS(Ntpurelib(R(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt _get_purelib!s(Rtget_python_libcCs ttS(N(R tTrue(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR %scCs ttS(N(R tFalse(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR 's(t get_platform(t convert_patht subst_vars(tDistutilsArgErrortDistutilsOptionErrortDistutilsErrortDistutilsPlatformError(tINSTALL_SCHEMESt SCHEME_KEYS(tsetopt(tunpack_archive(t PackageIndex(t URL_SCHEME(t bdist_eggtegg_info(t iteritemstmaxsizetxranget basestringtunicodetreraise(t yield_linestnormalize_pathtresource_stringtensure_directorytget_distributiontfind_distributionst Environmentt Requirementt Distributiont PathMetadatat EggMetadatat WorkingSettDistributionNotFoundtVersionConflictt DEVELOP_DISTt__VENV_LAUNCHER__tsamefilet easy_installtPthDistributionstextract_wininst_cfgtmaintget_exe_prefixess2.6cCstjddkS(NtPi(tstructtcalcsize(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytis_64bitKscCsttjdrItjj|rItjj|rItjj||Stjjtjj|tjjtjj|kS(NR4(thasattrtostpathtexistsR4tnormpathtnormcase(tp1tp2((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR4Ns $icCs|S(N((ts((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt _to_asciiYscCs.yt|dtSWntk r)tSXdS(Ntascii(R"R t UnicodeErrorR(RF((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytisascii[s   cCs |jdS(NRH(tencode(RF((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRGbscCs.y|jdtSWntk r)tSXdS(NRH(RKR RIR(RF((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRJds   cBseZdZdZeZdzd{d|d}d~ddddddddddddddddddgZdddd ddd"d1d4d:d=g Ze rej dAdydBe j fej dAnidd+6Z eZdCZdDZdEZdFZdGZdHZdIZdJZdKZdLZdMZdNZdOZdPZdQZdRZe dSZ!e dTZ"dUZ#edVZ$dWZ%dXZ&dYZ'dydZZ(d[dd\Z)d]Z*d^Z+d_Z,d`Z-daZ.dbZ/dcZ0dddeZ1dfZ2dgZ3dhZ4diZ5djZ6dkZ7dlZ8dmZ9dnZ:doZ;dpZ<e=dqe=drdsdtduZ>e=drdvdtdwZ?dxZ@RS(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 packagessdelete-conflictingtDs no longer needed; don't use thissignore-conflicts-at-my-risksbuild-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 installedtusers!install in user site-package '%s'cCstr0tjjt}|jtj|_n d|_d|_ |_ d|_ |_ |_d|_d|_d|_d|_d|_|_d|_|_|_d|_|_|_d|_|_|_d|_d|_d|_ d|_!d|_"d|_#d|_$d|_%d|_&trKtj'|_(tj|_)nd|_(d|_)d|_*d|_+d|_,|_-d|_.d|_/d|_0i|_1t2|_3d|_4|j5j6|_6|j5j7||j5j8ddS(NiR5(9t HAS_USER_SITER?R@tabspatht__file__t startswithtsitet USER_SITER`tNonetzip_oktlocal_snapshots_okt install_dirt script_dirtexclude_scriptst index_urlt find_linkstbuild_directorytargstoptimizetrecordRNt always_copyt multi_versionRZtno_depst allow_hoststroottprefixt no_reportR_tinstall_purelibtinstall_platlibtinstall_headerst install_libtinstall_scriptst install_datat install_basetinstall_platbaset USER_BASEtinstall_userbasetinstall_usersitet no_find_linkst package_indextpth_filetalways_copy_fromtdelete_conflictingtignore_conflicts_at_my_riskt site_dirstinstalled_projectsRtsitepy_installedt_dry_runt distributiontverboset_set_command_optionstget_option_dict(tselftwhereami((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytinitialize_optionssP                          cCsx|D]}tjj|s1tjj|rtjd||jstjj|r|tjj| r|t|qtj |qqqWdS(Ns Deleting %s( R?R@RAtislinkRtinfotdry_runtisdirtrmtreetunlink(Rtblockerstfilename((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytdelete_blockerss $ % c Cs|jr(dtdjGHtjntjjd}tdd\}}i |jjd6|jjd6|jj d6|d 6|dd !d 6|d|d d 6|d6|d6|d6|d6t tddd6|_ t r |j |j d<|j|j d|j9n|jdd/t:|j?t@s=y>t@|j?|_?d|j?ko d knstAnWq=tAk r9t-d(q=Xn|jBr^|jCr^t-d)n|j/r|jD rtEd*n|jFstEd+ng|_GdS(0Ns setuptools %st setuptoolsiRxt exec_prefixt dist_namet dist_versiont dist_fullnamet py_versionitpy_version_shortitpy_version_nodott sys_prefixtsys_exec_prefixtabiflagsttuserbasetusersites$User base directory is not specifiedtposixt unix_usert_userRjRkRoRR}R~tinstallRrt,s"%s (in --site-dirs) does not exists$ (in --site-dirs) is not on sys.pathshttps://pypi.python.org/simplet*t search_paththostsRqs--optimize must be 0, 1, or 2sVCan't use both --delete-conflicting and --ignore-conflicts-at-my-risk at the same times9Must specify a build directory (-b) when using --editables:No urls, filenames, or requirements specified (see --help)(s install_dirs install_dir(s install_dirs script_dir(srecordsrecord(soptimizesoptimize(HR_R(tsystexittsplitRRtget_namet get_versiont get_fullnametgetattrt config_varsRaRRR`tcreate_home_pathRgRRRR?tnamet select_schemetexpand_basedirst expand_dirst_expandRkRjRRtset_undefined_optionsRzR~tmapR%R@t get_site_dirst all_site_dirsRt expandusertstripRRtwarnRtappendRZtcheck_site_dirRmt shadow_pathtinsertRvRt create_indexR*t local_indexRnt isinstanceR!Ritscan_egg_linkstadd_find_linksRqtintt ValueErrorRRRoRRptoutputs( RRRxRRBRFRRPt path_itemR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytfinalize_optionss           7   . !         cCsx|D]y}t||}|dk rtjdksFtjdkr[tjj|}nt||j}t|||qqWdS(NRtnt( RRgR?RR@RRRtsetattr(Rtattrstattrtval((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt _expand_attrscs  cCs|jdddgdS(sNCalls `os.path.expanduser` on install_base, install_platbase and root.RRRwN(R(R((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRlscCs#|jddddddgdS(s+Calls `os.path.expanduser` on install dirs.RzR{R}R|R~RN(R(R((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRqs cCs|j|jjkr(tj|jnzx%|jD]}|j||j q5W|jr|j}|j rt |j }x/t t |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.) R( RtRyRjRR%RR@R)R-R_RW( RtreqRtwhatRtegglocRR_R=((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR8"s     cCs&tjj|}tj}dtS(Ns" 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@RRRRW(RRRgRtpython((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRe>s cCs$tjjdttjjdtt|}|jdkrid|jd}|jdd|n"|jdkr|jddn|jr|jdd nt j d |t |dd j |yt ||Wn;tk rtjd}td |jdfnXdS( Nsdistutils.command.bdist_eggsdistutils.command.egg_infoiRiiR{s-qs-ns Running %s %st sSetup script exited with %s(Rtmodulest setdefaultRRtlistRRRRRRRRt SystemExitRRRp(RRgRGRpR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRKs"  $ 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-dirRxs egg-dist-tmp-tdirs+No eggs found in %s (setup script problem?)(R R!R?R@Rt_set_fetcher_optionsRRR*RaR)RRRRRR( RRgRGRptdist_dirtall_eggsteggsRR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRf`s$    $   c Cs|jjdj}d }i}xF|jD]8\}}||krOq1n|d||jdd |jd|d|fdfq>q>Wq4q4WWd|jXg|D]\}} |j| f^q}|j|j|S(s4Get exe->egg path translations for a given .exe filesPURELIB/RsPLATLIB/pywin32_system32sPLATLIB/sSCRIPTS/sEGG-INFO/scripts/sDATA/lib/site-packagesRiisPKG-INFOis .egg-infois EGG-INFO/s.pths -nspkg.pthtPURELIBtPLATLIBs\Rs%s/%s/N(sPURELIB/R(sPLATLIB/pywin32_system32R(sPLATLIB/R(sSCRIPTS/sEGG-INFO/scripts/(sDATA/lib/site-packagesR(R R (i(RtZipFiletinfolistRRRR,RRtupperRRRRMR$RRNRdRRRtsorttreverse( t exe_filenameRRLRRRRItpthRQty((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR9s<  "#"3 + cCs<ytj|SWn$tk r7td|fnXdS(Ns1Not a URL, existing file, or requirement spec: %r(R+tparseRR(R((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR% s  cBsMeZdZeZddZdZdZdZdZ dZ RS(s)A .pth file with Distribution paths in itcCs||_ttt||_ttjj|j|_|j t j |gddx6t |jD]%}tt|jt|tqoWdS(N(RRRR%RR?R@Rtbasedirt_loadR*t__init__RgR$RR7R)R (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(R)t SyntaxErrort TypeErrorRR (ttextR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt is_pythons cCsNy)t|}|jd}|jWnttfk rC|SX|dkS(sCDetermine if the specified executable is a .sh (contains a #! line)is#!(RRRRR(Rtfptmagic((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytis_shs cCsg}t}d}d|kp'd|k}|r@|jdnx|D]z}|dkrf|d7}qG|dkr|jd|ddd}qG|r|jd|d}n|j|qGW|r|jd|n|r|jd||jdnd j|S( s@Quote a command line argument according to Windows parsing rulesiRs t"s\iis\"R(RRR(R5tresultt needquotetnbtc((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR-s,      cCsb|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(R,R RDRdR*RR(RXR((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRUs(R]cGsdS(N((Rp((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt_chmodscCs_tjd||yt||Wn4tjk rZtjd}tjd|nXdS(Nschanging mode of %s to %oischmod failed: %s(RRRMR?terrorRR(R@R^R[((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR]s cCsntjjdrjt|rjddl}|jjjddkrI|S|r_tj dqjd|Sn|S(Ntjavaisos.nametLinuxsWARNING: Unable to adapt shebang line for Jython, the following script is NOT executable see http://bugs.jython.org/issue1112 for more information.s/usr/bin/env %s( RRxRdRGROtlangtSystemt getPropertyRR(RR1RO((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR.s  c cst|j}td||}xdD]{}xr|j|jD][\}}dt}tjdksu|r|dkrd} d} dg} tj d d |} n0d } d } d ddg} tj dd|} t j j | dd!j dstjdkr| } n|} || | |dg| D]}||^q6fV|dt| dfVts|d}|t|dfVqqG|||fVqGWq+WdS(sEYield write_script() argument tuples for a distribution's entrypointsRtconsole_scriptst gui_scriptss# 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)() ) twin32tguis -script.pyws.pyws(?i)python.exes pythonw.exetclis -script.pys.pys.pycs.pyos(?i)pythonw.exes python.exeiiRHR[s.exeRVs .exe.manifestN(RTRU(RTR;RVt get_entry_mapRRWRRxR(tsubR?R@RARtget_win_launcherR=tload_launcher_manifest(RRR/RtheaderR,RtepRXt launcher_typeRRt new_headerR2RQtm_name((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRK0s4 "   1 0  cCstd|}tjjdkr7|jdd}ntrU|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.exetarmt.s-arm.s-64.s-32.R(RxtmachineRRNR=R&(ttypet launcher_fn((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR[ds  cCsHtjtd}tjddkr0|tS|jdtSdS(Nslauncher manifest.xmliisutf-8(t pkg_resourcesR&RRRtvarsRM(Rtmanifest((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR\us cCst|rd}n|dkr*d}ng}ytj|}Wn-tjk rr|tj|tjnXx|D]}tjj||}ytj|j }Wntjk rd}nXt j |rt |||qzytj |Wqztjk r*|tj |tjqzXqzWytj|Wn-tjk ro|tj|tjnXdS(sRecursively 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. cWsdS(N((Rp((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pytonerrorscWsdS(N((Rp((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRjsiN(RgR?RCRNRRR@Rtlstattst_modeRtS_ISDIRRRtrmdir(R@t ignore_errorsRjRRtfullnameR^((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR|s2     !cCs tjd}tj||S(Ni(R?tumask(ttmp((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR\s cCsMddl}tjj|jd}|tjds((RRpR(R,R}(RpRRsC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs(RRt common_usageR((R,R}(sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR~sic s6ddddgdtjdp)ddS(Nt script_argss-qR5s-vRit distclass(RRt((R~RtRRw(sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyRs(RRwtsetuptools.distR,tdistutils.coreRgRRt(RtR(( R,R~RyRtRRzRRwR}sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyR8s  (sRRR?RjRDR RR(RRRxRRgRRRtsetuptools.sandboxRRRRt sysconfigRRR R Rtdistutils.sysconfigR RRRRtdistutils.errorsRRRRtdistutils.command.installRRtsetuptools.commandRtsetuptools.archive_utilRtsetuptools.package_indexRRRRRRRR R!R"R#R$R%R&R'R(R)R*R+R,R-R.R/R0R1R2Rtsys_executableR@RBRt__all__ReR_tENABLE_USER_SITERaR;R=R4RRGRJR5RRR7R9R%R6RRVR9RrR;RDRGR-RUR]RMR.RKR[R\RR\RvRgR8(((sC/usr/lib/python2.7/site-packages/setuptools/command/easy_install.pyt s                ".d           - ) 6 % h   )     4  #