+
    Ki}  c                   s&   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHtHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHtHtHt ^ RIHt ^ RIHtH t H!t!H"t" ^ RI#H$t$H%t% ^ RI&H't' ^ RI(H)t) ^ RI*H+t+H,t,H-t-  ! R R4      t.R# )zCommands for installer scriptsN)gettext)Path)runtime)is_file_in_custom_cache)MissingExecutableErrorUnspecifiedVersionError)ScriptingErrorLutrisInstaller)MonitoredCommand)InvalidRunnerErrorimport_runnerimport_task)wine)extractlinuxselective_mergesystem)EvilConfigParserMultiOrderedDict)schedule_repeating_at_idle)logger)WINE_DEFAULT_ARCHget_default_wine_versionget_wine_path_for_versionc                   s  a  ] tR t^t o Rt]tV 3R lR ltR t]	R 4       t
R tR tR tR	 tR
 tR tR&R ltR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R'R lt#R  t$R'R! lt%R" t&R# t'V 3R$ lt(R%t)V t*R# )(CommandsMixinz?The directives for the `installer:` part of the install script.c                s    < V ^8  d   QhRS[ /# )   Zreturn)strformat__classdict__   ">/usr/lib/python3.14/site-packages/lutris/installer/commands.py__annotate__CommandsMixin.__annotate__!   s      s     c                s   V P                  V P                  P                  4      ! 4       pVP                  V P                  RR7      pV'       d   \	        V4      pV# V P                  P                  R8X  d8    \
        P                  ! 4       w  rE\	        WEP                  R,          R7      pV# \        4       p\	        V4      pV#   \         d     L$i ; i)zmReturn absolute path of wine version used during the installation, but
None if the wine exe can't be located.F)Zuse_runner_configr   )Zconfig)
get_runner_class	installerrunnerZget_installer_runner_versionr   r   Zget_runner_version_and_configZrunner_levelr   r   )selfr&   Zversion	wine_pathZconfig_versionZrunner_configs   &     r    get_wine_pathZCommandsMixin.get_wine_path!   s     &&t~~'<'<=?55dnnX]5^1':I >>  F*040R0R0T-5nMgMghnMop	   +,-g6	 + s   95C CCc                s|     \        V4      pV#   \         d"   p\        \        R4      T,          4      ThRp?ii ; i)z%Runner the runner class from its namezInvalid runner provided %sN)r   r
   r   _)r'   runner_namer&   err   &&  r    r$   ZCommandsMixin.get_runner_class8   sF    	Y";/F  " 	Y #?!@;!NOUXX	Ys    ;6;c                s   \        V \        4      '       d   V .p V  F  p\        V\        4      '       d_   RpV F  pWQ9   g   K  RpK  	  V'       g@   \        \	        R4      P                  \	        R4      P                  V4      VR7      VR7      hKw  W19  g   K  \        \	        R4      P                  W2R7      VR7      h	  R	# )
z>Verify presence of a list of parameters required by a command.FTz<One of {params} parameter is mandatory for the {cmd} commandz or )paramscmdZfaulty_dataz8The {param} parameter is mandatory for the {cmd} command)paramr/   N)
isinstancer   Ztupler   r*   r   join)r.   Zcommand_dataZcommand_namer1   Zparam_presentkeys   &&&   r    _check_required_paramsZ$CommandsMixin._check_required_params@   s     fc""XFE%'' % C*(, ! %(XY``#$V9>>%#8l a  %1	  % ,(TU\\"' ]  %1	  r#   c                s    V P                  V4      p\        P                  ! V4      '       g   \        \	        R4      V,          4      h\        P
                  ! V4       R# )zMake filename executablez+Invalid file '%s'. Can't make it executableN)_substituter   path_existsr   r*   make_executable)r'   filename   &&r    chmodxZCommandsMixin.chmodx[   sH    ##H-!!(++ #P!QT\!\]]x(r#   c           
     s   . pRpRp/ p\        V\        4      '       Ed   V P                  R.VR4       RV9   d   RV9   d   \        \	        R4      VR7      hRV9   d   VP                  R4      pMRpVP                  RR	4      pVP                  RR	4      pVP                  R
R	4      p	\        P                  ! V	4       F#  p
VP                  V P                  V
4      4       K%  	  VP                  R4      pVP                  R4      pVP                  R4      '       g%   VP                  \        P                  ! 4       4       VP                  V P                  4       VP                  R4      ;'       g    / pTP                  VP                  4        UUu/ uF  w  rWP                  V4      bK  	  upp4       \        P                  ! VP                  RR	4      4      p\        P                  ! VP                  RR	4      4      pM3\        V\         4      '       d   Tp. p. pM\        \	        R4      VR7      hV'       d6   RpRV P#                  VP%                  4       4      .pVP                  R4       MV P#                  X4      p\&        P(                  ! V4      '       dJ   \&        P*                  ! V4      '       g.   \,        P.                  ! RV4       \&        P0                  ! V4        \&        P2                  ! V4      pT'       d   \6        P8                  ! 4       pT'       d&   \:        P<                  P?                  T4      '       g   T P@                  p\C        T.T,           TTTTTR7      pXTn"        TPG                  4        T PH                  PK                  T4       \M        T PN                  TRR7       R# u uppi   \4         d"   p\        \	        R4      T,          4      ThRp?ii ; i)zRun an executable file.NfilecommandexecutezRParameters file and command can't be used at the same time for the execute commandr0   return_code0 argsterminalworking_dirZdisable_runtimeenvinclude_processesexclude_processesz*No parameters supplied to execute command.Zbashz-czMaking %s executablezUnable to find executable %s)rE   ZtermZcwdrF   rG         ?Zinterval_secondsSTOP)r<   r=   )(r2   dictr5   r   r*   popgetshlexsplitappendr6   Zupdater   Zget_env
script_envitemsr   _get_file_pathstripr   r7   Zis_executabler   warningr8   Zfind_required_executabler   r   Zget_default_terminalospathexiststarget_pathr	   accepted_return_codeZstartinterpreter_ui_delegate
attach_logr   _monitor_task)r'   datarB   rC   rD   rE   r?   Z	exec_pathr=   Zargs_stringZargZ	local_envr4   valuerF   rG   Zexec_abs_pathZexs   &&                r    r>   ZCommandsMixin.executeb   s9   dD!!'')<(=tYOD Vt^$jk $  $"hh}5!,Ihhy"-G((62.K{{;/D,,S12 0xx
+H((=1K88-..

7??,- JJt' --2IJJyGXYGX--e44GXYZ %DHH5H",M N %DHH5H",M Nc""G " " #O!P^bccI$--gmmo>?D$$V, ++I6Ii((1E1Ei1P1PNN19=""9-	X";;IFM 113H"''.."="=**K"Od"//
 (3$$$//8"4#5#5wQTUY Z. & 	X #A!BY!NOUWW	Xs   O 
/O O2O--O2c                sZ   V P                  R.VR4       VP                  R4      ;'       g    VP                  R4      pV P                  V4      p\        P                  P                  V4      '       d   V.pM\        P                  ! V4      pV'       g   \        \        R4      V,          4      hRV9   d   V P                  VR,          4      pMV P                  pV F  p\        R4      \        P                  P                  V4      ,          p\        P                  ! V4       V P                  P                  V4       RV9  pVP                  R4      p	\        P                  ! R	We4       V P!                  \"        P$                  WeW4       K  	  \        P                  ! R
4       R# )z0Extract a file, guessing the compression method.r<   srcr   z%s does not existdstzExtracting %sZnomerger   zextracting file %s to %szExtract doneN)r<   r`   )r5   rM   rS   rV   rW   rX   globr   r*   r6   rY   basenamer   debugr[   Zreport_status_killable_processr   Zextract_archive)
r'   r^   Z	src_paramZfilespecZ	filenames	dest_pathr9   ZmsgZmerge_single	extractors
   &&        r    r   ZCommandsMixin.extract   sB   ##_$5tYGHHV$77	&&y177>>(##!
I		(+I #6!7(!BCCD=((e5I((I!HO$rww'7'7'AACLL((66s;$D0L*ILL3XI""7#:#:HQ]i " 	^$r#   c                s   V P                  RVR4       VP                  R4      pV'       d
   RV,          MRpVR,          pV P                  VP                  RR4      4      pV P                  P	                  W4WPP
                  4       R# )	z9Display an input request as a dropdown menu with options.options
input_menuZidzINPUT_%sN	preselectrA   rJ   )r5   rM   r6   r[   Zbegin_input_menu_on_input_menu_validated)r'   r^   Z
identifieraliasrh   rj      &&    r    ri   ZCommandsMixin.input_menu   sr    ##It\BXXd^
+5
Z'4y/$$TXXk2%>?	$$55eiQnQnor#   c                s    VP                  4       pV'       d2   V P                  P                  R VRV/4       V P                  4        R# \	        R4      h)rl   r_   zMA required input option was not selected, so the installation can't continue.N)Zget_active_idZuser_inputsrP   _iter_commandsRuntimeError)r'   rl   ZmenuZchoosen_options   &&& r    rk   Z&CommandsMixin._on_input_menu_validated   sH    ++-##WeWn$MN!noor#   c                s   V P                  RVR4       VP                  R4      pVP                  R\        R4      4      pV\        R4      V,          ,          pV P                  P	                  W2V P
                  V P                  4       R# )z&Request user to insert an optical discrequiresinsert_discmessagezoInsert or mount game disc and click Autodetect or
use Browse if the disc is mounted on a non standard location.zi

Lutris is looking for a mounted disk drive or image 
containing the following file or folder:
<i>%s</i>rJ   )r5   rM   r*   r[   Zbegin_disc_promptr%   _find_matching_disc)r'   r^   rp   rr   r-   r    rq   ZCommandsMixin.insert_disc   s    ##JmD88J'((P
 	
 	
 	$$66w$..Z^ZrZrsr#   Nc                s   V'       d   V.pM\         P                  ! 4       pV F  p\        P                  P	                  WR4      p\         P
                  ! V4      p\         P                  ! V4      '       g   KV  \        P                  ! R W%4       WPn	        V P                  4         R# 	  \        \        R4      V,          4      h)zFound %s on cdrom %sNz,The required file '%s' could not be located.)r   Zget_mounted_discsrV   rW   r3   Zfix_path_caser7   r   rd   	game_discrn   ro   r*   )r'   Z_widgetrp   Z
extra_pathZdrivesZdriveZrequired_abspaths   &&&&   r    rs   Z!CommandsMixin._find_matching_disc   s     \F--/FE!ww||E<%334DE!!"2333XE!&##%  1KLxWXXr#   c                s    V P                  V4      p \        P                  ! V4       \        P                  ! RV4       R#   \
         d    \        P                  ! RT4        R# i ; i)zCreate directoryzCreated directory %szDirectory %s already existsN)r6   rV   makedirsr   rd   OSError)r'   	directoryr:   r    mkdirZCommandsMixin.mkdir  sV    $$Y/		<KK	" LL/;  	CLL6	B	Cs   A "A('A(c                s   V P                  RR.VR4       V P                  V4      w  r#\        P                  ! RW#4       \        P
                  P                  V4      '       gM   VP                  R4      '       d   \        P                  ! RV4       R# \        \        R4      V,          V4      h\        P                  ! VR	R
7       \        P
                  P                  V4      '       d   \        P
                  P                  V4      V8w  d!   V P                  \        P                   W#4       VR,          V P"                  P%                  4       9   dR   \        P
                  P'                  V\        P
                  P)                  V4      4      V P"                  VR,          &   R# V P                  \*        P,                  W#4       R# )z9Merge the contents given by src to destination folder dstr`   ra   mergezMerging %s into %soptionalOptional path %s not presentNzSource does not exist: %sTZexist_ok)r5   _get_move_pathsr   rd   rV   rW   rX   rM   infor   r*   ru   isfiledirnamere   shutilcopy
game_fileskeysr3   rc   r   Zmerge_folders)r'   r.   r`   ra   r-   r    ry   ZCommandsMixin.merge  s4   ##UENFGD''/)34ww~~c""zz*%%:C@ #>!?#!EvNN
C$'77>># wws#s*&&v{{C=e} 4 4 6613c277CSCSTWCX1Yu.v33S>r#   c                s(    V P                  V4       R# )zAlias for mergeN)ry   )r'   r.   r:   r    r   ZCommandsMixin.copy'  s    

6r#   c                s$   V P                  RR.VR4       V P                  V4      w  r#\        P                  ! RW#4       \        P
                  P                  V4      '       gL   VP                  R4      '       d   \        P                  ! RV4       R# \        \        R4      V,          4      h\        P
                  P                  V4      '       d   \        P
                  P                  V4      V8X  d   \        P                  ! R	4       R# \        P
                  P                  \        P
                  P                  V\        P
                  P                  V4      4      4      '       d   \        P                  ! R
4       R#  \        V4      '       d   \         P"                  pM\         P$                  pV P'                  WBV4       R#   \         P(                   d+   p\        \        R4      P+                  Y#R7      4      ThRp?ii ; i)z3Move a file or directory into a destination folder.r`   ra   movezMoving %s to %srz   r{   Nz'Invalid source for 'move' operation: %sz0Source file is the same as destination, skippingz!Destination file exists, skippingz&Can't move {src} 
to destination {dst})r`   ra   )r5   r}   r   rd   rV   rW   rX   rM   r~   r   r*   r   r   r3   rc   r   r   r   r   re   ZErrorr   )r'   r.   r`   ra   Zactionr,   rm   r    r   ZCommandsMixin.move+  sk   ##UENFFC''/&1ww~~c""zz*%%:C@ #L!MPS!STT77>>#wws#s*NOww~~bggll30@0@0EFGG ?@	q&s++""64|| 	q #L!M!T!TY\!T!fgmpp	qs   
AG H%%H

Hc                s   V P                  RR.VR4       V P                  V4      w  r#\        P                  P	                  V4      '       g   \        \        R4      V,          4      h\        P                  P                  V4      '       d    \        P                  ! V4       \        P                  P	                  V4      '       d   \        \        R4      V,          4      h\        P                  P                  V4      p\        P                  P                  VR4      p\        P                  ! V4       V P                  \        P                  W%4       \        P                  P                  V\        P                  P!                  V4      4      p\        P"                  ! W#4       R#   \         d     ELi ; i)zRename file or folder.r`   ra   renamez,Rename error, source path does not exist: %sz,Rename error, destination already exists: %sZlutris_rename_tempN)r5   r}   rV   rW   rX   r   r*   isdirZrmdirrv   r   r3   ru   re   r   r   rc   Zrenames)r'   r.   r`   ra   Zdst_dirZtemp_dirrm   r    r   ZCommandsMixin.renameI  s/   ##UENFHE''/ww~~c"" #Q!RUX!XYY77== 77>># #Q!RUX!XYY''//#& 77<<)=>
Hv{{C:ggll8RWW%5%5c%:;


3  s   F/ /F>=F>c                s    VR,          pT P                  P	                  T4      ;'       g    T P                  T4      pT'       g   \        \        R4      T4      hTR,          pT P                  T4      pT'       g   \        \        R4      T4      hTP                  R4      TP                  R4      3#   \          d   p\        \        R4      4      ThRp?ii ; i)z!Process raw 'src' and 'dst' data.r`   zMissing parameter srcNzWrong value for 'src' paramra   zWrong value for 'dst' paramZ/)ZKeyErrorr   r*   r   rM   r6   Zrstrip)r'   r.   Zsrc_refr,   r`   Zdst_refra      &&     r    r}   ZCommandsMixin._get_move_paths`  s    	FUmG oo!!'*GGd.>.>w.G #@!A7KK-w' #@!A7KKzz#

3//  	F #:!;<#E	Fs   	B5 5C CCc           	     s   V P                  RVR4       V P                  VR,          4      p\        P                  ! RV4       VR,           p\	        VRRR7      ;_uu_ 4       p\	        VRRR7      ;_uu_ 4       pR	pV'       d5   VP                  4       pV P                  V4      pVP                  V4       K<   R
R
R
4       R
R
R
4       \        P                  ! W24       R
#   + '       g   i     L0; i  + '       g   i     L;; i)z.Substitute variable names found in given file.r<   substitute_varsz"Substituting variables for file %sz.tmpZrutf-8Zencodingw.N)	r5   r6   r   rd   openZreadlinewriterV   r   )r'   r^   r9   Ztmp_filenamesource_file	dest_fileliner   r    r   ZCommandsMixin.substitute_varso  s    ##FD2CD##DL198D&((C'22klC'::i&//1D++D1DOOD)  ; 3 			,) ;: 32s*   "C49
C!	4C!	9C4!C1,C44D	c                s    R V9   d   VP                  R 4      w  r!MV P                  P                  pVP                  RR4      pVP	                  R4      pW!3# )r   Z-r*   )rO   r%   r&   ZreplacerT   )r'   	task_namer+      && r    _get_task_runner_and_nameZ'CommandsMixin._get_task_runner_and_name~  sW    ) &/__S%9"K..//K%%c3/	OOC(	%%r#   c                s   V P                  RVR4       V P                  VP                  R4      4      w  r#RV9   d   VP                  R4      pMRpVP                  R4      '       d   V P	                  4       VR&   VP                  R4      ;'       g@    V P                  P                  P                  R/ 4      P                  R4      ;'       g    R	VR&   VP                  R
4      ;'       gD    V P                  P                  P                  R/ 4      P                  R
4      ;'       g    \        VR
&   VR8X  d   V P                  VR&   V F  pW,          p\        V\        4      '       d$   V F  pV P                  Wg,          4      Wg&   K  	  MU\        V\        4      '       d)   \        V4       F  w  rV P                  V	4      Wh&   K  	  MV P                  W,          4      pWaV&   K  	  \        W#4      p
V
! R/ VB p\        V\         4      '       d<   V P"                  P%                  V4       WKn        \)        V P*                  VRR7       R# R# )zDirective triggering another function specific to a runner.

The 'name' parameter is mandatory. If 'args' is provided it will be
passed to the runner task.
nametaskr?   r@   r   r(   prefixgame$GAMEDIRZarchwineexecrE   rH   rI   rJ   N )r5   r   rL   
startswithr)   rM   r%   scriptr   rQ   r2   rK   r6   ZlistZ	enumerater   r	   r[   r\   rZ   r   r]   )r'   r^   r+   r   r?   r4   r_   Z	inner_keyZindexZelemr   r=      &&          r    r   ZCommandsMixin.task  s    	##FD&9!%!?!?@P!Q D ((=1KK!!&)) $ 2 2 4D!XXh/tt4>>3H3H3L3LVUW3X3\3\]e3fttjtDN88F+uut~~/D/D/H/HQS/T/X/XY_/`uuduDLJ&"ooUCIE%&&!&I'+'7'78H'IE$ "'E4((#,U#3KE#'#3#3D#9EL $4 ((3I  ;2,,g/00((33G<+6(&t'9'97UXYr#   c                s&   VP                   '       g   \        P                  ! R VP                  4       VP                  \	        VP
                  4      R39  d&   \        \        R4      VP                  ,          4      hV P                  4        R# R# )zReturn code: %sr@   zCommand exited with code %sFT)	Z
is_runningr   rd   r?   r   rZ   r   r*   rn   )r'   r=   r:   r    r]   ZCommandsMixin._monitor_task  so    !!!LL*G,?,?@""3w/K/K+Lc*RR$Q'D%EH[H[%[\\!r#   c                s   V P                  RR.VR4       V P                  VR,          4      p\        P                  P	                  V4      p\        P
                  ! VRR7       VP                  RR4      pVP                  R4      '       g   \        \        R4      V,          4      h\        W$R	R
7      ;_uu_ 4       pVP                  V P                  VR,          4      4       RRR4       R#   + '       g   i     R# ; i)zWrite text to a file.r<   Zcontent
write_fileTr|   moder   z%Wrong value for write_file mode: '%s'r   r   N)Zar   )r5   rS   rV   rW   r   ru   rM   r   r   r*   r   r   r6   )r'   r.   Zdest_file_pathbasedirr   r   rm   r    r   ZCommandsMixin.write_file  s    ##VY$7N ,,VF^< ''//.1
Gd+zz&#&z** #J!Kd!RSS.99YOOD,,VI->?@ :999s   >(C00D	c           	     s   V P                  RR.VR4       V P                  VR,          4      p\        P                  P	                  V4      p\        P
                  ! VRR7       VP                  RR4      p\        V4      P                  RR7       \        Y$'       d   RMRR	R
7      ;_uu_ 4       p/ pV'       d    \        P                  ! V4      p\        WaP                  R/ 4      4      pVP!                  ^ 4       VP#                  4        VP%                  \        P&                  ! V^R7      4       RRR4       R#   \         d    \        P                  ! RT4        Li ; i  + '       g   i     R# ; i)zWrite data into a json file.r<   r^   
write_jsonTr|   ry   zr+r   r   r   z!Failed to parse JSON from file %s)ZindentN)r5   rS   rV   rW   r   ru   rM   r   Ztouchr   jsonZloadZ
ValueErrorr   Zerrorr   ZseekZtruncater   Zdumps)r'   r.   r9   r   ry   Z	json_fileZ	json_datar   r    r   ZCommandsMixin.write_json  s'   ##VV$4flK &&vf~6 ''//(+
Gd+

7D) 	Xd+(EDsWEEIP $		) 4I (	::fb3IJINN1 OODJJy;< FE
 " PLL!DhOP FEEs1   1E(=E A#E( "E%"E($E%%E((E9	c                s   VP                  R4      '       d   V P                  RR.VR4       MV P                  . ROVR4       V P                  VR,          4      p\        P                  P                  V4      p\        P                  ! VRR7       VP                  R	R4      p\        R\        R
R7      p\        Vn
        V'       d   VP                  V4       / pVP                  R4      '       d   VR,          pM+/ WaR,          &   VR,          WaR,          ,          VR,          &   VP                  4        Fi  w  rxVP                  V4      '       g   VP                  V4       VP                  4        F(  w  rV P                  V
4      p
VP!                  WyV
4       K*  	  Kk  	  \#        VR4      ;_uu_ 4       pVP%                  V4       RRR4       R#   + '       g   i     R# ; i)z4Write a key-value pair into an INI type config file.r^   r<   write_configsectionr4   r_   Tr|   ry   F)Zallow_no_valueZ	dict_typeZstrictZwbN)r<   r   r4   r_   )rM   r5   rS   rV   rW   r   ru   r   r   r   ZoptionxformreadrR   Zhas_sectionZadd_sectionr6   Zsetr   r   )r'   r.   Zconfig_file_pathr   ry   Zparserr^   r   r   r4   r_   config_filer   r    r   ZCommandsMixin.write_config  s~   ::f''(8&.Q''(KVUcd..vf~> ''//"23
Gd+

7D)!AQZ_` KK()::f&>D&(D	"#5;G_D	"#F5M2!ZZ\MG%%g..""7+"jjl
((/

7/ + * "D))[LL% *)))s   9GG&	c                sn    V P                   P                  V4      pV'       g   V P                  V4      pV# N)r   rM   r6   )r'   Zfileid	file_pathr   r    rS   ZCommandsMixin._get_file_path  s/    OO''/	((0Ir#   c                s"   \         P                  ! ^4      ;_uu_ 4       pVP                  WV4      pVP                  V n        VP                  4       pRV n        \        P                  ! RW4       VuuRRR4       #   + '       g   i     R# ; i)z4Run function `func` in a separate, killable process.NzProcess %s returned: %s)multiprocessingZPoolZapply_asyncZ	terminateabort_current_taskrM   r   rd   )r'   ZfuncrB   ZkwargsZprocessZ
result_objZresults   &&*,   r    re   ZCommandsMixin._killable_process  sj    !!!$$ ,,T@J&-&7&7D#^^%F&*D#LL2DA %$$$s   AA==B	c                s    V P                  R VRRRR/4       \        P                  P                  V P                  R4      p\
        P                  ! V4      '       d   \        P                  ! V4       F  p\        P                  P                  W#4      p\        P                  P                  \        P                  P                  V P                  V4      4      '       d"   V P                  R VRV P                  /4       K  V P                  R VRV P                  /4       K  	  \        P                  P                  V P                  R4      p\
        P                  ! V4      '       d"   V P                  R VRV P                  /4       R# R# )r`   ra   r   rg   ZinnoextractZappz__support/appN)r   rV   rW   r3   rY   r   r7   listdirrX   ry   r   )r'   file_idZapp_pathZapp_contentZsource_pathZsupport_pathrm   r    _extract_innosetupZ CommandsMixin._extract_innosetup%  s   eWeZmTU77<< 0 0%8h''!zz(3 ggll8A77>>"'',,t/?/?"MNNJJ{E4;K;KLMIIuk5$:J:JKL  4 ww||D$4$4oFl++JJ|UD4D4DEF ,r#   c                s   \        VRR7      ;_uu_ 4       p\        P                  ! VP                  4       4      pRRR4       XR,           Uu. uF  qDR,          R8X  g   K  VNK  	  ppV^ ,          R,          pVP	                  4       R,          pRP                  VP	                  4       RR 4      p\        P                  P                  V4      pR	VR
VRV/#   + '       g   i     L; iu upi )z8Return a ScummVM configuration from the GOG config filesr   r   NZ	playTasksZcategoryr   	arguments game_idrW   rB   i)	r   r   Zloadsr   rO   r3   rV   rW   r   )	r'   Zgog_config_pathZgog_config_fileZ
gog_configr   Z
game_tasksr   r   Zbase_dirs	   &&       r    _get_scummvm_argumentsZ$CommandsMixin._get_scummvm_arguments3  s    /G44O$8$8$:;J 5'1+'>]'>tzBRV\B\dd'>
]qM+.	//#B'HHY__.s34	77???37FHfiHH 54]s   %CC-"C-C*	c           
     s   V P                   V,          p\        P                  ! V4      pRpRpRpV FJ  pRVP                  4       9   d   RpRVP                  4       9   d   RpRVP                  4       9   g   KH  RpKL  	  V'       Ed   V'       Eg   V P	                  V4       R\
        P                  ! V P                  4      9   d   RR/p	M/ p	R	p
R	p\
        P                  ! V P                  4       FF  pVR
8X  d   WR&   K  VP                  R4      '       d   Tp
K+  VP                  R4      '       g   KD  TpKH  	  V
'       d   WR&   V'       d!   V	P                  R4      '       d   WR&   MWR&   WP                  P                  R&   RV P                  n        R	# V'       d   V P	                  V4       \
        P                  ! V P                  4       Fn  pVP                  R4      '       g   K  VP                  R4      '       g   K5  V P                  \
        P                  P!                  V P                  V4      4      pKp  	  X'       g   \#        R4      h\$        P&                  ! RV4       WP                  P                  R&   RV P                  n        R	# RpV'       d
   VR,          pRV P                  n        V P+                  RRRRRVRV/4      # )zAutomatically guess the best way to install a GOG game by inspecting its contents.
This chooses the right runner (DOSBox, Wine) for Windows game files.
Linux setup files don't use innosetup, they can be unzipped instead.
F
dosbox.exeTscummvm.exez_some_windows.exeZDOSBOXrD   z$GAMEDIR/DOSBOXNdosbox.conf	main_file_single.conf.confr   r   dosboxZgoggamez.infozUnable to get ScummVM argumentsScummVM config: %sscummvm/SP- /NOCANCEL% /SUPPRESSMSGBOXES /VERYSILENT /NOGUIr   r   r   r   
executablerB   )r   r   get_innoextract_listcasefoldr   rV   r   rY   endswithrM   r%   r   r&   r   r   rW   r3   ro   r   r~   is_gogr   )r'   r   silentr   	file_listdosbox_foundscummvm_foundZwindows_override_foundr9   dosbox_configsingle_confr   r   rB   s   &&&           r    autosetup_gog_gameZ CommandsMixin.autosetup_gog_game>  sf   
 OOG,	00;	!&!Hx0022# 1 1 33 $"h&7&7&99 *.& " < 6 6##G,2::d&6&677!#4! !#KKJJt'7'78},19+.&&~66"*K&&w//"*K 9 -8k* $$[113>-01<+.,9NN!!&)$,DNN!##G,JJt'7'78&&y11h6G6G6P6P $ ; ;BGGLLIYIY[c<d eI 9 "#DEEKK,i8,5NN!!&)$-DNN!#D??$(DNN!99fj(JV]_egklmmr#   c                s@   \        VRR7      ;_uu_ 4       pVP                  4       pRRR4       XP                  4       p. pV FD  pVP                  R4      '       g   K  VP	                  R^4      ^,          P                  4       p V# 	  V#   + '       g   i     Ln; i)zLReturn the arguments for the DOSBox executable from a ZOOM Plaform installerr   r   Nz.\DOSBOX\dosbox.exer   )r   r   Z
splitlinesr   rO   rT   )r'   Zzoom_bat_pathZzoom_bat_fileZzoom_batZlinesr   r   r   r    _get_dosbox_argumentsZ#CommandsMixin._get_dosbox_arguments|  s    -'22m$))+H 3 ##%	D677 JJsA.q1779	   32s   BB	c           
     s   V P                   V,          p\        P                  ! V4      pRpRpV F3  pRVP                  4       9   d   RpRVP                  4       9   g   K1  RpK5  	  V'       Ed   V P	                  V4       / pRp	Rp
\
        P                  ! V P                  4       FF  pVR8X  d   WxR&   K  VP                  R4      '       d   Tp	K+  VP                  R	4      '       g   KD  Tp
KH  	  V	'       d   WR&   V
'       d!   VP                  R4      '       d   WR
&   MWR&   \
        P                  ! V P                  4       Fn  pVP                  R4      '       g   K  VP                  R4      '       g   K5  V P                  \
        P                  P                  V P                  V4      4      pKp  	  \        X4      ^ 8  d   WR&   VP                  R
R4       WP                   P"                  R&   RV P                   n        R# V'       d   V P'                  V4       R\
        P                  P                  V P                  R4      RR/p\(        P*                  ! RV4       WP                   P"                  R&   RV P                   n        R# RpV'       d
   VR,          pRV P                   n        V P/                  RRRRRVRV/4      # )zAutomatically guess the best way to install a ZOOM Platofrm game by inspecting its contents.
This chooses the right runner (DOSBox, Wine) for Windows game files.
Linux setup files don't use innosetup, they can be unzipped instead.
Fr   Tr   Nr   r   r   r   r   ZLaunchz.batrB   r   r   rW   ZDataz--auto-detectr   r   r   r   r   r   r   r   r   )r   r   r   r   r   rV   r   rY   r   rM   r   r   rW   r3   ZlenrL   r%   r   r&   Z_extract_innoextract_setupr   r~   r   r   )r'   r   r   r   r   r   r   r9   r   r   r   r   rB   s   &&&          r    autosetup_zoom_platformZ%CommandsMixin.autosetup_zoom_platform  sT   
 OOG,	00;	!Hx0022# 1 1 33 $	 "
 <##G,MKKJJt'7'78},19+.&&~66"*K&&w//"*K 9 -8k* $$[113>-01<+.JJt'7'78&&x00X5F5Fv5N5N $ : :277<<HXHXZb;c dI 9 9~!(1f%!!-6,9NN!!&)$,DNN!++G4d.>.>!GQ`aIKK,i8,5NN!!&)$-DNN!#D??$(DNN!99fj(JV]_egklmmr#   c                s   VR ,          pVR,          pV F  pV P                  RV 24       K  	  VP                  4        EF(  w  rVWPP                  9  d(   \        P                  ! RWVR,          ^ ,          4       K=  V P                  V,          pVR,          pV F  p	RV	 2p
V P                  V
4      p\        P                  P                  V4      '       d.   \        P                  ! RV4       \        P                  ! V4       V P                  \        P                  W{4       K  	  \        P                  P                  V4      '       g   EK  \        P                  ! V4       EK+  	  R# )filesdirectoriesz$GAMEDIR/drive_c/game/z-Amazon: Missing file hash %s (expected at %s)pathsz)Amazon: Removing conflicting directory %sN)rx   rR   r   r   rU   r6   rV   rW   r   r   Zrmtreere   ZcopyfilerX   Zremove)r'   Zfile_and_dir_dictr   r   rw   Z	file_hashZ	file_datar   r   rW   rf   Zabs_dest_pathr   r    autosetup_amazonZCommandsMixin.autosetup_amazon  s   !'*'6 %IJJ/	{;< % %*KKM I/NPYel[mno[pq//)4Kg&E4TF;	 $ 0 0 ;77==//NN#NP]^MM-0&&vS  ww~~k**		+&' %2r#   c                sB   V P                  V4      pV P                  P                  pVR8w  d   \        \	        R4      4      hVP                  R4      '       d   RRRV/pV P                  V4      # V P                  P                  pRVRR	V 2/pV P                  V4      # )
z9Runs if file is executable or extracts if file is archiver   z(install_or_extract only works with wine!z.exer   r   r   r<   ra   z$GAMEDIR/drive_c/)	rS   r%   r&   r   r*   r   r   Z	game_slugr   )r'   r   r   r&   r.   Zslugrm   r    install_or_extractZ CommandsMixin.install_or_extract  s    ''0	&&V #M!NOOf%%j,@F99V$$~~'''5,=dV*DE||F##r#   c                s&   < V ^8  d   Qh/ S[ ;R&   # )r   r%   r   r   r   r    r!   r"      s      /	 r#   )r   rt   r   )F)+Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__ZNotImplementedr%   r)   r$   Zstaticmethodr5   r;   r>   r   ri   rk   rq   rs   rx   ry   r   r   r   r}   r   r   r   r]   r   r   r   rS   re   r   r   r   r   r   r   r   Z__annotate_func__Z__static_attributes__Z__classdictcell__)r   s   @r    r   r      s     I "0I .  4)Pd%6p,Y <?,q<.0*&*XA$=:#&JG	I<n| 9nv'<$U  r#   r   )/r   rb   r   r   rV   rN   r   r    r*   Zpathlibr   Zlutrisr   Zlutris.cacher   Zlutris.exceptionsr   r   Zlutris.installer.errorsr   Zlutris.installer.installerr   Zlutris.monitored_commandr	   Zlutris.runnersr
   r   r   Zlutris.runners.winer   Zlutris.utilr   r   r   r   Zlutris.util.fileior   r   Zlutris.util.jobsr   Zlutris.util.logr   Zlutris.util.wine.winer   r   r   r   r   r#   r    <module>r      s\    $    	       0 M 2 6 5 I I $ ? ? A 7 " h hV$ V$r#   