;i dZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z ddl m Z ddlmZmZddlmZmZmZmZddlmZmZmZmZmZmZmZdd lmZdd l m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'dd l(m)Z)dd l*m+Z+ddl,m-cm.Z/e j0e1Z2e$rdd l3m4Z4m5Z5m6Z6m7Z7m8Z8e"r ddl9m-cm:Z;GddeZ<GddeZ=GddeZ>GddeZ?GddZ@dZAdZBdZCdS)z This module contains classes that are available for the .spec files. Spec file is generated by PyInstaller. The generated code from .spec file is a way how PyInstaller does the dependency analysis and creates executable. N) itemgetter)HOMEPATHPLATFORM)log)CArchiveWriterZlibArchiveWriter)Target_check_guts_eqnormalize_pyz_toc normalize_toc)_check_guts_toc_make_clean_directory_rmtreeprocess_collected_binaryget_code_objectstrip_paths_in_codecompile_pymodule)Splash) is_cygwin is_darwinis_linuxis_winstrict_collect_modeis_nogilis_aix) bindepend)get_bootstrap_modules)icon versioninfo winmanifest winresourcewinutilsc8eZdZdZfdZdefdeffZdZxZ S)PYZz[ Creates a zlib-based PYZ archive that contains byte-compiled pure Python modules. cb|drddlm}|dddlm}t |dd}||_|2tj |j ddz|_t}g|_ tj |d d }|D][\}}} | d kr2t|||dd } |j || | f>|j ||| f\t#d |j D} g|_i|_|D]} |dt)| } | |j| | D]9}|\}}} | dvsJd|d|| vr|j|:t-|j|_|j|dS)a tocs One or more TOC (Table of Contents) lists, usually an `Analysis.pure`. kwargs Possible keyword arguments: name A filename for the .pyz. Normally not needed, as the generated name will do fine. cipherr)RemovedCipherFeatureErrorzOPlease remove the 'cipher' arguments to PYZ() and Analysis() in your spec file.CONFnameNz.pyzworkpath localpycsPYMODULE)optimize code_cachec3.K|]\}}}|dk |VdS)r-N).0r*_typecodes LC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\PyInstaller/building/api.py zPYZ.__init__..is5$o$o.?dAxX`dnXnXnTXnXnXnXn$o$or/>r- PYMODULE-1 PYMODULE-2zInvalid entry passed to PYZ: !)getPyInstaller.exceptionsr'PyInstaller.configr)super__init__r*ospathsplitext tocfilenamer dependenciesjoinrappendsettoc code_dictidupdater sort __postinit__)selftocskwargsr'r)r*bootstrap_dependenciesr+src_pathr4pyc_pathbootstrap_module_namesrHr/entryr3 __class__s r5r?z PYZ.__init__5s ::h    H H H H H H++a  ,+++++ zz&$'' <(()9::1=FDI"7!8!87<<Z 0+>>(> E E $D(H:%%+# !(($()CDDDD!(($()CDDDD"%$o$o4CT$o$o$o!o!o ' 'Cl+//388J%%%j111 ' '$)!a#KKKKMumrMuMuMuKKK111&&&& '%TX..   r7r*rHctd|jg}|jD]^}|\}}}||jvr8dddd|} t ||||j|<n#t $rYEwxYw||_d|jD|_t|j||jtd |jdS) NzBuilding PYZ (ZlibArchive) %sr)r-r8r9)r.c4i|]\}}|t|Sr1)r)r2r*codes r5 z PYZ.assemble..s'cccjdD$ 3D 9 9cccr7)rIz5Building PYZ (ZlibArchive) %s completed successfully.) loggerinfor*rHrIr SyntaxErrorrFitemsr)rN archive_tocrUr*rRr4 optim_levels r5assemblez PYZ.assembles 3TY??? X & &E', $D(H4>))+,AQOOPXY +:4T_+`+`+`DN4(("H   u % % % %dcDNL`L`LbLbccc $)[DNKKKK KTYWWWWWsA## A0/A0) __name__ __module__ __qualname____doc__r?r r _GUTSrc __classcell__rVs@r5r$r$1swLLLLL`    EXXXXXXXr7r$c eZdZdZidddddddddd d d d d dddddddd dddd ddddddZ d,fd Zd efd!efd"efd#efd$efd%efd&efd'efd(efd)efd*eff Zd+Z xZ S)-PKGz Creates a CArchive. CArchive is the data structure that is embedded into the executable. This data structure allows to include various read-only data in a single-file deployment. r-mr8r9PYSOURCEs PYSOURCE-1s1 PYSOURCE-2s2 EXTENSIONbr$zaDATAxBINARYZIPFILEZ EXECUTABLE DEPENDENCYdSPLASHlSYMLINKnNFc tt||_||_||_||_|2tj |j ddz|_||_ ||_ ||_ |pg|_| |_| |_| |_|j>t$t$t$t$t$t$t$t&t&d |_|dS)a toc A TOC (Table of Contents) list. python_lib_name Name of the python shared library to store in PKG. Required by bootloader. name An optional filename for the PKG. cdict Dictionary that specifies compression by typecode. For Example, PYZ is left uncompressed so that it can be accessed inside the PKG. The default uses sensible values. If zlib is not available, no compression is used. exclude_binaries If True, EXTENSIONs and BINARYs will be left out of the PKG, and forwarded to its container (usually a COLLECT). strip_binaries If True, use 'strip' command to reduce the size of binary files. upx_binaries Nr.pkg) rtrxrzr}rnr-rr$r)r>r?r rHpython_lib_namecdictr*r@rArBrCexclude_binariesstrip_binaries upx_binaries upx_exclude target_archcodesign_identityentitlements_file COMPRESSED UNCOMPRESSEDrM) rNrHrr*rrrrrrrrrVs r5r?z PKG.__init__s@  %%.  <(()9::1=FDI 0,(&,"&!2!2 : '"$(&&$#'  DJ r7r*rrHrrrrrrrrc htdtj|jt j|j}g}g}|j D]\}}}|dvrtj |s:trtd|d|dt d||dt j||krtd|d|d vr|jr|j|||ft#|||j|j|j|j|j|j|d k }||||j|d |j|fC|d vr|jr|j|||fm|dkr"tj|tjrd}n |j|}||||j|d |f|dkr||dd df|dvr?||||j|d |j|f:|dkr?|d||j|d |j|f||||j|d |j|f|t=ddt?|j||z|j tdtj|jdS)NzBuilding PKG (CArchive) %s>OPTIONrr~Non-existent resource , meant to be collected as r:>Ignoring non-existent resource %s, meant to be collected as %szTrying to collect PKG file z into itself!)rzrtrt use_stripuse_upxrrrrstrict_arch_validationF)rxr{rxruro>r-rnr8r9rprrr$zPYZ.pyzr)key) pylib_namez2Building PKG (CArchive) %s completed successfully.)!r]r^r@rAbasenamer*pathlibPathresolverHexistsr ValueErrorwarningrrDrFrrrrrrrrr; xformdictaccessX_OKrLrrr)rNpkg_file bootstrap_tocra dest_namesrc_namer4carchive_typecodes r5rcz PKG.assembles 0"'2B2B492M2MNNN< **2244  -1XK uK u )IxBBBw~~h//!*!()s()s)sgp)s)s)sttt\^fhq!<))1133x??$%Z8%Z%Z%Z[[[222(y%,,i8-LMMMM 8 !"&"5 $ 1$($4$($4*.*@*.*@08K0G   H && 8TZ^^HV[=\=\^b^lmu^v'wxxxx000 ( r%,,i8-LMMMM6))bi"'.J.J)-0)),0N8,D)&& 8TZ^^HV[=\=\^o'pqqqqX%%""Ir5##>????mmm$$i4:>>(TY;Z;Z\`\jks\t%uvvvvU"" ""IxRW9X9XZ^ZhiqZr#stttt""IxRW9X9XZ^ZhiqZr#stttt Z1--... ty-+"=$J^____ H"'JZJZ[_[dJeJefffffr7) NNFFFNNNN) rdrerfrgrr?r r rhrcrirjs@r5rlrls C  c  c  C d d S s s  # 3 c!" c#$ #%& 3'I4@@@@@@F  .!  N+ ^, >* ( ' ' n- n- E[g[g[g[g[g[g[gr7rlceZdZdZfdZdefdefdefdefdefdefd efd efd efd efd efdefdefdefdefdefdefdefdefddefdeffZdZe dZ d#dZ dZ dZ dZe d d!d"ZxZS)$EXEzd Creates the final executable of the frozen app. This bundles all necessary files together. c Xddlm}t|dd_|dd_|dd_|dd _|d d_ |d d_ |d d _ |d d _ |dd _ |dd _|dg_|dd_|dg_|dd _|dd_|dd_|dd_|dd_|dd_|dd _t2rajdd l}|_njdvsJdjt8djnd _|dd _t2r!t8djnd _|d d _|d!o|d"d_ j r(tBs!t8"d#d _ jr(tBs!t8"d$d _jr(tBs!t8"d%g_j r/tBs(t2s!t8"d&d _ jr(tBs!t8"d'd _jd(vrd _n5jd)ksd*jvs d+jvrtGd,jd-|d.dsdd/l$m%}|d0jrNtLj'(|d1tLj')j _ nMtLj'(|d2tLj')j _ tBstTrrj +d3sxj d3z c_ tLj',tLj')j d}n$tLj')j }tLj'(|d1|d4z_-g_.|D]*}t_|t`tbfrt_|t`rEj.2tLj')|j |j d5fnDj.2tLj')|j |j d6fj.3|j4tkj6|rj.3| tod7tq|trrj.2d8j%j.2d9jzd:d;fjrj.2d<j rj.2d=jrj.2d>jr%j.2d?jzd:d;fjrjhd@}j:_j|vrtwdAjdB|j.2dCjd:d;fj r^j dDkrSt_j txrfdEj D_ n =j g_ tBr j srjrdF} ndG} tLj'(tLj'>tLj'>t~dHdI| _ jrdJjvr j@dK_ne=j_tjdL5} | B_d d d n #1swxYwYtjDjjj_j rt_j tjFrnt_j tttLjIfr^=j _ t8 dMj tjJj _ n$todNtqj tjL_MjMddOl$mN} | tr[tLj',jM\} } | dPkr.tjQd dQ\}}xjMdR|dS|dTz c_Mtj._.tj.tLj')jMj-|dUd jjj jjjjV _TjTj4_4UdWtBstTrd3nd:}tLj')||dXfg_VWd S)Ya} args One or more arguments that are either an instance of `Target` or an iterable representing TOC list. kwargs Possible keyword arguments: bootloader_ignore_signals Non-Windows only. If True, the bootloader process will ignore all ignorable signals. If False (default), it will forward all signals to the child process. Useful in situations where for example a supervisor process signals both the bootloader and the child (e.g., via a process group) to avoid signalling the child twice. console On Windows or macOS governs whether to use the console executable or the windowed executable. Always True on Linux/Unix (always console executable - it does not matter there). hide_console Windows only. In console-enabled executable, hide or minimize the console window if the program owns the console window (i.e., was not launched from existing console window). Depending on the setting, the console is hidden/mininized either early in the bootloader execution ('hide-early', 'minimize-early') or late in the bootloader execution ('hide-late', 'minimize-late'). The early option takes place as soon as the PKG archive is found. In onefile builds, the late option takes place after application has unpacked itself and before it launches the child process. In onedir builds, the late option takes place before starting the embedded python interpreter. disable_windowed_traceback Disable traceback dump of unhandled exception in windowed (noconsole) mode (Windows and macOS only), and instead display a message that this feature is disabled. debug Setting to True gives you progress messages from the executable (for console=False there will be annoying MessageBoxes on Windows). name The filename for the executable. On Windows suffix '.exe' is appended. exclude_binaries Forwarded to the PKG the EXE builds. icon Windows and macOS only. icon='myicon.ico' to use an icon file or icon='notepad.exe,0' to grab an icon resource. Defaults to use PyInstaller's console or windowed icon. Use icon=`NONE` to not add any icon. version Windows only. version='myversion.txt'. Use grab_version.py to get a version resource from an executable and then edit the output to create your own. (The syntax of version resources is so arcane that I would not attempt to write one from scratch). uac_admin Windows only. Setting to True creates a Manifest with will request elevation upon application start. uac_uiaccess Windows only. Setting to True allows an elevated application to work with Remote Desktop. argv_emulation macOS only. Enables argv emulation in macOS .app bundles (i.e., windowed bootloader). If enabled, the initial open document/URL Apple Events are intercepted by bootloader and converted into sys.argv. target_arch macOS only. Used to explicitly specify the target architecture; either single-arch ('x86_64' or 'arm64') or 'universal2'. Used in checks that the collected binaries contain the requires arch slice(s) and/or to convert fat binaries into thin ones as necessary. If not specified (default), a single-arch build corresponding to running architecture is assumed. codesign_identity macOS only. Use the provided identity to sign collected binaries and the generated executable. If signing identity is not provided, ad-hoc signing is performed. entitlements_file macOS only. Optional path to entitlements file to use with code signing of collected binaries (--entitlements option to codesign utility). contents_directory Onedir mode only. Specifies the name of the directory where all files par the executable will be placed. Setting the name to '.' (or '' or None) re-enables old onedir layout without contents directory. rr(rFbootloader_ignore_signalsconsoleT hide_consoleNdisable_windowed_tracebackdebugr*rversionmanifest resourcesstriprruntime_tmpdircontents_directory _internal append_pkg uac_admin uac_uiaccessargv_emulationr>arm64x86_64 universal2zUnsupported target arch: zEXE target arch: %srzCode signing identity: %sr upx_availableupxz8Ignoring version information; supported only on Windows!z-Ignoring manifest; supported only on Windows!z.Ignoring resources; supported only on Windows!z3Ignoring icon; supported only on Windows and macOS!z1Ignoring hide_console; supported only on Windows!)r.z../\zERROR: Invalid value "z" passed to `--contents-directory` or `contents_directory`. Exactly one directory level is required (or just "." to disable the contents directory).embed_manifest)RemovedExternalManifestErrorzGPlease remove the 'embed_manifest' argument to EXE() in your spec file.r+distpathz.exerr$rzInvalid argument type for EXE: )zpyi-python-flag Py_GIL_DISABLEDrrzpyi-runtime-tmpdir rr)zpyi-bootloader-ignore-signalsrr)zpyi-disable-windowed-tracebackrr)zpyi-macos-argv-emulationrrzpyi-contents-directory > hide-late hide-early minimize-lateminimize-earlyzInvalid hide_console value: z! Allowed values: zpyi-hide-console NONEc:g|]}|Sr1)_makeabs)r2icrNs r5 z EXE.__init__..Ts%CCC2T]]2..CCCr7zicon-console.icozicon-windowed.ico bootloaderimages<utf-8rbz"Loading version info from file: %rz,Unsupported type for version info argument: )PythonLibraryNotFoundErrorz.arYz (libpythonrz.so)r) rHrr*rrrrrrrrrunr})Xr=r)r>r?r;rrrrrrr*rversrsrcrrrrrrrrrrrrplatformmachiner]r^rrrrr SystemExitr<rr@rArErrendswithrBpkgnamerH isinstancer$rrFextendrD miscutils is_iterable TypeErrortyperlowerrlistrdirname__file__encodeopenreadr create_application_manifestr VSVersionInfostrbytesPathLike load_version_info_from_text_filerget_python_library_path python_librrsys version_infor rlpkg_bootloader_fileexefilesrM)rNargsrPr)rr base_namearg_HIDE_CONSOLE_VALUESicofprr3ext _py_major _py_minorexerVs` r5r?z EXE.__init__rs | ,+++++ !' +=u E E)/4OQV)W)W&zz)T22 "JJ~t<<*0**5QSX*Y*Y'ZZ// JJvt,, JJvt,,  9d33  :t44 K44ZZ// !::mR88$jj)94@@"(**-A;"O"O **\488 K77"JJ~u==%jj)95AA"::mT::  $'#+#3#3#5#5  '+LLLLB0@BBMLL KK-t/? @ @ @ @#D "(,?!F!F  * KK3T5K L L L L%)D "!',?!F!F(EVZZu-E-E = ! ! NNU V V V DM = ! ! NNJ K K K DM > & NNK L L LDN 9 f    NNP Q Q QDI   %V % NNN O O O $D   "i / /&*D # #  $ , ,t7N0N0NRVZ^ZqRqRq')@'''  zz*D11  K K K K K K..Y    T T*%5rw7G7G 7R7RSSDII T*%5rw7G7G 7R7RSSDI  4Y 49%%f-- $ V# (()9)9$))D)DEEaHII((33Iw||D$4i&6HII  Q QC#V}-- Qc3''VHOORW%5%5ch%?%?5$QRRRRHOORW%5%5ch%?%?8$TUUU 01111&s++ Q$$$$ O$s)) O OPPP  O HOOM N N N   * HOO2T5HH"hW X X X  ) M HOOK L L L  * N HOOL M M M   H HOOF G G G  " a HOO69PPRTV^_ ` ` `   U#a#a#a $ 1 7 7 9 9D  (<<< n43DnnXlnn HOOD1BDDb(S T T T 9 7f,,$)T** 7CCCCCCC !]]49556  l9 r<.,CC-CGLL9R9R)S)SUackmpqq } 2$-''$(M$8$8$A$ADMM$(MM$-$@$@DMdmT222b(*  222222222222222'CDMSWSacgctuuDM} ldm[-FGG l UBK/HIIl$(MM$-$@$@DMLL!Et}UUU$/$PQUQ^$_$_DMM#$jSWX\XeSfSf$j$jkkk$;== ? " I I I I I I,,.. .  LW%%do66FAsd{{'*'7';$ 9#K #K#KI#K#K#KK!**G,,T_==**Wd++!2:(("4"4    !H1##EV+Py+P66bQQ'**3//lCD  shhhr*rrrrrrrrrrrrrrrHrrr)mtmNrrctj|jsEtd|jtj|jdS|jsctj|j s?tdtj|j dStj |||rdS|d}|tj |jkr"td|jdS|tj |jjkr"td|jdSdS)Nz Rebuilding %s because %s missingTzRebuilding because %s missingrz(Rebuilding %s because mtimes don't matchz(Rebuilding %s because pkg is more recentF)r@rArr*r]r^ tocbasenamerrrr _check_gutsrmtimerrC)rNdata last_buildrs r5r zEXE._check_gutss/w~~di((  KK:D|| |tzj?|ntBrtGj@|jA} tGj@|} | | kr&tjd#g| | RtGjB|g| Rtd$tGjC||jD|jE|tj|d|tjG||_H||jkr&|tjI||jtd%|jdS)&NzBuilding EXE from %srrXzCopying bootloader EXE to %srzCopying icon to EXEz"Copying version information to EXEzCopying %d resources to EXEzEmbedding manifest in EXEz"Converting EXE to target arch (%s)zBootloader EXE) display_namez PKG archivez-Copying stand-alone PKG archive from %s to %sz2Stand-alone PKG archive will be handled by COLLECTz.sigwbsMEI zPKG sideload signaturez)Appending %s to custom ELF section in EXEobjcopyz --add-sectionzpydata=r)stderrstdoutencodingzobjcopy Failure:  zRemoving signature(s) from EXEz%Modifying Mach-O image UUID(s) in EXEzAppending %s to EXEz#Fixing EXE headers for code signingzFixing EXE headersSOURCE_DATE_EPOCHzRewriting the executable's macOS SDK version (%d.%d.%d) to match the SDK version of the Python library (%d.%d.%d) in order to avoid inconsistent behavior and potential UI issues in the frozen application.zRe-signing the EXEz,Building EXE from %s completed successfully.)Jr*r]r^rr@rArisdirrremovermakedirsrr_MISSING_BOOTLOADER_ERRORMSG_retry_operationshutilcopyfilechmodrr!remove_all_resourcesr CopyIconsrr write_version_info_to_executablelenr_copy_windows_resourcer write_manifest_to_executablerrrosxutilsbinary_to_target_archrrrrErrrwriter subprocessrSTDOUTPIPE returncode SystemErrorrremove_signature_from_binaryupdate_exe_identifier_append_data_to_exefix_exe_for_code_signingintenvironr;timer"set_exe_build_timestampupdate_exe_pe_checksumget_macos_sdk_versionrset_macos_sdk_version sign_binaryrrrr rrename)rN build_namebootloader_exeresource append_file append_typepkg_dst pkgsig_filefcmdpbuild_timestamp pylib_version exe_versions r5rcz EXE.assembles Y  *D,<=== 7>>$) $ $ %w}}TY'' % """" $)$$$w~~bgoodi8899 4 K 22 3 3 3q)!,w~~n-- ;9:: :  2J??? fo~zJJJ bh E:::  h  ! !+"BJ O O OyF"" 1222%%dnj$)LLL} o @AAA%%k&RT^`d`mnnn KK5s4>7J7J K K K N Y Y%%d&A:xXXXX KK3 4 4 4  ! !+"JJX\Xe f f f f  h KKN O O O  *:t7GVf g g g g ? 3(-K'KK( R',,rwz'B'BBGDTDTUYUaDbDbcc KTX]\cddd w7777 PQQQ(-&0Kk4(( 4A2333 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4&K2K ' U KKC[ Q Q Qo/F/F/F SCs:+ > >  -j 9 9 9 9 KK-{ ; ; ;  ! !$":J T T T  ] KK, - - -!"*..1Ddikk"R"RSSO  ! !("BJP_ ` ` `  ! !("A: N N N N  ]%:4?KKM"8DDK{** *-8;H .zJMJJJJ KK, - - -  T-CTE[ \ \ \ bh E:::((*EE  " "  ! !")Z C C C BDDTUUUUUsQ''Q+.Q+cddl}d}td||d}t |dkst |dkrt d|d||d}tj |st d |d  | |d 5d }dddn #1swxYwYn#t$rd }YnwxYw|rtd|t |dkr||dnd}t |dkr||dnd} t |dkr||dnd} tj |||g| g| gdS#t$r} td|| d} ~ wwxYwtd|t |dkrt d|d||d}||d} t |dkr||dnd} |dkrt d|d| dkrt d|d t|d5} | } dddn #1swxYwYtj|| || g| gdS#t$r} td|d| d} ~ wwxYw)NrcF t|S#t$r|cYSwxYwN)r: Exception)values r5_to_intz+EXE._copy_windows_resource.._to_ints7 5zz!     s   zProcessing resource: %r,rXz#Invalid Windows resource specifier z8! Must be in format 'filename,[type],[name],[language]'!zResource file z does not exist!T) fast_loadFz Resource file %r is a PE file...rY*rz&Failed to copy resources from PE file z-Resource file %r is an arbitrary data file...zI! For arbitrary data file, the format is 'filename,type,name,[language]'!zB! For arbitrary data file, resource type cannot be a wildcard (*)!zB! For arbitrary data file, resource ma,e cannot be a wildcard (*)!rzFailed to embed data file z as Windows resource)pefiler]rsplitr+rrr@rAisfilePErSr!copy_resources_from_pe_fileIOErrorrradd_or_update_resource)rNrC resource_specrZrUrE src_filename is_pe_file resource_type resource_name resource_langerr s r5r,zEXE._copy_windows_resources      . >>> &&s++ x==1  H  1 1JmJJJ  }}Xa[11 w~~l++ PNlNNNOO O <488 " "!  " " " " " " " " " " " " " " "   JJJ  9 h LL;\ J J J58MMQ4F4FGGHQK000CM47MMQ4F4FGGHQK000CM47MMQ4F4FGGHQK000CM `7 "O"O"O  ` ` `W|WWXX^__ ` LLH, W W W8}}q   _-___ $GHQK00M#GHQK00M47MMQ4F4FGGHQK000AM## X-XXX## X-XXX h,--%7799D%%%%%%%%%%%%%%%2!"O"O  h h h_<___``fgg hs?C1C% C1%C))C1,C)-C11 D?DF00 G:G  GK)!K6 K)KK) K K)) L 3LL ct|d5}t|d5}tj||ddddn #1swxYwYddddS#1swxYwYdS)Nabri)length)rr% copyfileobj)rNrCrFoutfinfs r5r8zEXE._append_data_to_exes *d # # @tk4(( @C"3Y???? @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @s3AA AA A A AA"%A") max_attemptscd}|j}t|D]} ||cS#t$r}||s||js||dz krNd|dz |z z }td|d|dzd|d|d|dd t j|n>td|d|dzd|d|d td|d |Yd }~d }~wwxYwd S) z Attempt to execute the given function `max_attempts` number of times while catching exceptions that are usually associated with Windows anti-virus programs temporarily locking the access to the executable. ct|trdStrZddlm}ddh}hd}t|t r|j|vrdS|j|vrdSn t||jr |j|vrdSdS)zg Helper to determine whether the given exception is eligible for retry or not. Tr) pywintypes > nF) rPermissionErrorrPyInstaller.compatrrOSErrorerrnowinerrorerror)rgrr_ALLOWED_ERRNO_ALLOWED_WINERRORs r5_is_allowed_exceptionz3EXE._retry_operation.._is_allowed_exceptions!_-- $t $999999 " %%%! a)) $w.00#tz%666#t7:#344$z%666#t5r7rXz Execution of z failed on attempt #z / z: z. Retrying in z.2fz second(s)...rz failed - no more attempts left!N) rdrangerS __context__r]rr<sleep RuntimeError)funcrorr func_nameattemptrgsleep_durations r5r$zEXE._retry_operations " " " HM \** m mG mtT{""" m m m-,Q//8M8Mam8\8\\A---%&,*:W*D%ENNNI IISTIIYeIIijII'5HIIIJ~....NNo ooSTooYeooijooo''dy'd'd'deekll /.... m m ms$ C)B1C$$C)rR)rdrerfrgr?r r rhr  staticmethodrrrcr,r8r$rirjs@r5rrnstttttp  N# .! ^,  ^$ n% ( ^$ ~& >* ' n- n- N#  n% .!  _% ~&3 E8*88\8&]V]V]V~[h[h[hz@@@ 35?m?m?m?m\?m?m?m?m?mr7rc2eZdZdZfdZdZdZdZxZS)COLLECTzM In one-dir mode creates the output folder with all necessary files. c ddlm}t|dd|_|dg|_d|_d|_d|_ d|_ |do|d d|_ tj |d tj |d |_|D]%}t#|t$r|j|_n&t)d g|_|D]}t#|t$r6|jtj |j|jd f|j|j|j|_|j|_|j |_ |j |_ |jD]N\}}}|tj |jdzkr|j|||fO|jsD|jtj |j|jdfOt7j|r|j|t;dt=|t?|j|_| dS)a args One or more arguments that are either an instance of `Target` or an iterable representing TOC list. kwargs Possible keyword arguments: name The name of the directory to be built. rr(rFrTNrrrr*z)No EXE() instance was passed to COLLECT()r}z .manifestrlz#Invalid argument type for COLLECT: )!r=r)r>r?r;rrrrrrrr@rArErr*rrrrrHrFrrDrrrrrrr rM) rNrrPr)rrrr4rVs r5r?zCOLLECT.__init__?s ,+++++ $jj%88!::mR88 !%!%!1Nfjj6N6NGLLj!1273C3CFJJvDVDV3W3WXX  J JC#s## *-*@' HII I U UC#s## U!1!1#(!;!;SX| TUUU 0111"{ #&? ),)>&),)>&58WII1Ix BG$4$4SX$>$>$LLLHh(GHHH~YHOORW%5%5ck%B%BCKQV$WXXX&s++ U$$$$ Sd3ii S STTT!** r7))rHNcdS)NTr1)rNr r s r5r zCOLLECT._check_gutsstr7c t|jtd|j|jD]\}}}|dvrYt j|s:trtd|d|dt d||dt j t j |t jvst j|rt#d|z|dvr&t j|j|}n-t j|j|jpd |}t j|} t j|d n!#t,$rt#d |d wxYw|dvr:t/|||j|j|j|j|j|j|dk }|dkrWt<r:t jjdkr%|t jjd}t j ||n|dkrt j!|std|dtr5t j|rtd|d|dtEj#|||dvs%|dkr4t j$|t j%rt j&|dtd|jdS)NzBuilding COLLECT %s>rr~rrr:rzLERROR: attempting to store file outside of the dist directory: %r. Aborting.)r}rlrT)exist_okz2ERROR: Pyinstaller needs to create a directory at z/, but there already exists a file at that path!)rtrzrtrrrrr~z Resource z is not a valid file!z6Attempting to collect a duplicated file into COLLECT: z (type: ))rtrzr}rxrz+Building COLLECT %s completed successfully.)'rr*r]r^rrHr@rArrrrpardirnormpathr[seprrrErrr"FileExistsErrorrrrrrrrrreplacesymlinkr\r%r&rrr')rNrrr4 dest_pathdest_dirs r5rczCOLLECT.assembleskdi((( )4+;<<<-1XD +D + )Ix888PXAYAY8&$%oh%o%ocl%o%o%opppNNXZbdmyBG,,Y77==bfEEEEW`IaIaE benn000GLLI>> GLLD4K4QrS\]] wy11H  Ht44444"    DDDD  2223"1 - $ 0 $ 0&*&<&*&<,4 ,C   9$$CbgkS00'// TBBH 8Y////\))w~~h//T$%R%R%R%RSSS&27>>)+D+D$oQZoodlooo)444AAA&&29Xrw+G+G&E*** A4CSTTTTTs F''G) rdrerfrgr?rhr rcrirjs@r5rr;sv?????B E HUHUHUHUHUHUHUr7rceZdZdZdZdZdS)MERGEa Given Analysis objects for multiple executables, replace occurrences of data and binary files with references to the first executable in which they occur. The actual data and binary files are then collected only once, thereby reducing the disk space used by multiple executables. Every executable (even onedir ones!) obtained from a MERGE-processed Analysis gains onefile semantics, because it needs to extract its referenced dependencies from other executables into temporary directory before they can run. c:i|_t|_|D]}\}}}||j|\}}||j|\}}t ||_t ||_|xj||zz c_~dS)a args Dependencies as a list of (analysis, identifier, path_to_exe) tuples. `analysis` is an instance of `Analysis`, `identifier` is the basename of the entry-point script (without .py suffix), and `path_to_exe` is path to the corresponding executable, relative to the `dist` directory (without .exe suffix in the filename component). For onefile executables, `path_to_exe` is usually just executable's base name (e.g., `myexecutable`). For onedir executables, `path_to_exe` usually comprises both the application's directory name and executable name (e.g., `myapp/myexecutable`). N) _dependenciesrG _symlinks _process_tocbinariesdatasr rD) rNranalysis identifier path_to_exer binaries_refsr datas_refss r5r?zMERGE.__init__s 26 @ @ -Hj+'+&7&78I;&W&W #Hm $ 1 1(.+ N N E:!.h 7 7H *511HN  ! !]Z%? ? ! ! !! @ @r7c@g}g}|D]}|\}}}|dkr||f} | |jvrKtd||j| ||n0td|||~ ||f} | |jvr)Drgr@r1rr<rr%operatorrrrrrloggingPyInstaller.archive.writersrrPyInstaller.building.datastructr r r r PyInstaller.building.utilsr rrrrrrPyInstaller.building.splashrryrrrrrrrPyInstaller.dependrPyInstaller.depend.analysisrPyInstaller.utils.miscutilsmiscr getLoggerrdr]PyInstaller.utils.win32rrr r!r"PyInstaller.utils.osxosxr.r$rlrrrrrr#r1r7r5rsE   ********&&&&&&IIIIIIIIdddddddddddd/.....llllllllllllllllll((((((======*********  8 $ $ `______________ -,,,,,,,,,pXpXpXpXpX&pXpXpXfGgGgGgGgGg&GgGgGgTJ mJ mJ mJ mJ m&J mJ mJ mZVUVUVUVUVUfVUVUVUr]"]"]"]"]"]"]"]"@   Kr7