Rec@sddlmZddlZddlZddlZddlZddlZddlmZm Z m Z ddl m Z ddl mZmZmZmZmZejeZdjZejdZd Zd ZeZd efd YZdS( i(tBytesIONi(t sysconfigtdetect_encodingtZipFile(tfinder(t FileOperatortget_export_entryt convert_pathtget_executabletin_venvs s^#!.*pythonw?[0-9.]*([ ].*)?$s# -*- coding: utf-8 -*- import re import sys from %(module)s import %(import_name)s if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(%(func)s()) cCsd|kr|jdre|jdd\}}d|kr|jd rd||f}qq|jdsd|}qn|S(Nt s /usr/bin/env it"s%s "%s"s"%s"(t startswithtsplit(t executabletenvt _executable((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pytenquote_executable3s t ScriptMakercBseZdZeZdZeeddZ dZ e j j drZdZdZndZdddZd ZeZd Zd Zdd Zd ZedZejdZejdksejdkrejdkrdZnddZ ddZ!RS(s_ A class to copy or create scripts from source scripts or callable specifications. cCs||_||_||_t|_t|_tjdkpWtjdkoWtjdk|_ t d|_ |p{t ||_ tjdkptjdkotjdk|_tj|_dS(NtposixtjavatsX.Ytnt(RsX.Y(t source_dirt target_dirt add_launcherstFalsetforcetclobbertostnamet_nametset_modetsettvariantsRt_fileopt_is_nttsyst version_info(tselfRRRtdry_runtfileop((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt__init__Ns     !cCsa|jdtr]|jr]tjj|\}}|jdd}tjj||}n|S(Ntguitpythontpythonw(tgetRR$RtpathR treplacetjoin(R'Rtoptionstdntfn((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_get_alternate_executable_s RcCs[y,t|}|jddkSWdQXWn(ttfk rVtjd|tSXdS(sl Determine if the specified executable is a script (contains a #! line) is#!NsFailed to open %s(topentreadtOSErrortIOErrortloggertwarningR(R'Rtfp((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _is_shellgs cCs^|j|r=ddl}|jjjddkrV|Sn|jjdrV|Sd|S(Nisos.nametLinuxs jython.exes/usr/bin/env %s(R=RtlangtSystemt getPropertytlowertendswith(R'RR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_fix_jython_executabless cCstjdkrt}nPt|t|d}tjdkrJd}nd}d|koe||k}|rd||d}n&d }|d ||d 7}|d 7}|S( s Build a shebang line. In the simple case (on Windows, or a shebang line which is not too long or contains spaces) use a simple formulation for the shebang. Otherwise, use /bin/sh as the executable, with a contrived shebang which allows the script to run either under Python or sh, using suitable quoting. Thanks to Harald Nordgren for his input. See also: http://www.in-ulm.de/~mascheck/various/shebang/#length https://hg.mozilla.org/mozilla-central/file/tip/mach RitdarwiniiR s#!s s #!/bin/sh s '''exec' s "$0" "$@" s' '''(RRtTruetlenR%tplatform(R'Rt post_interptsimple_shebangtshebang_lengthtmax_shebang_lengthtresult((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_build_shebangs      RcCst}|jr!|j}t}ntjs9t}nqtrptjj tj ddtj d}n:tjj tj ddtj dtj df}|r|j ||}nt jjdr|j|}n|rt|}n|jd}t jd krAd |krAd |krA|d 7}n|j||}y|jdWn!tk rtd |nX|dkry|j|Wqtk rtd||fqXn|S(Ntscriptsspython%stEXEtBINDIRs python%s%stVERSIONRsutf-8tclis -X:Framess -X:FullFramess -X:Framess,The shebang (%r) is not decodable from utf-8s?The shebang (%r) is not decodable from the script encoding (%r)(RFRRRtis_python_buildRR RR/R1tget_pathtget_config_varR5R%RHR RDRtencodeRNtdecodetUnicodeDecodeErrort ValueError(R'tencodingRIR2tenquoteRtshebang((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _get_shebangsJ              cCs6|jtd|jd|jjddd|jS(Ntmodulet import_namet.itfunc(tscript_templatetdicttprefixtsuffixR (R'tentry((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt_get_script_textscCstjj|}|j|S(N(RR/tbasenametmanifest(R'texenametbase((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt get_manifestscCs|jo|j}tjjd}|j|s@||7}n|sS||}nx|dkrq|jd}n|jd}t} t| d} | j d|WdQX| j } ||| }x|D]} tj j |j | } |rtj j| \}}|jdr&|} nd| } y|jj| |Wqtk rtjdd | }tj j|rtj|ntj| ||jj| |tjd ytj|Wqtk rqXqXn|jr| jd | rd | |f} ntj j| rN|j rNtjd | qn|jj| ||jr|jj| gn|j| qWdS(Nsutf-8tpytttws __main__.pys.pys%s.exes:Failed to write executable - trying to use .deleteme logics %s.deletemes0Able to replace executable using .deleteme logicRas%s.%ssSkipping existing file %s(RR$RtlinesepRWRCt _get_launcherRRtwritestrtgetvalueR/R1RtsplitextR R#twrite_binary_filet ExceptionR:R;texiststremovetrenametdebugRR tset_executable_modetappend(R'tnamesR]t script_bytest filenamestextt use_launcherRqtlaunchertstreamtzftzip_dataRtoutnametntetdfname((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _write_scriptsX               c Cs[d}|rL|jdg}|rLddj|}|jd}qLn|jd|d|}|j|jd}|j}t} d|jkr| j|nd|jkr| jd||j d fnd |jkr| jd ||j d |j d fn|r8|jd t r8d} nd} |j | |||| dS(NRtinterpreter_argss %sR sutf-8R2tXs%s%sisX.Ys%s-%s.%siR+tpywRn( R.R1RWR^RhRR!R"taddR&RR( R'RgRR2RItargsR]tscriptRt scriptnamesR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _make_scripts*  ! cCs@t}tjj|jt|}tjj|jtjj|}|j r||j j || r|t j d|dSyt |d}Wn&tk r|jsnd}noX|j}|st jd|j|dStj|jdd}|r&t}|jdp d}n|s|r?|jn|j j|||jrq|j j|gn|j|nt jd||j|j js)t|j\} } |j d |j!| |} d |krd } nd } tjj|} |j"| g| |j#|| n|r<|jndS( Nsnot copying %s (up-to-date)trbs"%s: %s is an empty file (skipping)s s iRscopying and adjusting %s -> %siR-RRn($RRR/R1RRRRiRR#tnewerR:R{R6R9R(tNonetreadlineR;tget_command_namet FIRST_LINE_REtmatchR0RFtgrouptcloset copy_fileR R|R}tinfoRtseekR^RR7(R'RRtadjustRtft first_lineRRIR[tlinesR]RR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt _copy_script5sR$              %cCs |jjS(N(R#R((R'((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyR(iscCs||j_dS(N(R#R((R'tvalue((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyR(msRcCstjddkrd}nd}d||f}tjddd}t|j|}|sd ||f}t|n|jS( NtPit64t32s%s%s.exeRaiis(Unable to find resource %s in package %s(tstructtcalcsizet__name__trsplitRtfindRZtbytes(R'tkindtbitsRtdistlib_packagetresourcetmsg((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyRrus  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. R2N(RRRR(R't specificationR2RRg((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pytmakes   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(R'tspecificationsR2RR((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyt make_multiples N("Rt __module__t__doc__tSCRIPT_TEMPLATERcRRRFRR*R5R%RHR R=RDRNR^Rht_DEFAULT_MANIFESTRjRmRRRtpropertyR(tsetterRRRRrRR(((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyREs.  @   4  4-  (tioRtloggingRtreRR%tcompatRRRt resourcesRtutilRRRRR t getLoggerRR:tstripRtcompileRRRt_enquote_executabletobjectR(((s/builddir/build/BUILDROOT/alt-python27-pip-20.2.4-5.el8.x86_64/opt/alt/python27/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.pyts     (