fc@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZddlZejjdrddljjjjZnejejZy eZWnek r dZnXeZddl m!Z!ddlm"Z"ddd d gZ#dd Z$ej%dd Z&ej%d Z'ej%dZ(ej%dZ)de*fdYZ+dd!dYZ,ej%dZ-dZ.ej%dZ/ej%dZ0dZ1dZ2dZ3dd"dYZ4e5edrNej6gZ7ngZ7de4fdYZ8ej9ej:gdj;D]Z<e=ee<d^qZ>d e!fd YZ?dS(#iN(tsix(tbuiltinstmaptjava(tDistutilsError(t working_settAbstractSandboxtDirectorySandboxtSandboxViolationt run_setupcBs_d}e||}|j}WdQX|dkr?|}ne||d}|||UdS(s. Python 3 implementation of execfile. trbNtexec(topentreadtNonetcompile(tfilenametglobalstlocalstmodetstreamtscripttcode((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt _execfile#s  ccs>tj}|dk r#|tj(nz |VWd|tj(XdS(N(tsystargvR(trepltsaved((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt save_argv0s     ccs%tj}z |VWd|tj(XdS(N(Rtpath(R((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt save_path;s  ccsBtjj|dttj}|t_z dVWd|t_XdS(sL Monkey-patch tempfile.tempdir with replacement, ensuring it exists texist_okN(t pkg_resourcest py31compattmakedirstTruettempfilettempdir(t replacementR((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt override_tempDs    ccs7tj}tj|z |VWdtj|XdS(N(tostgetcwdtchdir(ttargetR((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pytpushdUs    tUnpickleableExceptioncBseZdZedZRS(sP An exception representing another Exception that could not be pickled. cCsay tj|tj|fSWn:tk r\ddlm}|j||t|SXdS(s Always return a dumped (pickled) type and exc. If exc can't be pickled, wrap it in UnpickleableException first. i(R-N(tpickletdumpst Exceptiontsetuptools.sandboxR-tdumptrepr(ttypetexctcls((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR2ds   (t__name__t __module__t__doc__t staticmethodR2(((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR-_stExceptionSavercBs)eZdZdZdZdZRS(s^ A Context Manager that will save an exception, serialized, and restore it later. cCs|S(N((tself((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt __enter__xscCs,|s dStj|||_||_tS(N(R-R2t_savedt_tbR#(R<R4R5ttb((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt__exit__{s  cCsKdt|krdSttj|j\}}tj|||jdS(s"restore and re-raise any exceptionR>N(tvarsRR.tloadsR>RtreraiseR?(R<R4R5((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pytresumes(R7R8R9R=RARE(((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR;rs  c#sgtjjt }VWdQXtjjfdtjD}t||jdS(s Context in which imported modules are saved. Translates exceptions internal to the context into the equivalent exception outside the context. Nc3s1|]'}|kr|jd r|VqdS(s encodings.N(t startswith(t.0tmod_name(R(s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pys s (RtmodulestcopyR;tupdatet_clear_modulesRE(t saved_exct del_modules((Rs6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt save_moduless   cCs%xt|D]}tj|=q WdS(N(tlistRRI(t module_namesRH((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRLsccs*tj}z |VWdtj|XdS(N(R t __getstate__t __setstate__(R((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pytsave_pkg_resources_states  ccstjj|d}tqtattJt:t|'t |t ddVWdQXWdQXWdQXWdQXWdQXWdQXdS(Nttempt setuptools( R(RtjoinRTROthide_setuptoolsRRR'R,t __import__(t setup_dirttemp_dir((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt setup_contexts       cCs"tjd}t|j|S(sH >>> _needs_hiding('setuptools') True >>> _needs_hiding('pkg_resources') True >>> _needs_hiding('setuptools_plugin') False >>> _needs_hiding('setuptools.__init__') True >>> _needs_hiding('distutils') True >>> _needs_hiding('os') False >>> _needs_hiding('Cython') True s1(setuptools|pkg_resources|distutils|Cython)(\.|$)(treRtbooltmatch(RHtpattern((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt _needs_hidingscCs tttj}t|dS(s% Remove references to setuptools' modules from sys.modules to allow the invocation to import the most appropriate setuptools. This technique is necessary to avoid issues such as #315 where setuptools upgrading itself would fail to find a function declared in the metadata. N(tfilterRaRRIRL(RI((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRXsc Cstjjtjj|}t|y|gt|tj(tjjd|t j t j j dt |tr|n|jtj}t|'td|dd}t||WdQXWn/tk r}|jr|jdrqnXWdQXdS(s8Run a distutils setup script, sandboxed in its directoryicSs |jS(N(tactivate(tdist((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyttt__file__R7t__main__N(R(RtabspathtdirnameR\RPRRtinsertRt__init__t callbackstappendt isinstancetstrtencodetgetfilesystemencodingRtdictRt SystemExittargs(t setup_scriptRuRZt dunder_filetnstv((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR s   cBseZdZeZdZdZdZdZdZ dZ x<ddd gD]+Z e e e rXe e ee sc3s!|]}tj|VqdS(N(R]R_(RGR`(R(s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pys s(Rt_exception_patternst itertoolstchaintany(R<Rt start_matchestpattern_matchest candidates((Rs6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRs     cOsH||jkrD|j| rD|j|tjj|||n|S(sCalled for path inputs(t write_opsRRR(RR(R<RRRuR((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRs%cOsF|j| s |j| r<|j|||||n||fS(s?Called for path pairs like rename, link, and symlink operations(RR(R<RRRRuR((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRs icOsR|t@r9|j| r9|jd|||||ntj|||||S(sCalled for low-level os.open()sos.open(t WRITE_FLAGSRRR|R (R<RtflagsRRuR((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR s(R7R8R9RstfromkeysRRt _EXCEPTIONSRlRRRRRRRRR (((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR~s       s4O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYicBs,eZdZejdjZdZRS(sEA setup script attempted to modify the filesystem outside the sandboxs SandboxViolation: {cmd}{args!r} {kwargs} The package setup script has attempted to modify files on your system that are not within the EasyInstall build area, and has been aborted. This package cannot be safely installed by EasyInstall, and may not support alternate installation locations even if you run its setup script by hand. Please inform the package's author and the EasyInstall maintainers to find out if a fix or workaround is available. cCs%|j\}}}|jjtS(N(RuttmpltformatR(R<tcmdRutkwargs((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt__str__s(R7R8R9ttextwraptdedenttlstripRR(((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRs (((@R(RR$toperatort functoolsRR]t contextlibR.Rtsetuptools.externRtsetuptools.extern.six.movesRRtpkg_resources.py31compatR tplatformRFt$org.python.modules.posix.PosixModuletpythonRItposixt PosixModuleR|RRRt NameErrorRR Rtdistutils.errorsRRt__all__RtcontextmanagerRRR'R,R0R-R;RORLRTR\RaRXR RR}RRRtreducetor_tsplittaRRR(((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyts^                      wV +