
    i\1                    b   S r SSKJ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  SSK
Jr  SSK
Jr   SSKJr  \R$                  " \5      r " S
 S\R*                  5      rS rS rS r " S S\R4                  5      rSS jrSSS jjrS rS r\S:X  a  \" 5         gg! \ a    S	 r Nqf = f)z-
Main command-line interface to PyInstaller.
    )annotationsN)defaultdict__version__)log)compat)autocompletec                    g N parsers    AC:\des-py\RoboSAPF\venv\Lib\site-packages\PyInstaller\__main__.pyr	   r	       s        c                  (   ^  \ rS rSrU 4S jrSrU =r$ )_SmartFormatter,   c                t   > UR                  S5      (       a  USS  R                  5       $ [        TU ]  X5      $ )NzR|   )
startswith
splitlinessuper_split_lines)selftextwidth	__class__s      r   r   _SmartFormatter._split_lines-   s9    ??4  8&&(( 7'44r   r   )__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__r   s   @r   r   r   ,   s    5 5r   r   c                   US   S S  n/ =o1S'   U H1  nUR                  UR                  [        R                  5      5        M3     SS KnUR
                  R                  R                  " U 40 UD6n[        R                  SU-  5        U$ )Npathexr   zwrote %s)
extendsplitospathsepPyInstaller.building.makespecbuildingmakespecmainloggerinfo)	filenamesopts	temppathsr'   pPyInstaller	spec_files          r   run_makespecr8   6   s|    Xq!I  F(^aggbjj)*  )$$--229EEI
KK
Y&'r   c                Z    SS K nUR                  R                  R                  " X40 UD6  g )Nr   )PyInstaller.building.build_mainr-   
build_mainr/   )
pyi_configr7   kwargsr6   s       r   	run_buildr>   D   s$    *##((I&Ir   c                2    U R                  SSS[        SS9  g )Nz-vz	--versionversionz#Show program version info and exit.)actionr@   help)add_argumentr   r   s    r   __add_optionsrD   I   s$    
2  r   c                  J   ^  \ rS rSrU 4S jrSSS jjrS rSS	S jjrSrU =r	$ )
_PyiArgumentParserS   c                N   > [        [        5      U l        [        TU ]  " U0 UD6  g r   )r   list_pyi_action_groupsr   __init__)r   argsr=   r   s      r   rK   _PyiArgumentParser.__init__T   s"    "-d"3$)&)r   c                    [        [        U S/ 5      5      nU" U 5        [        U S/ 5      US nU R                  U   R                  U5        g)zU
Mutate self with the given callable, storing any new actions added in a named group
_actionsN)lengetattrrJ   r(   )r   _PyiArgumentParser__add_optionsnamen_actions_beforenew_actionss        r   _add_options_PyiArgumentParser._add_optionsX   sP     wtZ<=ddJ34D4EF%,,[9r   c                    UR                    Vs/ s H  o"R                  S5      (       d  M  UPM     nnU(       a  SR                  U5      nU$ UR                   S   nU$ s  snf )z
Get the option name(s) associated with an action

For options that define both short and long names, this function will
return the long names joined by "/"
--/r   )option_stringsr   join)r   rA   rS   	longnamess       r   _option_name_PyiArgumentParser._option_namea   s^     '-&;&;U&;dt?TT&;	U88I&D  ((+D Vs
   AAc                   [        [        5      nU R                  U    H\  nUR                  nU R	                  U5      n[        X5      U R                  U5      Ld  M?  Xd;   a  XF==   S-  ss'   XF==   U-  ss'   M^     U(       a?  SnUR                  UR                  5       5      n	U(       a  SU-   n[        SU U	 U 35      eg)z(Forbid options from a named action grouprZ   z
  
zERROR: option(s) not allowed:N)
r   strrJ   destr^   rQ   get_defaultr\   values
SystemExit)
r   rL   grouperrmsgoptionsrA   rc   rS   sepbads
             r   _forbid_options"_PyiArgumentParser._forbid_optionso   s    c"--e4F;;D$$V,Dt"$*:*:4*@@?MS(M% 5 C((7>>+,C<SE#vhOPP r   )rJ   ) )rR   callablerS   rb   )rL   zargparse.Namespacerg   rb   rh   rb   )
r   r    r!   r"   rK   rV   r^   rl   r#   r$   r%   s   @r   rF   rF   S   s    *:Q Qr   rF   c                    SSK n SSKn SSKn [        [        S9nSUl        UR                  [        5        UR                  U R                  R                  R                  SS9  UR                  U R                  R                  R                  SS9  UR                  U R                  R                  SS9  UR                  S	S
SSS9  U$ )z6
Build an argparse parser for PyInstaller's main CLI.
r   N)formatter_classpyinstallerr.   )rS   r;   r   r2   
scriptname+zName of scriptfiles to be processed or exactly one .spec file. If a .spec file is specified, most options are unnecessary and are ignored.)metavarnargsrB   )r:   r,   PyInstaller.logrF   r   progrV   rD   r-   r.   r;   r   rC   )r6   r   s     r   generate_parserry      s    
 +(@FFK
&
,,55CC*U
,,77EELY
55EB
3	   Mr   c                >   [         R                  " 5         [        5         SSKn[        R
                  n [        5       n[        U5        U c  [        R
                  SS n  U R                  S5      nUR                  U SU 5      nXS-   S nUR                  R                  XF5         SSKJn  ["        R%                  S[        U5        ["        R%                  S[&        R(                  " 5       [         R*                  (       a  S	OS
5        ["        R%                  S[&        R&                  " 5       5        ["        R%                  S[        R,                  5        UR.                  S   R1                  S5      (       a!  UR3                  USSS9  UR.                  S   n	O[UR.                   H7  n
[4        R6                  R9                  U
5      (       a  M)  [;        SU
< S35      e   [=        S0 [?        U5      D6n	U	/UQ[        l        [A        X40 [?        U5      D6  U[        l        g! [         a    [        U 5      n GNf = f! [          a    Sn GNf = f! [B         a    [;        S5      e[D         a    SSK#J$n  URK                  5          Nqf = f! U[        l        f = f)z
pyi_args     allows running PyInstaller programmatically without a subprocess
pyi_config   allows checking configuration once when running multiple tests
r   N   rY   r   unknownz"PyInstaller: %s, contrib hooks: %szPython: %s%sz (conda)rn   zPlatform: %szPython environment: %sz.specr.   z5makespec options not valid when a .spec file is given)rg   rh   zERROR: Script file z does not exist.zAborted by user request.)_recursion_too_deep_messager   )&r   check_requirementscheck_unsafe_privilegesrw   sysargvry   r	   index
ValueErrorrP   
parse_argsr   __process_options_pyinstaller_hooks_contribr   	Exceptionr0   r1   platformpython_versionis_condaprefixr2   endswithrl   r*   pathisfilerf   r8   varsr>   KeyboardInterruptRecursionErrorr6   r}   raise_with_msg)pyi_argsr<   r6   old_sys_argvr   r   rL   	spec_argscontrib_hooks_versionr7   filenamer}   s               r   runr      s*   
 88L4  "Vxx|H	"NN4(E   &5!12QYZ(	))&7	.W 	8+G\]NH$;$;$=V__zbdeNH$5$5$78,cjj9 >>!%%g..""J/f #  q)I !NNww~~h//$':8,FV%WXX + %2tDz2I*	**64:6  [  	"ME	"  	.$-!	.:  5344 5;#2245  ss   +I !H& 26I )I /DI A	I &H?;I >H??I II II 4J	J JJ Jc                     [         R                  R                  [        R                  S   5      S;   a  [        R                  R	                  S5        [        5         g )Nr   )binScripts)r*   r   basenamer   popr   r   r   r   _console_script_runr      s8     
ww$(::QEr   c            
     b   [         R                  (       Ga`  [         R                  (       GdJ  SSKn U R	                  S5      nU R	                  S5      nU R
                  UR                  l        UR                  5       nU R                  5       n SnUR                  U R                  U5      XPR                  U5      5      (       d   eU R                  5       nSnUR                  XGU R                  U5      U R                  U5      U R                  U R                  5       5      5      (       d   e UR                  U5        UR                  S:X  a$  [        R!                  ["        R$                  S5        O[         R&                  (       d  [         R(                  (       a`   [*        R,                  " 5       n[*        R0                  " 5       S:X  a1  U(       a*  US
:w  a$  [        R!                  ["        R$                  S5        [         R                  (       a  [2        R4                  R7                  5       n	 [         R8                  R;                  5       n
U
c  SO#[2        R4                  " U
5      R?                  5       n
X:H  =(       d    XR@                  ;   nU(       aB  [2        R4                  RC                  5       R?                  5       nX:X  d  XR@                  ;   a  SnU(       a  [E        SU	 S35      egg! UR                  U5        f = f! [.         a    S	n GNdf = f! [<         a    Sn
 Nf = f)zA
Forbid dangerous usage of PyInstaller with escalated privileges
r   NzAdvapi32.dllzkernel32.dll      r   zRunning PyInstaller as admin is not necessary nor sensible. Run PyInstaller from a non-administrator terminal. PyInstaller 7.0 will block this.rn   rootz}Running PyInstaller as root is not necessary nor sensible. Do not use PyInstaller with sudo. PyInstaller 7.0 will block this.Fz#ERROR: Do not run pyinstaller from z. cd to where your code is and run pyinstaller from there. Hint: You can open a terminal where your code is by going to the parent folder in Windows file explorer and typing cmd into the address bar.)#r   is_winis_win_winectypesCDLLc_void_pGetCurrentProcessrestypeOpenProcessTokenbyrefc_intGetTokenInformationsizeofCloseHandlevaluer0   r   loggingDEPRECATION	is_darwinis_linuxr*   getloginOSErrorgetuidpathlibPathcwdwin32apiGetWindowsDirectoryr   resolveparentshomerf   )r   advapi32kernel32processtokenTOKEN_QUERYelevation_typeTokenElevationTypeuserr   win_dirinside_win_dirhome_dirs                r   r   r      s    }}}V/// 	;;~.;;~.-3__""*,,.!	(K,,V__W-E{T`T`afTghhhh#\\^N!#//6<<+GWeIfV\\^,   
   '1$JJ##= 
		V__	;;=D 99;!JJ##3 }}ll 	oo99;G "/$w||G/D/L/L/NA7kk+A ||((*224H(kk"9!&5cU ;@ @  ' 7   '$  	D	  	G	s1   B!K6 "L 5L 6L	LLL.-L.__main__)returnrF   )NN)r   zlist | Noner<   zdict | None) __doc__
__future__r   argparser*   r   r   r   collectionsr   r6   r   r   r   r   argcompleter	   ImportError	getLoggerr   r0   HelpFormatterr   r8   r>   rD   ArgumentParserrF   ry   r   r   r   r   r   r   <module>r      s    #  	  
  # # & ( 
		8	$5h,, 5J
.Q00 .Qb8? D
Sl zE E	  s   B" "	B.-B.