Hacked By AnonymousFox

Current Path : /lib/python2.7/site-packages/setuptools/
Upload File :
Current File : //lib/python2.7/site-packages/setuptools/sandbox.pyc

�
�fc@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZddlZejjd�r�ddljjjjZnejejZy
eZWnek
r
dZnXeZddl m!Z!ddlm"Z"ddd	d
gZ#dd�Z$ej%dd��Z&ej%d
��Z'ej%d��Z(ej%d��Z)de*fd��YZ+dd!d��YZ,ej%d��Z-d�Z.ej%d��Z/ej%d��Z0d�Z1d�Z2d�Z3dd"d��YZ4e5ed�rNej6gZ7ngZ7de4fd��YZ8ej9ej:gdj;�D]Z<e=ee<d�^q��Z>d	e!fd ��YZ?dS(#i����N(tsix(tbuiltinstmaptjava(tDistutilsError(tworking_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|dt�tj}|t_z	dVWd|t_XdS(sL
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    texist_okN(t
pkg_resourcest
py31compattmakedirstTruettempfilettempdir(treplacementR((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

	tUnpickleableExceptioncBseZdZed��ZRS(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)eZdZd�Zd�Zd�ZRS(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|||j�dS(s"restore and re-raise any exceptionR>N(tvarsRR.tloadsR>RtreraiseR?(R<R4R5((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pytresume�s(R7R8R9R=RARE(((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR;rs		c#sgtjj��t��}�VWdQXtjj���fd�tjD�}t|�|j�dS(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	<genexpr>�s(RtmodulestcopyR;tupdatet_clear_modulesRE(t	saved_exctdel_modules((Rs6/usr/lib/python2.7/site-packages/setuptools/sandbox.pytsave_modules�s
cCs%xt|�D]}tj|=q
WdS(N(tlistRRI(tmodule_namesRH((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRL�sccs*tj�}z	|VWdtj|�XdS(N(R t__getstate__t__setstate__(R((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pytsave_pkg_resources_state�s	ccs�tjj|d�}t��qt��at�t��Jt��:t|��'t	|��t
d�dVWdQXWdQXWdQXWdQXWdQXWdQXdS(Nttempt
setuptools(R(RtjoinRTROthide_setuptoolsRRR'R,t
__import__(t	setup_dirttemp_dir((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt
setup_context�s






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_hiding�scCs 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.pyRX�sc
Cstjjtjj|��}t|���y�|gt|�tj(tjjd|�t	j
�t	jjd��t
|t�r�|n|jtj��}t|��'td|dd�}t||�WdQXWn/tk
r}|jr|jdr�qnXWdQXdS(s8Run a distutils setup script, sandboxed in its directoryicSs
|j�S(N(tactivate(tdist((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt<lambda>�tt__file__R7t__main__N(R(RtabspathtdirnameR\RPRRtinsertRt__init__t	callbackstappendt
isinstancetstrtencodetgetfilesystemencodingRtdictRt
SystemExittargs(tsetup_scriptRuRZtdunder_filetnstv((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR	�s


cBs�eZdZeZd�Zd�Zd�Zd�Zd�Z	d�Z
x<ddd	gD]+Zee
e�rXe
e�e�e<qXqXWd)d
�Zer�ede�Znede�Zxld
ddddddddddddddddddgD]+Zee
e�r�ee�e�e<q�q�Wd�Zx9d d!gD]+Zee
e�r?ee�e�e<q?q?Wd"�Zx9d#d$gD]+Zee
e�r�ee�e�e<q�q�Wd%�Zd&�Zd'�Zd(�ZRS(*sDWrap 'os' module and 'open()' builtin for virtualizing setup scriptscCsEgtt�D]+}|jd�r
t||�r
|^q
|_dS(Nt_(tdirt_osRFthasattrt_attrs(R<tname((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRlscCs1x*|jD]}tt|t||��q
WdS(N(R~tsetattrR(tgetattr(R<tsourceR((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt_copyscCs;|j|�tr"|jt_n|jt_t|_dS(N(R�t_fileRtfilet_openRR#t_active(R<((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR=s

cCs5t|_trtt_ntt_|jt�dS(N(	tFalseR�R�RR�R�RR�R|(R<texc_typet	exc_valuet	traceback((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRAs
		cCs|�|�SWdQXdS(sRun 'func' under os sandboxingN((R<tfunc((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pytrunscs%tt�����fd�}|S(Ncs@|jr-|j�||||�\}}n�||||�S(N(R�t_remap_pair(R<tsrctdstRutkw(Rtoriginal(s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pytwrap&s	$(R�R|(RR�((RR�s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt_mk_dual_path_wrapper#strenametlinktsymlinkcs+�ptt�����fd�}|S(Ncs4|jr$|j�|||�}n�|||�S(N(R�t_remap_input(R<RRuR�(RR�(s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR�4s	(R�R|(RR�R�((RR�s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt_mk_single_path_wrapper1sR�RtstattlistdirR*tchmodtchowntmkdirtremovetunlinktrmdirtutimetlchowntchroottlstatt	startfiletmkfifotmknodtpathconftaccesscs%tt�����fd�}|S(NcsM|jr=|j�|||�}|j��|||��S�|||�S(N(R�R�t
_remap_output(R<RRuR�(RR�(s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR�Is	(R�R|(RR�((RR�s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt_mk_single_with_returnFstreadlinkttempnamcs%tt�����fd�}|S(Ncs,�||�}|jr(|j�|�S|S(N(R�R�(R<RuR�tretval(RR�(s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR�Xs	(R�R|(RR�((RR�s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt	_mk_queryUsR)ttmpnamcCs|S(s=Called to remap or validate any path, whether input or output((R<R((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt_validate_pathdscOs
|j|�S(sCalled for path inputs(R�(R<t	operationRRuR�((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR�hscCs
|j|�S(sCalled for path outputs(R�(R<R�R((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR�lscOs6|j|d|||�|j|d|||�fS(s?Called for path pairs like rename, link, and symlink operationss-froms-to(R�(R<R�R�R�RuR�((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR�psN(R7R8R9R�R�RlR�R=RAR�R�RR}R|RRR�R�R�R�R�R�R�R�R�(((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRsB						

					tdevnullcBs�eZdZejddddddddd	d
ddd
g
�ZdgZed�Zd�Z	e
rudd�Z
ndd�Zd�Zd�Z
d�Zd�Zd�Zdd�ZRS(s<Restrict operations to a single subdirectory - pseudo-chrootRR�R�R�R�R�R�R�R�R�R�R�R�s.*lib2to3.*\.pickle$cCs�tjjtjj|��|_tjj|jd�|_g|D]$}tjjtjj|��^qC|_tj	|�dS(NRf(
R(Rtnormcasetrealpatht_sandboxRWt_prefixt_exceptionsRRl(R<tsandboxt
exceptionsR((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyRl�s
!1cOs&ddlm}||||��dS(Ni����(R(R1R(R<R�RuR�R((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt
_violation�strcOsK|dkr8|j|�r8|jd||||�nt||||�S(NR�trtR
trUtUR�(R�R�R
R�R�(t_okR�R�(R<RRRuR�((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR��scOsK|dkr8|j|�r8|jd||||�nt||||�S(NR�R�R
R�R�R(R�R�R
R�R�(R�R�R�(R<RRRuR�((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR��scCs|jd�dS(NR�(R�(R<((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR��scCss|j}zYt|_tjjtjj|��}|j|�p`||jkp`|j|j	�SWd||_XdS(N(
R�R�R(RR�R�t	_exemptedR�RFR�(R<RtactiveR�((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR��s		csN�fd�|jD�}�fd�|jD�}tj||�}t|�S(Nc3s|]}�j|�VqdS(N(RF(RGt	exception(tfilepath(s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pys	<genexpr>�sc3s!|]}tj|��VqdS(N(R]R_(RGR`(R�(s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pys	<genexpr>�s(R�t_exception_patternst	itertoolstchaintany(R<R�t
start_matchestpattern_matchest
candidates((R�s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR��s

cOsH||jkrD|j|�rD|j|tjj|�||�n|S(sCalled for path inputs(t	write_opsR�R�R(RR�(R<R�RRuR�((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR��s%cOsF|j|�s |j|�r<|j|||||�n||fS(s?Called for path pairs like rename, link, and symlink operations(R�R�(R<R�R�R�RuR�((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR��s i�cOsR|t@r9|j|�r9|jd|||||�ntj|||||�S(sCalled for low-level os.open()sos.open(tWRITE_FLAGSR�R�R|R(R<R�tflagsRRuR�((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR�s(R7R8R9RstfromkeysR�R�t_EXCEPTIONSRlR�R�R�R�R�R�R�R�R(((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR~s 					
			s4O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYicBs,eZdZejd�j�Zd�ZRS(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\}}}|jjt��S(N(RuttmpltformatR(R<tcmdRutkwargs((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt__str__�s(R7R8R9ttextwraptdedenttlstripR�R�(((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyR�s
(((@R(RR$toperatort	functoolsR�R]t
contextlibR.R�tsetuptools.externRtsetuptools.extern.six.movesRRtpkg_resources.py31compatR tplatformRFt$org.python.modules.posix.PosixModuletpythonRItposixtPosixModuleR|RR�R�t	NameErrorRRR�tdistutils.errorsRRt__all__RtcontextmanagerRRR'R,R0R-R;RORLRTR\RaRXR	RR}R�R�Rtreducetor_tsplittaR�R�R(((s6/usr/lib/python2.7/site-packages/setuptools/sandbox.pyt<module>s^




	
					wV	+

Hacked By AnonymousFox1.0, Coded By AnonymousFox