+
    Ki6  c                   s    R 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 ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt  ! R R4      tR# )z"Injects sets of DLLs into a prefixN)gettext)settings)get_runtime_versions)MissingRuntimeComponentError)system)extract_archive)download_file)logger)parse_version)WinePrefixManagerc                   sF  a  ] tR t^t o Rt]t]t]t. t	]t
^ R^@R/tRtR$R lt]R 4       t]R 4       t]R	 4       t]R
 4       tR tR t]R 4       t]R 4       tV 3R lR lt]R 4       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#t+V t,R# )%
DLLManagerz.Utility class to install dlls to a Wine prefixZx32Zx64FNc                s8    Wn         . V n        W0n        W n        R # N)prefix	_versions_version	wine_arch)selfr   archversions   &&&&A/usr/lib/python3.14/site-packages/lutris/util/wine/dll_manager.py__init__ZDLLManager.__init__   s        c                sr    \         P                  P                  \        P                  V P
                  4      # r   )ospathjoinr   ZRUNTIME_DIRnamer      &r   base_dirZDLLManager.base_dir$   s!    ww||H00$))<<r   c                sp    \         P                  P                  V P                  V P                   R 24      # )z_versions.json)r   r   r   r   r   r   r   r   versions_pathZDLLManager.versions_path(   s&    ww||DMMdii[+GHHr   c                s   V P                  4       V n        \        P                  ! V P                  4      '       d   \
        P                  ! V P                  4       F  p\
        P                  P                  \
        P                  P                  V P                  V4      4      '       g   KR  WP                  9  g   Kd  V P                  P                  V4       K  	  V P                  # )zReturn available versions)load_versionsr   r   path_existsr   r   Zlistdirr   isdirr   append)r   Zlocal_version   & r   versionsZDLLManager.versions,   s     ++-dmm,,!#DMM!:77==dmm]!KLLQ^ftftQtNN))-8 "; ~~r   c                s   a  S P                   '       d   S P                   # S P                  pV'       d   V 3R lp\        WR7      pV^ ,          # R# )z5Return version (latest known version if not provided)c                 s\   < SP                  V 4      '       * SP                  V 4      '       * 3# r   )is_compatible_versionis_recommended_version)vr   s   &r   get_preference_keyZ.DLLManager.version.<locals>.get_preference_key>   s+    55a88d>Y>YZ[>\:\\\r   )keyN)r   r#   Zsorted)r   r#   r'   Zsorted_versionss   f   r   r   ZDLLManager.version6   sF     ===== ==] %XFO"1%% r   c                    R# )zTrue if the version given should be usable as the default; false if it
should not be the default, but may be selected by the user. If only
non-recommended versions exist, we'll still default to one of them, however.T r   r   s   &&r   r%   Z!DLLManager.is_recommended_versionE   s     r   c                s   \         P                  ! V P                  4      p RV9   d4   \        VR,          4      p\        \         P                  4      pWC8  d   R# R#   \
         d#   p\        P                  ! RT4        Rp?R# Rp?ii ; i)a7  True if the version of the component is compatible with this Lutris. We can tell only
once it is downloaded; if not this is always True.

This checks the file 'lutris.json', which may contain the lowest version of Lutris
the component version will work with. If this setting is absent, it is assumed compatible.min_lutris_versionFzInvalid lutris.json: %sNT)r   Zget_lutris_directory_settingsr   r   ZVERSIONZ	TypeErrorr   Z	exception)r   r   Zdir_settingsr,   Zcurrent_lutris_versionZexs   &&    r   r$   Z DLLManager.is_compatible_versionK   s{      ==dmmL	#|3%2<@T3U%V")6x7G7G)H&)> 
 	  	6;	s   8A B)BBc                s    V P                   pV'       g2   \        \        R4      V P                  ,          V P                  R7      h\
        P                  P                  V P                  V4      # )z$Path to local folder containing DLLszkThe '%s' runtime component is not installed; visit the Updates tab in the Preferences dialog to install it.)Zcomponent_name)	r   r   _
human_namer   r   r   r   r   r+   r"   r   r   ZDLLManager.path_   s]     ,,.U //	"
  $yy  ww||DMM733r   c                sl    \        R 4      R3.pV P                   F  pVP                  W"34       K  	  V# )ZManualmanual)r-   r#   r!   )r   Z_choicesr      &  r   version_choicesZDLLManager.version_choicesn   s;     x[(#
 }}GOOW./ %r   c                s    < V ^8  d   QhRS[ /# )i   Zreturn)Zlist)Zformat__classdict__s   "r   Z__annotate__ZDLLManager.__annotate__w   s      t r   c                sd   \         P                  ! V P                  4      '       g   . # \        V P                  R RR7      ;_uu_ 4       p \        P
                  ! V4       Uu. uF  q"R,          NK  	  pp RRR4       \        4       pTP                  R4      pT'       d~   TP                  T P                  4      pT'       d[   TP                  R4      '       dD   TP                  R4      pT'       d+   TX9   d   TP                  T4       TP!                  ^ T4       X# u upi   \        \        P                  P                  3 dQ    \        P                  ! RT P                  4       \        P                  ! T P                  4       . u uuRRR4       # i ; i  + '       g   i     EL0; i)	rutf-8Zencodingtag_namezEInvalid versions file %s, deleting so it is downloaded on next start.NruntimesZ	versionedr   )r   r   r   openjsonloadZKeyErrorZdecoderZJSONDecodeErrorr   warningr   remover   Zgetr   Zinsert)r   Zdll_version_filer&   Zdll_versionsr#   r7   ZruntimeZdefault_versions   &       r   r   ZDLLManager.load_versionsw   sJ   !!$"4"455I$$$cG<<@P7;yyAQ7RS7R!*7RS = ()<<
+ll499-G7;;{33")++i"8"&,6$++O< ''?;+  Tdll::; []a]o]o 		$,,-	 =< =<<s=   	FD&#D!4D&!D&&A(FFFFF/	c                r)   )z6Check if a given DLL path is provided by the componentFr*   )dll_pathr   r   is_managed_dllZDLLManager.is_managed_dll   s     r   c                sj    V P                   ;'       d!    \        P                  ! V P                  4      # )z*Return whether component is cached locally)r   r   r   r   r   r   r   is_availableZDLLManager.is_available   s#    ||== 2 2499 ==r   c                s   a a \         ;QJ d8    VV 3R lS P                  P                  4        4       F  '       g   K   R# 	  R# ! VV 3R lS P                  P                  4        4       4      # )zCheck if the dll is provided by the component
The DLL might not be available for all architectures so
only check if one exists for the supported ones
c           	   3   s   <"   T FK  p\         P                  ! \        P                  P	                  SP                  VSR ,           4      4      x  KM  	  R# 5i)z.dllN)r   r   r   r   r   )Z.0r   dll_namer   s   & r   Z	<genexpr>Z(DLLManager.dll_exists.<locals>.<genexpr>   s<     xdw\`6%%bggll499dHvDU&VWWdws   AATF)ZanyarchsZvalues)r   r@   s   ffr   
dll_existsZDLLManager.dll_exists   sN    
 sxdhdndndududwxssxsxsxdhdndndududwxxxr   c                s   \        V P                  RRR7      ;_uu_ 4       p\        P                  ! V4      pRRR4       X F4  pVR,          V P                  8w  d   K  VR,          ^ ,          R,          u # 	  R#   + '       g   i     LL; i)z1Fetch the download URL from the JSON version filer3   r4   r5   Nr6   ZassetsZbrowser_download_url)r8   r   r9   r:   r   )r   Zversion_fileZreleasesZreleases   &   r   get_download_urlZDLLManager.get_download_url   si    $$$cG<<yy.H =Gz"dll28$Q'(>??   =<s   A<<B	c                s   V P                  4       '       d-   \        P                  ! RV P                  V P                  4       \
        P                  ! V P                  4      '       g   V P                  4        V P                  4       pV'       g/   \        P                  ! RV P                  V P                  4       R# \        P                  P                  V P                  \        P                  P                  V4      4      p\        P                  ! RW4       \!        WRR7       \
        P                  ! V4      '       d'   \        P"                  ! V4      P$                  '       g/   \        P&                  ! RV P                  V P                  4       R# \        P                  ! RW P                  4       \)        W P                  RR	7       \        P*                  ! V4       R# )
zuDownload component to the local cache; returns True if successful but False
if the component could not be downloaded.z%s already available at %sz"Could not find a release for %s %sFzDownloading %s to %sTZ	overwritezFailed to download %s %szExtracting %s to %s)Zmerge_single)r?   r   r;   r.   r   r   r   r   fetch_versionsrC   r   r   r   r   basenameinfor   ZstatZst_sizeerrorr   r<   )r   ZurlZarchive_pathr0   r   downloadZDLLManager.download   s0    NN7$))T!!$"4"455!##%NN?RVR^R^_ww||DMM2773C3CC3HI*C>c48!!,//rww|7L7T7T7TLL3T__dllS)<CiidC
		,r   c                s&   \         P                  P                  V4      p\        P                  ! V4      '       d   \         P                  P                  W4      p\        P                  ! V4      '       dq   V P                  V4      '       gD   \         P                  P                  V4      '       g   \        P                  ! WUR,           4       M\         P                  ! V4       \        P                  ! W54       R# V P                  WV4       R# )z*Copies dlls to the appropriate destination.origN)r   r   rF   r   r   r   r>   islinkshutilmover<   create_symlinkdisable_dll)r   
system_dirr   r=   dllwine_dll_path   &&&&  r   
enable_dllZDLLManager.enable_dll   s    ggx(h''GGLL9M!!-00**=99"''..Q^B_B_KKw/FGIIm,!!(:Zs3r   c                s>   \         P                  P                  VRV,          4      p\        P                  ! VR,           4      '       dS   \        P                  ! V4      '       d   \         P
                  ! V4       \        P                  ! VR,           V4       R# R# )zRemove DLL from Wine prefix%s.dllrJ   N)r   r   r   r   r   r<   rL   rM   )r   rP   Z_archrQ   rR   s   &&&& r   rO   ZDLLManager.disable_dll   se    ZC@mg566!!-00		-(KK/? 7r   c                sn   \         P                  ! V4      '       Ed   \        P                  P	                  W4      p\        P                  P                  V4      p\         P                  ! V4      '       dZ   \        P                  P                  V4      '       g   \        P                  ! WDR ,           4       M\        P                  ! V4       \        P                  P                  V4      '       g   \        P                  ! V4       \         P                  ! W44       R# V P                  W4       R# rJ   N)r   r   r   r   r   ZdirnamerK   rL   rM   r<   r    ZmakedirsrN   disable_user_file)r   appdata_dir	file_pathsource_pathwine_file_pathZwine_file_dirrS   r   enable_user_fileZDLLManager.enable_user_file   s    k**WW\\+ANGGOON;M!!.11ww~~n55KK0HIIIn-77==//M*!!+>"";:r   c                s   \         P                  P                  W4      p\        P                  ! V4      '       d   \         P                  P                  V4      '       d\   \         P                  ! V4       \        P                  ! VR ,           4      '       d!   \        P                  ! VR ,           V4       R# R# R# R# rV   )	r   r   r   r   r   rK   r<   rL   rM   )r   rX   rY   r[   s   &&& r   rW   ZDLLManager.disable_user_file   sz    k=n--"''..2P2PIIn%!!.7":;;NW4nE < 3Q-r   c              #  s:  "   \         P                  P                  V P                  R 4      pV P                  R8X  df   V P
                  ^@,          \         P                  P                  VR4      V P
                  ^ ,          \         P                  P                  VR4      /pMDV P                  R8X  d4   V P
                  ^ ,          \         P                  P                  VR4      /pXP                  4        F  w  r4V P                   F	  pWCV3x  K  	  K   	  R# 5i)zdrive_c/windowswin64Zsystem32Zsyswow64Zwin32N)r   r   r   r   r   rA   Zitemsmanaged_dlls)r   Zwindows_pathZsystem_dirsr   rP   rQ   s   &     r   
_iter_dllsZDLLManager._iter_dlls   s     ww||DKK1BC>>W$

2\: F

2\: FK ^^w&::b>277<<j+QRK + 1 1 3D(( ++ ) !4s   DDc              #  s   "   V P                   '       d\   \        V P                  4      pVP                  pV P                    F(  p\        P
                  P                  V4      pW#V3x  K*  	  R # R # 5ir   )managed_appdata_filesr	   r   rX   r   r   rF   )r   Zprefix_managerrX   filefilenames   &    r   _iter_appdata_filesZDLLManager._iter_appdata_files  s^     %%%.t{{;N(44K2277++D1!11 3 &s   A0A2c                s    V P                   pV'       d   VP                  4       R8w  d-   V'       d   V P                  4        R# V P                  4        R# R# )zEnable or disable DLLsr/   N)r   Zlowerenabledisable)r   rd   Zmanager_versions   && r   setupZDLLManager.setup  s;     ,,/"7"7"9X"E	 #Fr   c                sj    / pV P                    F   pV P                  V4      '       g   K  RW&   K"  	  V# )zReturns aa dll-override dict for the dlls in this manager; these options will
enable the manager's dll, so call this only for enabled managers.Zn)r^   rB   )r   Z	overridesrQ   r0   r   get_enabling_dll_overridesZ%DLLManager.get_enabling_dll_overrides  s7     	$$Cs##!$	 %
 r   c                s    R # )Tr*   r   r   r   
can_enableZDLLManager.can_enable"  s    r   c                s"   V P                  4       '       gE   V P                  4       '       g/   \        P                  ! RV P                  V P
                  4       R# V P                  4        FJ  w  rp\        P                  P                  V P                  VRV,          4      pV P                  WV4       KL  	  V P                  4        FB  w  rVp\        P                  P                  V P                  V4      pV P                  WVV4       KD  	  R# )z"Enable Dlls for the current prefixz>%s %s could not be enabled because it is not available locallyNrU   )r?   rI   r   rH   r.   r   r_   r   r   r   rT   rc   r\   )	r   rP   r   rQ   r=   rX   ra   rb   rZ   s	   &        r   rd   ZDLLManager.enable%  s      ""==??TVZVeVegkgsgs %)__%6!Jcww||DIItX^DHOOJh7 &7 ,0+C+C+E'Kx'',,tyy(;K!!+[A ,Fr   c                s    V P                  4        F  w  rpV P                  WV4       K  	  V P                  4        F  w  rEpV P                  WE4       K  	  R# )z#Disable DLLs for the current prefixN)r_   rO   rc   rW   )r   rP   r   rQ   rX   ra   Z	_filenames   &      r   re   ZDLLManager.disable4  sO    %)__%6!JcZs3 &7,0,D,D,F(Ky"";5 -Gr   c                s    \         P                  P                  V P                  4      '       g!   \         P                  ! V P                  4       \        V P                  V P                  RR7       R# )zGet releases from GitHubTrD   N)r   r   r    r   Zmkdirr   releases_urlr   r   r   r   rE   ZDLLManager.fetch_versions;  sA    ww}}T]]++HHT]]#d''););tLr   c                s   V P                  4       '       g   V P                  4       pV'       g"   \        P                  ! R V P                  4       VP                  V P                  RR7       V Fp  p\        P                  ! RV P                  V4       V P                  4        V P                  V4      '       d    R# \        P                  ! RW P                  4       Kr  	  R# R# )zDUnable to download %s because version information was not available.T)r(   ZreversezDownloading %s %s...Nz?Version %s of %s is not compatible with this version of Lutris.)
r?   r   r   r;   r.   Zsortr%   rG   rI   r$   )r   r#   r   r0   r   upgradeZDLLManager.upgradeA  s      ""))+Hegkgvgvw MMd994MH#2DOOWM--g66UW^`o`o $ #r   )r   r   r   r   )Nr]   N)-Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__ZNotImplementedr   r.   r^   r`   ri   rA   Zproton_compatibler   Zpropertyr   r   r#   r   r%   r$   r   r1   r   Zstaticmethodr>   r?   rB   rC   rI   rT   rO   r\   rW   r_   rc   rf   rg   rh   rd   re   rE   rj   Z__static_attributes__Z__classdictcell__)r2   s   @r   r
   r
      s=    8DJ!L!LE"E = = I I   & &( 4 4   :  >y@04@;"F,2	
B6M r   r
   )rk   r9   r   rL   r    r-   Zlutrisr   Z
lutris.apir   Zlutris.exceptionsr   Zlutris.utilr   Zlutris.util.extractr   Zlutris.util.httpr   Zlutris.util.logr   Zlutris.util.stringsr   Zlutris.util.wine.prefixr	   r
   r*   r   r   <module>rl      s;    (  	     + :  / * " - 5A Ar   