+
    Ki  c                   s    ^ RI t ^ RIHt ^ RIHtHtHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ]
R R	 l4       tR
 R ltR R lt]
R R l4       tR R ltRR R lltRR R lltR# )i    N)gettext)DictListOptional)UnavailableRunnerError)cache_single)logger)read_process_outputc                :    V ^8  d   QhR\         \        ,          /#    return)r   strZformat   "8/usr/lib/python3.14/site-packages/lutris/util/flatpak.py__annotate__r      s     D D D    c                 sj    \         P                  ! R4      ;'       g    \         P                  ! R4      # )zReturn the executable used to access Flatpak. None if Flatpak is not installed.

In the case where Lutris is a Flatpak, we use flatpak-spawn.
flatpak-spawnflatpak)shutilZwhich r   r   get_executabler      s$     <<(CCFLL,CCr   c                s$    V ^8  d   QhR\         /# r	   )boolr   r   r   r   r      s     " "d "r   c                 s(    \        \        4       4      # )zReturns Flatpak is installed)r   r   r   r   r   is_installedr      s     !!r   c                r   r	   )r   r   r   r   r   r   r      s      T#Y r   c                 sl    \        4       p V '       g   \        \        R4      4      hRV 9   d   V RR.# V .# )z6Return the full command used to interact with Flatpak.zFlatpak is not installedr   z--hostr   )r   r   _)Zexes    r   get_commandr      s:    

C$Q'A%BCC#Xy))5Lr   c                s\    V ^8  d   QhR\         \        \        \        3,          ,          /# r	   )r   r   r   r   r   r   r   r   $   s       Dc3h0 r   c                  sl   \        4       '       g   . # \        4       R R.,           p \        V 4      p. pVP                  R4       FC  pV'       g   K   VP                  R4      w  rErgrp
TP                  RTRTRTRTR	TR
T	RT
/4       KE  	  V#   \         d    \
        P                  ! RT4        Kn  i ; i)ZlistzB--columns=name,application,version,branch,arch,origin,installationZ
Z	z$Not able to parse Flatpak output: %snameappidversionbrancharchorigininstallation)r   r   r   ZsplitZ
ValueErrorr   Zerrorappend)commandZpackage_listZpackagesZpackager   r   r   r   r   r    r!   s              r   get_installed_appsr$   #   s    >>	mv'kllG&w/LH%%d+7KR==Y]K^HWdL OODUwfDf"L
 ,$ O  CWMs   B"B32B3c                s0    V ^8  d   QhR\         R\        /# )r
   r   r   )r   r   r   r   r   r   r   @   s      C D r   c                s^    V '       g   R# \        4        F  pVR,          V 8X  g   K   R# 	  R# )z"Return whether an app is installedFr   T)r$   )r   Zapps   & r   is_app_installedr%   @   s)    !#w<5  $ r   c                sj    V ^8  d   QhR\         R\         R\         R\         R\        \         ,          /# )r
   r   r   fcommandr   r   r   r   r   r   r   r   r   J   s7      3 c C PS _cdg_h r   c                s@    \        WV4      pVP                  V 4       V# )z&Return command to launch a Flatpak app)get_bare_run_commandr"   )r   r   r&   r   r#   s   &&&& r   get_run_commandr)   J   s    "46:GNN5Nr   c          	      s^    V ^8  d   QhR\         R\         R\         R\        \         ,          /# )r
   r   r&   r   r   r'   r   r   r   r   r   Q   s/      s S  X\]`Xa r   c                s    \        4       pVP                  R4       V '       d   VP                  RV  24       V'       d   VP                  RV 24       V'       d   VP                  RV 24       V# )zReturn command to launch a Flatpak app, without the app-id at the end;
this is the 'command' of the flatpak runner itself, and a program's
appid must be appended to it.Zrunz--arch=z
--command=z	--branch=)r   r"   )r   r&   r   r#   s   &&& r   r(   r(   Q   s^     mGNN5'(H:./6(+,Nr   )NNN)r   r    r   Ztypingr   r   r   Zlutris.exceptionsr   Zlutris.utilr   Zlutris.util.logr   Zlutris.util.systemr   r   r   r   r$   r%   r)   r(   r   r   r   <module>r*      se       ' ' 4 $ " 2 D D"
  8 r   