Current File : //opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyc
�
�wMVc@s�ddlmZddlZddlZddlZddlZddlZddlmZm Z m
Z
mZddlm
Z
ddlmZmZmZmZmZeje�Zdj�Zejd�Zd Zd
efd��YZdS(i����(tBytesIONi(t sysconfigtfsencodetdetect_encodingtZipFile(tfinder(tFileOperatortget_export_entrytconvert_pathtget_executabletin_venvs�
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
processorArchitecture="X86"
name="%s"
type="win32"/>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>s^#!.*pythonw?[0-9.]*([ ].*)?$s{# -*- coding: utf-8 -*-
if __name__ == '__main__':
import sys, re
def _resolve(module, func):
__import__(module)
mod = sys.modules[module]
parts = func.split('.')
result = getattr(mod, parts.pop(0))
for p in parts:
result = getattr(result, p)
return result
try:
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
func = _resolve('%(module)s', '%(func)s')
rc = func() # None interpreted as 0
except Exception as e: # only supporting Python >= 2.6
sys.stderr.write('%%s\n' %% e)
rc = 1
sys.exit(rc)
tScriptMakercBs�eZdZeZdZeedd�Z d�Z
ddd�Zd�Ze
Zd�Zd�Zdd�Zd �Zed
��Zejd��Zejdkr�d
�Zndd�Zdd�ZRS(s_
A class to copy or create scripts from source scripts or callable
specifications.
cCsg||_||_||_t|_t|_tjdk|_t d�|_
|p]t|�|_dS(NtposixtsX.Y(R
sX.Y(
t
source_dirt
target_dirt
add_launcherstFalsetforcetclobbertostnametset_modetsettvariantsRt_fileop(tselfRRRtdry_runtfileop((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyt__init__Ks cCsg|jdt�rctjdkrctjj|�\}}|jdd�}tjj||�}n|S(Ntguitnttpythontpythonw(tgetRRRtpathtsplittreplacetjoin(Rt
executabletoptionstdntfn((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyt_get_alternate_executableWs
!R
cCs�t}|jr!|j}t}n�tj�s9t�}nqt�rptjj tj
d�dtjd��}n:tjj tjd�dtjd�tjd�f�}|r�|j||�}n|r�d|kr�d|}nt
|�}d ||d
}y|jd�Wn!tk
r6td|��nX|dkr�y|j|�Wq�tk
r}td
||f��q�Xn|S(Ntscriptsspython%stEXEtBINDIRs
python%s%stVERSIONt s"%s"s#!s
sutf-8s,The shebang (%r) is not decodable from utf-8s?The shebang (%r) is not decodable from the script encoding (%r)(tTrueR'RRtis_python_buildR R
RR#R&tget_pathtget_config_varR+RtdecodetUnicodeDecodeErrort
ValueError(Rtencodingtpost_interpR(tenquoteR'tshebang((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyt_get_shebang^s@
cCs |jtd|jd|j�S(Ntmoduletfunc(tscript_templatetdicttprefixtsuffix(Rtentry((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyt_get_script_text�scCstjj|�}|j|S(N(RR#tbasenametmanifest(Rtexenametbase((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pytget_manifest�scCs�|jotjdk}tjjd�}|sA|||}n||dkr_|jd�}n|jd�}t�} t| d��}
|
jd|�WdQX| j �}||||}x�|D]�}tj
j|j|�}
|r�tj
j
|
�\}}|jd�r|}
nd|
}
y|jj|
|�Wqxtk
r�tjd �d
|
}tj
j|�r�tj|�ntj|
|�|jj|
|�tjd�ytj|�Wq�tk
r�q�XqxXn�tjdkr|
jd|�rd
|
|f}
ntj
j|
�rF|jrFtjd|
�q�n|jj|
|�|jrx|jj|
g�n|j|
�q�WdS(NRsutf-8tpytttws__main__.pys.pys%s.exes:Failed to write executable - trying to use .deleteme logics%s.deletemes0Able to replace executable using .deleteme logict.s%s.%ssSkipping existing file %s(RRRtlineseptencodet
_get_launcherRRtwritestrtgetvalueR#R&Rtsplitextt
startswithRtwrite_binary_filet ExceptiontloggertwarningtexiststremovetrenametdebugtendswithRRtset_executable_modetappend(RtnamesR;tscript_bytest filenamestexttuse_launcherRNtlaunchertstreamtzftzip_dataRtoutnametntetdfname((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyt
_write_script�sT
# c Cs|jdd|�}|j|�jd�}|j}t�}d|jkr^|j|�nd|jkr�|jd|tjdf�nd|jkr�|jd|tjd f�n|r�|j d
t
�r�d}nd}|j|||||�dS(
Nsutf-8R(R
tXs%s%sisX.Ys%s-%siRtpywRJ(R<RDRORRRtaddtsystversionR"RRm( RRCRbR(R;tscriptRtscriptnamesRc((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyt_make_script�s !! cCs@t}tjj|jt|��}tjj|jtjj|��}|jr||j j
||�r|tjd|�dSyt
|d�}Wn&tk
r�|js��nd}n�Xt|j�\}}|jd�|j�}|s tjd|j�|�dStj|jdd��} | rHt}| jd�pBd}
n|s�|ra|j�n|j j||�|jr�|j j|g�n|j|�n�tj d ||j�|j js)|j!||
�}d
|kr�d}nd}tjj|�}
|j"|
g||j#�||�n|r<|j�ndS(
Nsnot copying %s (up-to-date)trbis"%s: %s is an empty file (skipping)s
s
iR
scopying and adjusting %s -> %sR!RoRJ($RRR#R&RRRRERRtnewerRWR\topentIOErrorRtNoneRtreadlinetseekRXtget_command_namet
FIRST_LINE_REtmatchR%R1tgrouptcloset copy_fileRR^R_tinfoR<Rmtread(RRsRbtadjustRitfR8tlinest
first_lineRR9R;RcRj((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyt_copy_script�sR$
%cCs
|jjS(N(RR(R((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyR
scCs||j_dS(N(RR(Rtvalue((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyRsRcCsftjd�dkrd}nd}d||f}tjdd�d}t|�j|�j}|S( NtPit64t32s%s%s.exeRMii(tstructtcalcsizet__name__trsplitRtfindtbytes(RtkindtbitsRtdistlib_packagetresult((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyRPs cCsKg}t|�}|dkr1|j||�n|j||d|�|S(s�
Make a script.
:param specification: The specification, which is either a valid export
entry specification (to make a script from a
callable) or a filename (to make a script by
copying from a source location).
:param options: A dictionary of options controlling script generation.
:return: A list of all absolute pathnames written to.
R(N(RRzR�Ru(Rt
specificationR(RbRC((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pytmake'scCs4g}x'|D]}|j|j||��q
W|S(s�
Take a list of specifications and make scripts from them,
:param specifications: A list of specifications.
:return: A list of all absolute pathnames written to,
(textendR�(RtspecificationsR(RbR�((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyt
make_multiple:s
N(R�t
__module__t__doc__tSCRIPT_TEMPLATER?RzR'R1RRR+R<RDt_DEFAULT_MANIFESTRFRIRmRuR�tpropertyRtsetterRRRPR�R�(((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyRBs& . 2 4(tioRtloggingRtreR�RqtcompatRRRRt resourcesRtutilRRRR R
t getLoggerR�RWtstripR�tcompileR~R�tobjectR(((sL/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/scripts.pyt<module>s"(