ó †2{Yc@sðddlmZddlZddlZddlZddlZddlZddlmZm Z m Z m Z ddl m Z ddlmZmZmZmZmZejeƒZdjƒZejdƒZd Zd efd „ƒYZdS( iÿÿÿÿ(tBytesIONi(t sysconfigtfsencodetdetect_encodingtZipFile(tfinder(t FileOperatortget_export_entryt convert_pathtget_executabletin_venvsñ 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) t ScriptMakercBsÎeZdZeZdZeedd„Z d„Z ddd„Z d„Z e Zd„Zd„Zdd„Zd „Zed „ƒZejd „ƒZejd kr´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/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyt__init__Ks     cCsg|jdtƒrctjdkrctjj|ƒ\}}|jddƒ}tjj||ƒ}n|S(Ntguitnttpythontpythonw(tgetRRRtpathtsplittreplacetjoin(Rt executabletoptionstdntfn((sL/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyt_get_alternate_executableWs !R cCs…t}|jr!|j}t}n‰tjƒs9tƒ}nqtƒrptjj tj dƒdtj dƒƒ}n:tjj tj dƒdtj dƒtj dƒfƒ}|rÅ|j ||ƒ}n|räd|kräd|}nt |ƒ}d ||d }y|jd ƒWn!tk r6td |ƒ‚nX|d kry|j|ƒWqtk r}td ||fƒ‚qXn|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(Rtencodingt post_interpR(tenquoteR'tshebang((sL/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyt _get_shebang^s@             cCs |jtd|jd|jƒS(Ntmoduletfunc(tscript_templatetdicttprefixtsuffix(Rtentry((sL/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyt_get_script_textŒscCstjj|ƒ}|j|S(N(RR#tbasenametmanifest(Rtexenametbase((sL/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyt get_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|j rFtjd| ƒ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;t script_bytest filenamestextt use_launcherRNtlaunchertstreamtzftzip_dataRtoutnametntetdfname((sL/opt/alt/python33/lib/python3.3/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;tscriptRt scriptnamesRc((sL/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyt _make_scriptÈs  !! cCs@t}tjj|jt|ƒƒ}tjj|jtjj|ƒƒ}|j r||j j ||ƒ r|t j d|ƒdSyt |dƒ}Wn&tk r·|js®‚nd}n‘Xt|jƒ\}}|jdƒ|jƒ}|s t jd|jƒ|ƒdStj|jddƒƒ} | rHt}| jdƒpBd} n|s£|ra|jƒn|j j||ƒ|jr“|j j|gƒn|j|ƒn™t j 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/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyt _copy_scriptÙsR$              %cCs |jjS(N(RR(R((sL/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyR scCs||j_dS(N(RR(Rtvalue((sL/opt/alt/python33/lib/python3.3/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/python33/lib/python3.3/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/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pytmake's   cCs4g}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/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyt make_multiple:s N(Rt __module__t__doc__tSCRIPT_TEMPLATER?RzR'R1RRR+R<RDt_DEFAULT_MANIFESTRFRIRmRuR‰tpropertyRtsetterRRRPR™Rœ(((sL/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyR Bs& .   2  4  (tioRtloggingRtreRŽRqtcompatRRRRt resourcesRtutilRRRR R t getLoggerRRWtstripR tcompileR~RŸtobjectR (((sL/opt/alt/python33/lib/python3.3/site-packages/pip/_vendor/distlib/scripts.pyts     "(