
    *f                     H    d Z ddlZddlZddlZ G d de      Zd Zd Zd Zy)zUtility functions for xauth.    Nc                       e Zd ZdZy)NotFoundErrorzError when xauth was not found.N)__name__
__module____qualname____doc__     S/var/www/html/flask-app/venv/lib/python3.12/site-packages/pyvirtualdisplay/xauth.pyr   r      s    )r
   r   c                      	 t        j                  ddgt         j                  t         j                        } | j                         \  }}y# t        $ r Y yw xY w)z3
    Return whether or not xauth is installed.
    xauthz-VstdoutstderrTF)
subprocessPopenPIPEcommunicateFileNotFoundError)r   _s     r   is_installedr      sY      dO????	
   "1   s   A	A 	AAc                  r    t        j                  d      } t        j                  |       j	                         S )z6
    Generate a cookie string suitable for xauth.
       )osurandomhashlibmd5	hexdigest)datas    r   generate_mcookier    !   s)     ::b>D;;t&&((r
   c                      t        j                  dgt        |       z   t         j                  t         j                        }|j	                         \  }}y)z)
    Call xauth with the given args.
    r   r   N)r   r   listr   r   )argsr   r   s      r   callr$   )   sD     		DJ	E DAqr
   )	r   r   r   r   	Exceptionr   r   r    r$   r	   r
   r   <module>r&      s,    "  	 *I *,)
r
   