
    io                       S r SSKrSSKrSSKrSSKrSSKrSSKrSSKJr  SSK	J
r
Jr  SSK	Jr  SSKJrJr  SSKJrJrJrJr  SSKJrJrJrJrJrJr  SS	KJr  SS
KJ r J!r!J"r"J#r#J$r$J%r%J&r&  SSK'J(r(  SSK)J*r*  SSK+J,s  J-r.  \R^                  " \05      r1\#(       a  SSK2J3r3J4r4J5r5J6r6J7r7  \!(       a	  SSK8J,s  J9r:   " S S\5      r; " S S\5      r< " S S\5      r= " S S\5      r> " S S5      r?Sr@SrASrBg)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)HOMEPATHPLATFORM)log)CArchiveWriterZlibArchiveWriter)Target_check_guts_eqnormalize_pyz_tocnormalize_toc)_check_guts_toc_make_clean_directory_rmtreeprocess_collected_binaryget_code_objectcompile_pymodule)Splash)	is_cygwin	is_darwinis_linuxis_winstrict_collect_modeis_nogilis_aix)	bindepend)get_bootstrap_modules)iconversioninfowinmanifestwinresourcewinutilsc                   B   ^  \ rS rSrSrU 4S jrS\4S\44rS r	Sr
U =r$ )PYZ0   zS
Creates a zlib-based PYZ archive that contains byte-compiled pure Python modules.
c           	        > UR                  S5      (       a  SSKJn  U" S5      eSSKJn  [
        TU ]  5         UR                  SS5      nXPl        Uc4  [        R                  R                  U R                  5      S   S-   U l        [        5       n/ U l        [        R                  R                  US	   S
5      nU HU  u  pXn	U	S:X  a,  [        UUUSSS9n
U R                  R!                  XZU	45        M8  U R                  R!                  XXU	45        MW     [#        S U R                   5       5      n/ U l        0 U l        U H  nUS   R                  [)        U5      5      nUb  U R&                  R+                  U5        U H;  nUu  p_n	U	S;   d   SU S35       eX[;   a  M   U R$                  R!                  U5        M=     M     [-        U R$                  5      U l        U R$                  R/                  5         U R1                  5         g)z
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.CONFnameNz.pyzworkpath	localpycsPYMODULE)optimize
code_cachec              3   :   #    U  H  u  po3S :X  d  M  Uv   M     g7f)r-   N ).0r*   _typecodes       EC:\des-py\RoboSAPF\venv\Lib\site-packages\PyInstaller\building\api.py	<genexpr>PYZ.__init__.<locals>.<genexpr>h   s     $oCT.?dxdnXnTTCTs   	r/   >   r-   
PYMODULE-1
PYMODULE-2zInvalid entry passed to PYZ: !)getPyInstaller.exceptionsr'   PyInstaller.configr)   super__init__r*   ospathsplitexttocfilenamer   dependenciesjoinr   appendsettoc	code_dictidupdater   sort__postinit__)selftocskwargsr'   r)   r*   bootstrap_dependenciesr+   src_pathr4   pyc_pathbootstrap_module_namesrH   r/   entryr3   	__class__s                   r5   r?   PYZ.__init__4   s    ::hH+a  	,zz&$'	<(()9)9:1=FDI "7!8 77<<Z 0+>(>$DH:%+# !!(($()CD !!(($()CD )?$ "%$o4CTCT$o!oCl+//38J%%%j1$)!#KKuOlmrlsstMuuK1&    %TXX. 	    r*   rH   c                    [         R                  SU R                  5        / nU R                   HO  nUu  p4nUS;  a0  X0R                  ;  a!  SSSS.U   n [        X4US9U R                  U'   UR                  U5        MQ     [        U R                  XR                  S9  [         R                  S	U R                  5        g ! [         a     M  f = f)
NzBuilding PYZ (ZlibArchive) %s>   N-r         )r-   r8   r9   )r.   )rI   z5Building PYZ (ZlibArchive) %s completed successfully.)	loggerinfor*   rH   rI   r   SyntaxErrorrF   r   )rN   archive_tocrU   r*   rR   r4   optim_levels          r5   assemblePYZ.assemble   s    3TYY?
 XXE',$DH{*t>>/I+,AQOPXY+:4T_+`DNN4( u%  	$))[NNKKTYYW # s   C
CC)rI   rD   r*   rH   )__name__
__module____qualname____firstlineno____doc__r?   r
   r   _GUTSrb   __static_attributes____classcell__rV   s   @r5   r#   r#   0   s4    L` 
 	 EX XrX   r#   c                      ^  \ rS rSrSr0 SS_SS_SS_SS_S	S
_SS_SS_SS_S S_SS_SS_SS_SS_SS_SS_SS_r         S,U 4S jjrS\4S \4S!\4S"\4S#\4S$\4S%\4S&\4S'\4S(\4S)\44r	S* r
S+rU =r$ )-PKG   z
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-   mr8   r9   PYSOURCEs
PYSOURCE-1s1
PYSOURCE-2s2	EXTENSIONbr#   zaDATAxBINARYZIPFILEZ
EXECUTABLE
DEPENDENCYdSPLASHlSYMLINKnc           
        > [         TU ]  5         [        U5      U l        X l        X@l        X0l        Uc4  [        R                  R                  U R                  5      S   S-   U l        XPl        X`l        Xpl        U=(       d    / U l        Xl        Xl        Xl        U R
                  c5  [$        [$        [$        [$        [$        [$        [$        [&        [&        S.	U l        U R)                  5         g)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)	rw   r{   r}   r   rq   r-   r   r#   r   )r>   r?   r   rH   python_lib_namecdictr*   r@   rA   rB   rC   exclude_binariesstrip_binariesupx_binariesupx_excludetarget_archcodesign_identityentitlements_file
COMPRESSEDUNCOMPRESSEDrM   )rN   rH   r   r*   r   r   r   r   r   r   r   r   rV   s               r5   r?   PKG.__init__   s    @ 	 %.
	<(()9)9:1=FDI 0,(&,"&!2!2 ::'"$(&&$#'DJ 	rX   r*   r   rH   r   r   r   r   r   r   r   r   c                    [         R                  S[        R                  R	                  U R
                  5      5        [        R                  " U R
                  5      R                  5       n/ n/ nU R                   GH  u  pEnUS;  a  [        R                  R                  U5      (       d5  [        (       a  [        SU SU S35      e[         R                  SXT5        Mf  [        R                  " U5      R                  5       U:X  a  [        SU S35      eUS	;   a  U R                  (       a  U R                  R!                  XEU45        M  [#        UUU R$                  U R&                  U R(                  U R*                  U R,                  U R.                  US
:H  S9	nUR!                  XEU R0                  R3                  US5      U R4                  U   45        GMa  US;   a  U R                  (       a   U R                  R!                  XEU45        GM  US:X  a-  [        R6                  " U[        R8                  5      (       a  SnOU R4                  U   nUR!                  XEU R0                  R3                  US5      U45        GM  US:X  a  UR!                  USSS45        GM)  US;   a>  UR!                  XEU R0                  R3                  US5      U R4                  U   45        GMm  US:X  a>  UR!                  SXPR0                  R3                  US5      U R4                  U   45        GM  UR!                  XEU R0                  R3                  US5      U R4                  U   45        GM     UR;                  [=        SS5      S9  [?        U R
                  X#-   U R@                  S9  [         R                  S[        R                  R	                  U R
                  5      5        g )NzBuilding PKG (CArchive) %s>   OPTIONr   r   Non-existent resource , meant to be collected as r:   >Ignoring non-existent resource %s, meant to be collected as %szTrying to collect PKG file z into itself!)r}   rw   rw   	use_stripuse_upxr   r   r   r   strict_arch_validationF)r{   r~   r{   rx   r    o>   r-   rq   r8   r9   rs   ru   r#   zPYZ.pyz   r   )key)
pylib_namez2Building PKG (CArchive) %s completed successfully.)!r]   r^   r@   rA   basenamer*   pathlibPathresolverH   existsr   
ValueErrorwarningr   rD   rF   r   r   r   r   r   r   r   r   r;   	xformdictaccessX_OKrL   r   r   r   )rN   pkg_filebootstrap_tocr`   	dest_namesrc_namer4   carchive_typecodes           r5   rb   PKG.assemble  sD   0"''2B2B4992MN<<		*224-1XX)I BBww~~h//**(+A(Kfgpfqqr)stt\^f ! <<)113x?$'B8*M%Z[[22(( %%,,i8-LM  8 !"&"5"5 $ 1 1$($4$4$($4$4*.*@*@*.*@*@08K0G
 H  &&	TZZ^^HV[=\^b^l^lmu^v'wx00
 ((%%,,i8-LM6)bii"''.J.J -0),0NN8,D)&&	TZZ^^HV[=\^o'pqX%""Ir5##>?mm$$i4::>>(TY;Z\`\j\jks\t%uvU"
 ""IxRW9XZ^ZhZhiqZr#st ""IRW9XZ^ZhZhiqZr#stW .6\ 	Z1-. 	tyy-"=$J^J^_H"''JZJZ[_[d[dJefrX   )r   r   r   r   r*   r   r   r   rH   r   r   )	NNFFFNNNN)rd   re   rf   rg   rh   r   r?   r
   r   ri   rb   rj   rk   rl   s   @r5   rn   rn      sb    	C	
 	c 	c 	C 	d 	d 	S 	s 	s 	 	# 	3  	c!" 	c#$ 	#%& 	3'I4 @F 
 	.!	 	N+	^,	>*	(	'	'	n-	n-E[g [grX   rn   c                      ^  \ rS rSrSrU 4S jrS\4S\4S\4S\4S\4S	\4S
\4S\4S\4S\4S\4S\4S\4S\4S\4S\4S\4S\4S\4SS\4S\44rS r	\
S 5       rS$S jrS rS rS r\
S S!.S" j5       rS#rU =r$ )%EXEik  z\
Creates the final executable of the frozen app. This bundles all necessary files together.
c                    > SSK Jn  [        TU ]  5         UR	                  SS5      U l        UR	                  SS5      U l        UR	                  SS5      U l        UR	                  SS	5      U l        UR	                  S
S5      U l	        UR	                  SS5      U l
        UR	                  SS	5      U l        UR	                  SS	5      U l        UR	                  SS	5      U l        UR	                  SS	5      U l        UR	                  S/ 5      U l        UR	                  SS5      U l        UR	                  S/ 5      U l        UR	                  SS	5      U l        UR	                  SS5      U l        UR	                  SS5      U l        UR	                  SS5      U l        UR	                  SS5      U l        UR	                  SS5      U l        UR	                  SS	5      U l        [2        (       al  U R0                  c  SS	KnUR7                  5       U l        O$U R0                  S;   d   SU R0                   35       e[8        R;                  SU R0                  5        OS	U l        UR	                  SS	5      U l        [2        (       a!  [8        R;                  SU R<                  5        OS	U l        UR	                  S S	5      U l        US!   =(       a    UR	                  S"S5      U l         U R                  (       a'  [B        (       d  [8        RE                  S#5        S	U l        U R                  (       a'  [B        (       d  [8        RE                  S$5        S	U l        U R                  (       a'  [B        (       d  [8        RE                  S%5        / U l        U R                  (       a2  [B        (       d'  [2        (       d  [8        RE                  S&5        S	U l        U R                  (       a'  [B        (       d  [8        RE                  S'5        S	U l        U R&                  S(;   a  S	U l        OIU R&                  S):X  d   S*U R&                  ;   d  S+U R&                  ;   a  [G        S,U R&                   S-35      eUR	                  S.S5      (       d  SS/K$J%n  U" S05      eU R
                  (       aP  [L        RN                  RQ                  US1   [L        RN                  RS                  U R                  5      5      U l        OO[L        RN                  RQ                  US2   [L        RN                  RS                  U R                  5      5      U l        [B        (       d  [T        (       a  U R                  RW                  S35      (       d  U =R                  S3-  sl        [L        RN                  RY                  [L        RN                  RS                  U R                  5      5      S   nO)[L        RN                  RS                  U R                  5      n[L        RN                  RQ                  US1   US4-   5      U l-        / U l.        U GHH  n[_        U[`        [b        45      (       a  [_        U[`        5      (       aP  U R\                  Re                  [L        RN                  RS                  UR                  5      UR                  S545        OOU R\                  Re                  [L        RN                  RS                  UR                  5      UR                  S645        U R\                  Rg                  URh                  5        M  [j        Rl                  " U5      (       a  U R\                  Rg                  U5        GM3  [o        S7[q        U5      < 35      e   [r        (       a  U R\                  Re                  S85        U R$                  b+  U R\                  Re                  S9U R$                  -   S:S;45        U R                  (       a  U R\                  Re                  S<5        U R                  (       a  U R\                  Re                  S=5        U R.                  (       a  U R\                  Re                  S>5        U R&                  (       a+  U R\                  Re                  S?U R&                  -   S:S;45        U R                  (       ay  1 S@knU R                  Ru                  5       U l        U R                  U;  a  [w        SAU R                   SBU 35      eU R\                  Re                  SCU R                   3S:S;45        U R                  (       a  U R                  SD:w  aq  [_        U R                  [x        5      (       a1  U R                   V	s/ s H  oR{                  U	5      PM     sn	U l        O!U R{                  U R                  5      /U l        [B        (       GaT  U R                  (       d{  U R                  (       a  SEn
OSFn
[L        RN                  RQ                  [L        RN                  R}                  [L        RN                  R}                  [~        5      5      SGSHU
5      U l        U R                  (       a  SIU R                  ;   a!  U R                  R                  SJ5      U l        OTU R{                  U R                  5      U l        [        U R                  SK5       nUR                  5       U l        S	S	S	5        [        R                  " U R                  U R*                  U R,                  5      U l        U R                  (       a  [_        U R                  [        R                  5      (       a  O[_        U R                  [        [        [L        R                  45      (       af  U R{                  U R                  5      U l        [8        R                  SLU R                  5        [        R                  " U R                  5      U l        O"[o        SM[q        U R                  5      < 35      e[        R                  " 5       U lM        U R                  c  SSNK$JNn  U" 5       e[        (       ac  [L        RN                  RY                  U R                  5      u  pUSO:X  a2  [        R                  S	SP u  nnU =R                  SQU SRU SS3-  slM        [        U R\                  5      U l.        [        U R\                  [L        RN                  RS                  U R                  5      U RZ                  UR	                  STS	5      U R
                  U R                   U R@                  U R"                  U R0                  U R<                  U R>                  SU9U lT        U R                  Rh                  U l4        U R                  SV[B        (       d  [T        (       a  S3OS:5      n[L        RN                  RS                  U5      USW4/U lV        U R                  5         g	s  sn	f ! , (       d  f       GN)= f)Xa  
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.
r   r(   r   Fbootloader_ignore_signalsconsoleThide_consoleNdisable_windowed_tracebackdebugr*   r   versionmanifest	resourcesstripr   runtime_tmpdircontents_directory	_internal
append_pkg	uac_adminuac_uiaccessargv_emulationr   >   arm64x86_64
universal2zUnsupported target arch: zEXE target arch: %sr   zCode signing identity: %sr   upx_availableupxz8Ignoring 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../\zERROR: 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.exer   r#   r   zInvalid argument type for EXE: )zpyi-python-flag Py_GIL_DISABLEDr   r   zpyi-runtime-tmpdir r   r   )zpyi-bootloader-ignore-signalsr   r   )zpyi-disable-windowed-tracebackr   r   )zpyi-macos-argv-emulationr   r   zpyi-contents-directory >   	hide-late
hide-earlyminimize-lateminimize-earlyzInvalid hide_console value: z! Allowed values: zpyi-hide-console NONEzicon-console.icozicon-windowed.ico
bootloaderimages<utf-8rbz"Loading version info from file: %rz,Unsupported type for version info argument: )PythonLibraryNotFoundErrorz.ar\   z
(libpythonr   z.so)r   )rH   r   r*   r   r   r   r   r   r   r   r   runr   )Xr=   r)   r>   r?   r;   r   r   r   r   r   r   r*   r   versrsrcr   r   r   r   r   r   r   r   r   r   r   r   platformmachiner]   r^   r   r   r   r   r   
SystemExitr<   r   r@   rA   rE   r   r   endswithrB   pkgnamerH   
isinstancer#   r   rF   extendrD   	miscutilsis_iterable	TypeErrortyper   lowerr   list_makeabsdirname__file__encodeopenreadr   create_application_manifestr   VSVersionInfostrbytesPathLike load_version_info_from_text_filer   get_python_library_path
python_libr   r   sysversion_infor   rn   pkg_bootloader_fileexefilesrM   )rN   argsrP   r)   r   r   	base_namearg_HIDE_CONSOLE_VALUESicicofpr   r3   ext	_py_major	_py_minorexerV   s                     r5   r?   EXE.__init__o  s
   | 	, !'

+=u E)/4OQV)W&zz)T2"JJ~t<*0**5QSX*Y'ZZ/
JJvt,	JJvt,	

9d3

:t4K4ZZ/
!::mR8$jj)94@"(**-A;"O **\48  K7"JJ~u= %jj)95A "::mT:9'#+#3#3#5 ''+LL C/0@0@/ABCLKK-t/?/?@#D "(,?!F9KK3T5K5KL%)D"!',?!F (EVZZu-E ==NNUV DM==NNJK DM>>&&NNKLDN99ff		NNPQDIVVNNNO $D""i/&*D#$$,t7N7N0NRVZ^ZqZqRq()@)@(A B' '  zz*D11K.Y    T*%5rww7G7G		7RSDI T*%5rww7G7G		7RSDI 6YY99%%f--		V#	(()9)9$)))DEaHI((3I ww||D$4i&6HIC#V}--c3''HHOORWW%5%5chh%?5$QRHHOORWW%5%5chh%?8$TU 0 01&&s++$"A$s) OPP  8 HHOOMN*HHOO2T5H5HH"hWX))HHOOKL**HHOOLMHHOOFG""HHOO69P9PPRTV^_`#a  $ 1 1 7 7 9D  (<< 243D3D2EEWXlWmn  HHOO01B1B0CDb(ST 99f,$))T**9=C2]]2.C	!]]49956	699<<,C-CGGLL9R)SUackmpq	 }}$--'$(MM$8$8$ADM$(MM$--$@DMdmmT2b(*	 3'CCDMMSWSaSacgctctuDM}}dmm[-F-FGGUBKK/HII$(MM$--$@DMLL!Et}}U$/$P$PQUQ^Q^$_DM#&RSWX\XeXeSfRi$jkk $;;=??"I,.. 6WW%%doo6FAd{'*'7'7';$	9Z	{!I;d#KK !*GG,,T__=**Wd+!22::(((("44"44
 !HH11 ##EVVyy6bQ''**3/lCDe D( 32s   2w9w>>
xr*   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rH   r   r   r   )mtmNr   r   c                 X   [         R                  R                  U R                  5      (       dI  [        R                  SU R                  [         R                  R                  U R                  5      5        gU R                  (       dl  [         R                  R                  U R                  5      (       d>  [        R                  S[         R                  R                  U R                  5      5        g[        R                  " XU5      (       a  gUS   nU[        R                  " U R                  5      :w  a!  [        R                  SU R                  5        gU[        R                  " U R                  R                  5      :  a!  [        R                  SU R                  5        gg)Nz Rebuilding %s because %s missingTzRebuilding because %s missingr
  z(Rebuilding %s because mtimes don't matchz(Rebuilding %s because pkg is more recentF)r@   rA   r   r*   r]   r^   tocbasenamer   r   r   r	   _check_gutsr   mtimer   rC   )rN   data
last_buildr
  s       r5   r  EXE._check_guts  s   ww~~dii((KK:D<L<LbggN^N^_c_h_hNijrww~~dll'C'CKK79I9I$,,9WXd*555k)//$)),,KKBDDTDTU!5!566KKBDDTDTUrX   c                     SSK Jn  [        R                  R	                  U 5      (       a  U $ [        R                  R                  US   U 5      $ )z<
Helper for anchoring relative paths to spec file location.
r   r(   specpath)r=   r)   r@   rA   isabsrE   )rA   r)   s     r5   r   EXE._makeabs  s9    
 	,77==K77<<Z 0$77rX   c                 &   [         (       d  [        (       a  U R                  (       d  US-   nU R                  (       a  US-   nU(       a  X-   n[        R
                  R                  [        SS[        U5      n[        R                  SU-  5        U$ )z?
Pick up the right bootloader file - debug, console, windowed.
w_dPyInstallerr   zBootloader %s)r   r   r   r   r@   rA   rE   r   r   r]   r^   )rN   r  	extensionbootloader_files       r5   r   EXE._bootloader_file  sk    
 6YY<<Ci ::*C/C'',,xhX[\Oo56rX   c                    U R                   n[        R                  SU R                  5        [        R
                  R                  U R                   5      (       ad  [        R
                  R                  U R                   5      (       a  [        U R                   5        O [        R                  " U R                   5        [        R
                  R                  [        R
                  R                  U R                   5      5      (       d=  [        R                  " [        R
                  R                  U R                   5      5        U R                  S   S   n[        R
                  R                  U5      (       d  [        [        5      e[        R                  SU5        U R                  [         R"                  X!5        U R                  [        R$                  US5        [&        (       GaW  U R                  [(        R*                  U5        U R,                  S:w  a?  [        R                  S5        U R                  [,        R.                  XR,                  5        U R0                  (       a?  [        R                  S5        U R                  [2        R4                  XR0                  5        [        R                  S	[7        U R8                  5      5        U R8                   H  nU R                  U R:                  X5        M!     [        R                  S
5        U R                  [<        R>                  XR@                  5        OJ[B        (       a?  [        R                  SU RD                  5        [F        RH                  " XRD                  SS9  U RJ                  (       a  U RL                  R                   nSnGO$U RN                  (       d  [        R
                  RQ                  [        R
                  R                  U5      [        R
                  RS                  U RT                  5      5      n[        R                  SU RL                  R                   U5        [         R"                  " U RL                  R                   U5        O[        R                  S5        U RL                  R                   S-   n[W        US5       nURY                  S5        S S S 5        UnSn[Z        (       a  [        R                  SU5        SSSU 3U/n	[\        R^                  " U	[\        R`                  [\        Rb                  SS9n
U
Rd                  (       a%  [g        SU
Rd                   SU
Rh                   35      eO[B        (       a  [        R                  S5        [F        Rj                  " U5        [        R                  S5        [F        Rl                  " XRL                  R                   5        [        R                  SU5        U Ro                  X5        [        R                  S 5        [F        Rp                  " U5        O2[        R                  SU5        U R                  U Rn                  X5        [&        (       a  [        R                  S!5        [s        [        Rt                  Rw                  S"[x        Rx                  " 5       5      5      nU R                  [z        R|                  X5        U R                  [z        R~                  U5        O[B        (       a  [F        R                  " U R                  5      n[F        R                  " U5      nX:  a0  [        R                  " S#/UQUQ76   [F        R                  " U/UQ76   [        R                  S$5        [F        R                  " XR                  U R                  5        U R                  [        R$                  US5        U R                  [        R                  U5      U lH        XR                   :w  a*  U R                  [        R                  XR                   5        [        R                  S%U R                  5        g ! , (       d  f       GN= f)&NzBuilding EXE from %sr   r[   zCopying bootloader EXE to %s  r   zCopying icon to EXEz"Copying version information to EXEzCopying %d resources to EXEzEmbedding manifest in EXEz"Converting EXE to target arch (%s)zBootloader EXE)display_namezPKG archivez-Copying stand-alone PKG archive from %s to %sz2Stand-alone PKG archive will be handled by COLLECTz.sigwbs   MEI
zPKG sideload signaturez)Appending %s to custom ELF section in EXEobjcopyz--add-sectionzpydata=r   )stderrstdoutencodingzobjcopy Failure:  zRemoving signature(s) from EXEz%Modifying Mach-O image UUID(s) in EXEzAppending %s to EXEz#Fixing EXE headers for code signingzFixing EXE headersSOURCE_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.zRe-signing the EXEz,Building EXE from %s completed successfully.)Jr*   r]   r^   r  r@   rA   r   isdirr   remover   makedirsr   r   _MISSING_BOOTLOADER_ERRORMSG_retry_operationshutilcopyfilechmodr   r    remove_all_resourcesr   	CopyIconsr   r    write_version_info_to_executablelenr   _copy_windows_resourcer   write_manifest_to_executabler   r   r   osxutilsbinary_to_target_archr   r   r   rE   r   r   r   writer   
subprocessr   STDOUTPIPE
returncodeSystemErrorr#  remove_signature_from_binaryupdate_exe_identifier_append_data_to_exefix_exe_for_code_signingintenvironr;   timer!   set_exe_build_timestampupdate_exe_pe_checksumget_macos_sdk_versionr   set_macos_sdk_versionsign_binaryr   r   r   r  r
  rename)rN   
build_namebootloader_exeresourceappend_fileappend_typepkg_dstpkgsig_filefcmdpbuild_timestamppylib_versionexe_versions                 r5   rb   EXE.assemble  s    YY
*D,<,<=77>>$))$$ww}}TYY''		"		$))$ww~~bggoodii899KK		23q)!,ww~~n--9:: 	2J?foo~Jbhh
E:6 !!+"B"BJOyyF"12%%dnnj))L}}@A%%k&R&RT^`m`mnKK5s4>>7JK NN%%d&A&A:X + KK34!!+"J"JJXeXefYKK<d>N>NO**:7G7GVfg ??((--K'K (('',,rwwz'BBGGDTDTUYUaUaDbcKTXX]]\cdw7PQ ((--&0Kk4(A23 ) &K2K8KKC[Qo/F
SCs:+<+<Z___fgA||!$5all^1QXXJ"OPP  Y KK8911*= KK?@**:xx}}E KK-{;$$Z= KK=>--j9 KK-{;!!$":":JT 6 KK,-!"**..1Ddiik"RSO!!("B"BJ`!!("A"A:NY %::4??KM"88DK** -8 ;H
 ..zJMJ KK,-  -C-CTE[E[\ 	bhh
E:((*E"!!"))ZCBDDTDTUo )(s   a  
a/c                 D   SS K nS n[        R                  SU5        UR                  S5      n[	        U5      S:  d  [	        U5      S:  a  [        SU< S35      eU R                  US   5      n[        R                  R                  U5      (       d  [        S	U< S
35      e UR                  USS9   SnS S S 5        W(       a  [        R                  SU5        [	        U5      S:  a  U" US   5      OSn[	        U5      S:  a  U" US   5      OSn	[	        U5      S:  a  U" US   5      OSn
 [        R                  " UUU/U	/U
/5        g [        R                  SU5        [	        U5      S:  a  [        SU< S35      eU" US   5      nU" US   5      n	[	        U5      S:  a  U" US   5      OSn
US:X  a  [        SU< S35      eU	S:X  a  [        SU< S35      e [        US5       nUR!                  5       nS S S 5        [        R"                  " UWUU	/U
/5        g ! , (       d  f       GNu= f! [         a    Sn GNf = f! [         a  n[        SU< 35      UeS nAff = f! , (       d  f       Nr= f! [         a  n[        SU< S35      UeS nAff = f)Nr   c                 >     [        U 5      $ ! [         a    U s $ f = fN)rA  	Exception)values    r5   _to_int+EXE._copy_windows_resource.<locals>._to_int  s%    5z! s   
 zProcessing resource: %r,r[      z#Invalid Windows resource specifier z8! Must be in format 'filename,[type],[name],[language]'!zResource file z does not exist!T)	fast_loadFz Resource file %r is a PE file...r\   *r   z&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 (*)!r   zFailed to embed data file z as Windows resource)pefiler]   r   splitr2  r   r   r@   rA   isfilePEr[  r    copy_resources_from_pe_fileIOErrorr   r   add_or_update_resource)rN   rJ  resource_specrc  r]  rL  src_filename
is_pe_fileresource_typeresource_nameresource_langer  r  s                 r5   r3  EXE._copy_windows_resource  s   	 	.> &&s+x=1H 15m5F GI J  }}Xa[1 ww~~l++~l-==MNOO	<48!
 9
 LL;\J 58MQ4FGHQK0CM47MQ4FGHQK0CM47MQ4FGHQK0CM	`77 "O"O"O LLH,W 8}q  9-9J K^ _ 
 $HQK0M#HQK0M47MQ4FGHQK0AM # 9-9J KW X  # 9-9J KW X 
h,-779D . 22!"O"Om 98 	J	(  ` F|FVWX^__`: .-  h :<:JJ^_`fgghsx   &H9 6H'9H9 3I %I? 1I.$I? '
H61H9 6H9 9I	I	
I+I&&I+.
I<8I? ?
J	JJc                     [        US5       n[        US5       n[        R                  " XCSS9  S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f)Nabr   i   )length)r   r,  copyfileobj)rN   rJ  rM  outfinfs        r5   r?  EXE._append_data_to_exe  sG    *d#tk4(C""3Y? ) $#(( $#s!   AAA
A	A
A    )max_attemptsc                   S nU R                   n[        U5       H	  n U " U6 s  $    g! [         a  nU" U5      (       d  U" UR                  5      (       d  e XQS-
  :  aR  SUS-
  U-
  -  n[        R                  SU< SUS-    SU SU< SUS S	35        [        R                  " U5         SnAM  [        R                  SU< SUS-    SU SU< S
3	5        [        SU< S35      UeSnAff = f)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.
c                 *   [        U [        5      (       a  g[        (       ar  SSKJn  SS1n1 Skn[        U [
        5      (       a$  U R                  U;   a  gU R                  U;   a  g g[        XR                  5      (       a  U R                  U;   a  gg)zO
Helper to determine whether the given exception is eligible for retry or not.
Tr   )
pywintypes      >          n   F)	r   PermissionErrorr   PyInstaller.compatr}  OSErrorerrnowinerrorerror)rp  r}  _ALLOWED_ERRNO_ALLOWED_WINERRORs       r5   _is_allowed_exception3EXE._retry_operation.<locals>._is_allowed_exception  s     !_--9
 "
%!
 a))ww.0# zz%66# 7 	  #3#344zz%66#rX   r[   zExecution of z failed on attempt #z / z: z. Retrying in z.2fz second(s)...r   z  failed - no more attempts left!N)	rd   ranger[  __context__r]   r   rC  sleepRuntimeError)funcrz  r   r  	func_nameattemptrp  sleep_durations           r5   r+  EXE._retry_operation  s/   "	H MM	\*GmT{" +  m -Q//8Mamm8\8\ A--%&,*:W*D%ENNN'	}4HSTUXYeXffhijhm n''5c&:-I JJ~..NN'	}4HSTUXYeXffhijhmmno 'ymCc'dekll%ms   )
C/A9C*28C**C/)r   r   r   r   r   r   r   rD   r   r   r   r   r   r   r   r
  r*   r   r   r   r   r   r   r   rH   r   r   r   r   r   rZ  )rd   re   rf   rg   rh   r?   r
   r   ri   r  staticmethodr   r   rb   r3  r?  r+  rj   rk   rl   s   @r5   r   r   k  s   tp	 
 	N#	.!	^,	 	^$	n%	(	^$	~&	>*	'	n-	n-	N#		n%	.!		_%	~&3E8* 8 8&]V~[hz@
 35 ?m ?mrX   r   c                   <   ^  \ rS rSrSrU 4S jrSrS rS rSr	U =r
$ )COLLECTi8  zE
In one-dir mode creates the output folder with all necessary files.
c                 n  > SSK Jn  [        TU ]  5         UR	                  SS5      U l        UR	                  S/ 5      U l        SU l        SU l        SU l	        SU l
        US   =(       a    UR	                  S	S5      U l        [        R                  R                  US
   [        R                  R                  UR	                  S5      5      5      U l        U H+  n[#        U[$        5      (       d  M  UR&                  U l          O   [)        S5      e/ U l        U GH  n[#        U[$        5      (       Ga  U R*                  R-                  [        R                  R                  UR                   5      UR                   S45        U R*                  R/                  UR0                  5        UR                  U l        UR                  U l        UR                  U l	        UR                  U l
        UR*                   HU  u  pVnU[        R                  R                  UR                   5      S-   :X  d  M8  U R*                  R-                  XVU45        MW     UR2                  (       dR  U R*                  R-                  [        R                  R                  UR4                  5      UR4                  S45        GM  GM  [6        R8                  " U5      (       a  U R*                  R/                  U5        GM  [;        S[=        U5      < 35      e   [?        U R*                  5      U l        U RA                  5         g)z
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.
r   r(   r   Fr   TNr   r   r   r*   z)No EXE() instance was passed to COLLECT()r   z	.manifestrn   z#Invalid argument type for COLLECT: )!r=   r)   r>   r?   r;   r   r   r   r   r   r   r   r@   rA   rE   r   r*   r   r   r   r   rH   rF   r   rD   r   r   r   r   r   r   r   rM   )	rN   r   rP   r)   r   r   r   r4   rV   s	           r5   r?   COLLECT.__init__<  sR    	,$jj%8!::mR8!%!% !1Nfjj6N GGLLj!12773C3CFJJvDV3WX	C#s##*-*@*@' 
 HIIC#s##!1!1#((!;SXX| TU 0 01"{{#&?? ),)>)>&),)>)>&58WW1I BGG$4$4SXX$>$LLh(GH 6= ~~HHOORWW%5%5ckk%BCKKQV$WX &&&s++$"Ed3i] STT- 2 !*rX   ))rH   Nc                     g)NTr1   )rN   r  r  s      r5   r  COLLECT._check_guts  s    rX   c                 t   [        U R                  5        [        R                  SU R                  5        U R
                   GH4  u  pnUS;  aY  [        R                  R                  U5      (       d5  [        (       a  [        SU SU S35      e[        R                  SX!5        Mf  [        R                  [        R                  R                  U5      R                  [        R                  5      ;   d$  [        R                  R!                  U5      (       a  [#        SU-  5      eUS;   a+  [        R                  R%                  U R                  U5      nO>[        R                  R%                  U R                  U R&                  =(       d    S	U5      n[        R                  R)                  U5      n [        R*                  " US
S9  US;   aP  [/        UUU R0                  U R2                  U R4                  U R6                  U R8                  U R:                  US:H  S9	nUS:X  aj  [<        (       aH  [        R                  R                  S:X  a*  UR?                  [        R                  R                  S5      n[        R@                  " X$5        OUS:w  a  [        R                  RC                  U5      (       d  [        SU< S35      e[        (       a6  [        R                  R                  U5      (       a  [        SU SU S35      e[D        RF                  " X$5        US;   d6  US:X  d  GM  [        RH                  " U[        RJ                  5      (       d  GM  [        RL                  " US5        GM7     [        R                  SU R                  5        g ! [,         a    [#        SU< S35      ef = f)NzBuilding COLLECT %s>   r   r   r   r   r:   r   zLERROR: attempting to store file outside of the dist directory: %r. Aborting.)r   rn   r   T)exist_okz2ERROR: Pyinstaller needs to create a directory at z/, but there already exists a file at that path!)rw   r}   rw   r   r   r   r   r   z	Resource z is not a valid file!z6Attempting to collect a duplicated file into COLLECT: z (type: ))rw   r}   r   r{   r  z+Building COLLECT %s completed successfully.)'r   r*   r]   r^   r  rH   r@   rA   r   r   r   r   pardirnormpathrd  sepr  r   rE   r   r   r)  FileExistsErrorr   r   r   r   r   r   r   r   replacesymlinkre  r,  r-  r   r   r.  )rN   r   r   r4   	dest_pathdest_dirs         r5   rb   COLLECT.assemble  s   dii()4+;+;<-1XX)I 88PXAYAY&&$'=hZGbclbmmn%oppNNXZb yyBGG,,Y7==bffEEW`IaIa benn  00GGLLI>	GGLLD4K4K4QrS\]	wwy1HHt4 223"11 -- $ 0 0 $ 0 0&*&<&<&*&<&<,4,C
 9$ 6bggkkS0'//TBH

8/\)ww~~h//$y<Q%RSS&&277>>)+D+D$PQZP[[cdlcmmno  4AA&299Xrww+G+GE*I .6J 	A4CSCSTW #  H UD D s   7NN7)
r   r   r   r   r*   r   r   rH   r   r   )rd   re   rf   rg   rh   r?   ri   r  rb   rj   rk   rl   s   @r5   r  r  8  s(    ?BE
HU HUrX   r  c                   $    \ rS rSrSrS rS rSrg)MERGEi  a  
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                 .   0 U l         [        5       U l        U Hy  u  p#nU R                  UR                  U5      u  pVU R                  UR
                  U5      u  px[        U5      Ul        [        U5      Ul        U=R                  Xh-   -  sl        M{     g)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_tocbinariesdatasr   rD   )	rN   r   analysis
identifierpath_to_exer  binaries_refsr  
datas_refss	            r5   r?   MERGE.__init__  s       26-H+ '+&7&78I8I;&W#H $ 1 1(..+ NE !.h 7H*51HN!!]%??!! 26rX   c                    / n/ nU GH{  nUu  pgnUS:X  a  Xg4n	XR                   ;  aC  [        R                  SU5        U R                   R                  U	5        UR	                  U5        O'[        R                  SU5        UR	                  U5        A	M  Xg4n	XR
                  ;  a7  [        R                  SX5        X R
                  U	'   UR	                  U5        M  [        R                  R                  U R
                  U	   [        R                  R                  U5      5      n
U
R                  U5      (       a  [        R                  SXU
5        GMQ  [        R                  SXU
5        UR	                  XjS45        GM~     X44$ )Nr   z/Keeping symbolic link %r entry in original TOC.z0Moving symbolic link %r entry to references TOC.z"Adding dependency %r located in %szKIgnoring self-reference of %r for %s, located in %s - duplicated TOC entry?z7Referencing %r to be a dependency for %s, located in %sr   )r  r]   r   addrF   r  r@   rA   relpathr   r   )rN   rH   r  toc_keeptoc_refsrU   r   r   r4   r   dep_paths              r5   r  MERGE._process_toc  s^    E,1)I
 9$)nn,LL!RTYZNN&&s+OOE* LL!SUZ[OOE*
 %C,,,A3T*5""3'& 77??4+=+=c+BBGGOOT_D`a $$[11LLegj 
 VX[jrs l CD] ` !!rX   )r  r  N)rd   re   rf   rg   rh   r?   r  rj   r1   rX   r5   r  r    s    @@5"rX   r  FTzFatal error: PyInstaller does not include a pre-compiled bootloader for your
platform. For more details and instructions how to build the bootloader see
<https://pyinstaller.readthedocs.io/en/stable/bootloader-building.html>)Crh   r@   r8  r   rC  r   r,  operatorr   r  r   r   r   loggingPyInstaller.archive.writersr   r   PyInstaller.building.datastructr	   r
   r   r   PyInstaller.building.utilsr   r   r   r   r   r   PyInstaller.building.splashr   r  r   r   r   r   r   r   r   PyInstaller.dependr   PyInstaller.depend.analysisr   PyInstaller.utils.miscutilsmiscr   	getLoggerrd   r]   PyInstaller.utils.win32r   r   r   r    r!   PyInstaller.utils.osxosxr5  r#   rn   r   r  r  r   r   r*  r1   rX   r5   <module>r     s    
  
     * & I d d  / l l l ( = * *			8	$	__,,nX& nXbGg& GgTJm& JmZVUf VUr]" ]"@ 
 K rX   