o
    e                     @  s   d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl	m
Z
 ddlm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lmZmZmZmZ edZdd ZdddZedkrje e  dS dS )z!ocrmypdf command line entrypoint.    )annotationsN)suppress)set_start_method)__version__)get_parser_options_plugins)run_pipeline)check_options)	Verbosityconfigure_logging)BadArgsErrorExitCodeInputFileErrorMissingDependencyErrorocrmypdfc                  G  s   t d)NzLost access to the input file)r   args r   AD:\Projects\ConvertPro\env\Lib\site-packages\ocrmypdf/__main__.pysigbus   s   r   c              
   C  s  t | d\}}}ttt td W d    n1 sw   Y  |j}ttj	
 s0d|_|jr9tj}d|_t||jd|d tdt zt|| W nL tyi } zt| tjW  Y d }~S d }~w ty } zt| |jW  Y d }~S d }~w ty } zt| tjW  Y d }~S d }~ww ttt ttjt W d    n1 sw   Y  t||d}|S )Nr      FT)Zprogress_bar_friendlyZmanage_root_loggerplugin_managerzocrmypdf %s)optionsr   ) r   r   AttributeErrorPermissionErrorosZniceverboseisattysysstderrfilenoprogress_barquietr	   r
   logdebugr   r   
ValueErrorerrorr   Zbad_argsr   	exit_coder   Zmissing_dependencyOSErrorsignalZSIGBUSr   r   )r   _parserr   r   	verbosityeresultr   r   r   run#   sJ   


r-   __main__)N)!__doc__
__future__r   loggingr   r(   r   
contextlibr   multiprocessingr   r   r   Zocrmypdf._plugin_managerr   Zocrmypdf._syncr   Zocrmypdf._validationr   Zocrmypdf.apir	   r
   Zocrmypdf.exceptionsr   r   r   r   	getLoggerr"   r   r-   __name__exitr   r   r   r   <module>   s(   

&