o
    e)                     @  sl   d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	 dd Z
dd	 Zd
d Zdd Zdd Zdd ZdS )zInterface to jbig2 executable    )annotations)PIPE)MissingDependencyError)get_versionrunc                   C  s   t dddS )Njbig2zjbig2enc (\d+(\.\d+)*).*)regex)r    r	   r	   GD:\Projects\ConvertPro\env\Lib\site-packages\ocrmypdf/_exec/jbig2enc.pyversion   s   r   c                   C  s"   zt   W dS  ty   Y dS w )NFT)r   r   r	   r	   r	   r
   	available   s   r   c                 C  s4   dd|ddg}| | t|| ttd}|  |S )Nr   z-bz-s-pcwdstdoutstderr)extendr   r   check_returncode)r   infiles
out_prefixargsprocr	   r	   r
   convert_group   s   
	r   c                 C     t | d | d | d dS )Nr         )r   r   r   )r   r   r	   r	   r
   convert_group_mp*      r   c                 C  sP   dd|g}t |d}t|| |td}W d    n1 sw   Y  |  |S )Nr   r   wbr   )openr   r   r   )r   infileoutfiler   Zfstdoutr   r	   r	   r
   convert_single.   s   
r#   c                 C  r   )Nr   r   r   )r   r!   r"   )r#   r   r	   r	   r
   convert_single_mp6   r   r$   N)__doc__
__future__r   
subprocessr   Zocrmypdf.exceptionsr   Zocrmypdf.subprocessr   r   r   r   r   r   r#   r$   r	   r	   r	   r
   <module>   s   