8f\IddlmZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZmZmZmZmZejeZdZejd Zd Zed ddZ d ee !d DZ"dZ#e#Z$Gdde%Z&dS))BytesION)ZipInfo) sysconfigdetect_encodingZipFile)finder) FileOperatorget_export_entry convert_pathget_executable get_platformin_venva s^#!.*pythonw?[0-9.]*([ ].*)?$z# -*- 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()) .c\i|])}|jd|j|j*S).exe)nameendswithbytes).0rs {/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/distlib/scripts.py r@sB    vv FAG   cd|vrj|dr;|dd\}}d|vr|ds|d|d}n|dsd|z}|S)N z /usr/bin/env r"z "z"%s") startswithsplit) executableenv _executables renquote_executabler$Gs j   1 1 1)//Q77 Ck!!+*@*@*E*E!*-##{{{; ((-- 1#j0 rc8eZdZdZeZdZ ddZdZe j drdZ d Z d Zdd Zd ZeZdZdZdZdZddZdZedZejdZejdksejdkrejdkrdZddZ ddZ!dS) ScriptMakerz_ A class to copy or create scripts from source scripts or callable specifications. NTFc||_||_||_d|_d|_t jdkpt jdkot jdk|_td|_ |pt||_ t jdkpt jdkot jdk|_ tj|_dS)NFposixjava)rX.Ynt) source_dir target_dir add_launchersforceclobberosr_nameset_modesetvariantsr _fileop_is_ntsys version_info)selfr,r-r.dry_runfileops r__init__zScriptMaker.__init__ds %$*  G+JF1B2I57X5H K(( 6g!6!6 go@"'V*;+?.0h$.> ,rc|ddr_|jrXtj|\}}|dd}tj||}|S)NguiFpythonpythonw)getr7r1pathr replacejoin)r:r!optionsdnfns r_get_alternate_executablez%ScriptMaker._get_alternate_executableysf ;;ue $ $ . .W]]:..FBHi00Bb"--Jrr)c t|5}|ddkcdddS#1swxYwYdS#ttf$rtd|YdSwxYw)zl Determine if the specified executable is a script (contains a #! line) z#!NzFailed to open %sF)openreadOSErrorIOErrorloggerwarning)r:r!fps r _is_shellzScriptMaker._is_shells  *%%.771::-..................W%   2J???uu s,A7 A;A;A,A43A4c||r*ddl}|jjddkr|Sn)|dr|Sd|zS)Nrzos.nameLinuxz jython.exez/usr/bin/env %s)rSr)langSystem getPropertylowerr)r:r!r)s r_fix_jython_executablez"ScriptMaker._fix_jython_executables|~~j)) " 9#// ::gEE%%F!!##,,\:: "!!$z1 1rctjdkrd}nAt|t|zdz}tjdkrd}nd}d|vo||k}|r d|z|zd z}nd }|d |z|zd zz }|d z }|S)a 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 r(Tdarwini s#! s #!/bin/sh s '''exec' s "$0" "$@" s' ''')r1rlenr8platform)r:r! post_interpsimple_shebangshebang_lengthmax_shebang_lengthresults r_build_shebangzScriptMaker._build_shebangs 7g  !NN!__s;/?/??!CN|x''%(""%("#:5I#15G#G   Z'+5=FF#F lZ/+=O OF h F rrcd}|jr |j}d}n,tjst}n t rHt jtjddtj dz}nt j dkrHt jtj ddtj dz}n[t jtj ddtj d tj d}|r| ||}tj d r||}|rt!|}|d }tj d kr d |vr d|vr|dz }|||} |d n #t($rt+d|zwxYw|d kr; ||n$#t($rt+d|d|dwxYw|S)NTFscriptszpython%sEXEr+BINDIRr@VERSIONr)utf-8cliz -X:Framesz -X:FullFramess -X:Framesz,The shebang (%r) is not decodable from utf-8z The shebang (z-) is not decodable from the script encoding ())r!ris_python_buildr rr1rCrEget_pathget_config_varrrIr8rbrrZr$encoderhdecodeUnicodeDecodeError ValueError)r:encodingrcrFenquoter!shebangs r _get_shebangzScriptMaker._get_shebangs ? FJGG*,, F'))JJ YY F"9--Y5e<<<>>JJw$ W\\,X66)":5"A"ABDD  W\\,X666$-$>  & NN7 # # # #! & & &K$%&& & & w   6x((((% 6 6 6 j")''888"5666 6s'G==H$H::!Ic|jt|j|jdd|jzS)Nrr)module import_namefunc)script_templatedictprefixsuffixr )r:entrys r_get_script_textzScriptMaker._get_script_textsE#d< **3//2''' rcTtj|}|j|zSN)r1rCbasenamemanifest)r:exenamebases r get_manifestzScriptMaker.get_manifest s$w((}t##rc|jo|j}tjd}||s||z }|s||z}n |dkr|d}n|d}t} t| d5} tj d} | rQtj t| dd} td| } | | |n| d|dddn #1swxYwY| }||z|z}|D]}tj|j|}|r.tj|\}}|d r|}d |z} |j||nx#t0$rt2d d |z}tj|rtj|tj|||j||t2d  tj|n#t0$rYnwxYwYnwxYw|jr|d|zs|d|}tj|r$|jst2d||j|||j r|j!|g|"|dS)NrnpytwSOURCE_DATE_EPOCHz __main__.py)filename date_timez.pyz%s.exez:Failed to write executable - trying to use .deleteme logicz %s.deletemez0Able to replace executable using .deleteme logicrzSkipping existing file %s)#r.r7r1lineseprtr _get_launcherrrenvironrBtimegmtimeintrwritestrgetvaluerCrEr-splitextrr6write_binary_file ExceptionrPrQexistsremoverenamedebugr0r3set_executable_modeappend)r:namesrz script_bytes filenamesext use_launcherrlauncherstreamzfsource_date_epochrzinfozip_dataroutnamenedfnames r _write_scriptzScriptMaker._write_script s)9dk *##G,,((  w G 9"\1LLd{{--c22--c22YYF%% =$&JNN3F$G$G!$= $ C0A,B,B C CBQB GI#].7999EKK|4444KK |<<< = = = = = = = = = = = = = = =((H#g-8L" &" &Dgll4?D99G @w''001<<&& G"W,L227LIIII NN$9:::*W4Fw~~f--* &)))Igv...L227LIIILL"3444 &))))$ ;7w'7'7c (#(#7)0##6G7>>'**4<NN#>HHH ..w EEE=@L44gY???   W % % % %E" &" &sJ B D55D9<D9G%%B&J4 J! J4! J.+J4-J..J43J4-c<t}d|jvr||d|jvr$|||jdd|jvr9|||j|jdd|jd|S)NrXrr*rr)r4r5addr9variant_separator)r:rrgs rget_script_filenamesz ScriptMaker.get_script_filenamesKs    JJt    $-   JJt'8';';< = = = DM ! ! JJd44d6G6J6J6J)!,,. / / / rcd}|rE|dg}|r-dd|z}|d}|d||}||d}||j}|r|ddrd } nd } |||||| dS) Nrinterpreter_argsz %srrnrFr?Fpywr)rBrErtr{rrrr) r:rrrFrcargsrzscript scriptnamesrs r _make_scriptzScriptMaker._make_scriptWs  3;;1266D 3sxx~~-"kk'22 ##G['#JJ&&u--44W==// ;;  w{{5%00 CCC ;CHHHHHrcNd}tj|jt |}tj|jtj|}|js8|j ||st d|dS t|d}| }|std|dSt|dd}|rd}|dpd }n#t&$r |jsd}YnwxYw|sj|r||j|||jr|j|g||dStd ||j|jjst7|j \} } |d || |} d |vrd } nd} tj|} || g| ||| |r|dSdS)NFznot copying %s (up-to-date)rbz%s is an empty file (skipping)s r`Trrzcopying and adjusting %s -> %srspythonwrr) r1rCrEr,r r-rr/r6newerrPrrLreadlinerQ FIRST_LINE_REmatchrDgrouprOr;close copy_filer3rrinforseekr{rrM)r:rradjustrf first_linerrcrxlinesrzrrs r _copy_scriptzScriptMaker._copy_scriptgsdo|F/C/CDD',,t0@0@0H0HIIz $,"4"4VW"E"E  LL6 ? ? ? F  4VT""A J ?HHH!'' (:(:7E(J(JKKE 4#kk!nn3    < AAA    L " "67 3 3 3} < 00';;;   W % % % % % KK8& ) ) )<' K"1!*"="=%q ++HkBB++CCCG$$W--""A39cJJJ    s7EEEc|jjSrr6r;)r:s rr;zScriptMaker.dry_runs |##rc||j_dSrr)r:values rr;zScriptMaker.dry_runs$ rr+ctjddkrd}nd}tdkrdnd}|||d}|tvrd |d t}t |t|S) NP6432z win-arm64z-armrrzUnable to find resource z in package )structcalcsizerWRAPPERSdistlib_packagerw)r:kindbitsplatform_suffixrmsgs rrzScriptMaker._get_launcherss##q(((4+(E(Eff2O#'4?D8###oo/ oo%D> !rcg}t|}||||n|||||S)a 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. Nr)r rr)r: specificationrFrrs rmakezScriptMaker.makesU  // =   mY 7 7 7 7   eY  @ @ @rcfg}|D]+}||||,|S)z 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, )extendr)r:specificationsrFrrs r make_multiplezScriptMaker.make_multiplesE  + @ @M   TYY}g>> ? ? ? ?r)TFN)rNr)"__name__ __module__ __qualname____doc__SCRIPT_TEMPLATErr!r=rIr8rbrrSrZrhr{r_DEFAULT_MANIFESTrrrrrrrpropertyr;setterr1rr2rrrrrr&r&[s&OJ $ ----* |v&&2    2 2 2>FFFFP !H$$$:&:&:&x   IIII 111f$$X$ ^%%^% w$27f,,!x4// " " "&      rr&)'iorloggingr1rerr8rzipfilercompatrrr resourcesr utilr r r r rr getLoggerrrPstriprcompilerrrsplitriteratorrr$_enquote_executableobjectr&rrrrs 7777777777::::::::::::::::  8 $ $ uww!& =>> &//#q))!,   VO $ $ - -b 1 1      ")wwwww&wwwwwr