
     h{                        U d dl Z d dlZd dlmZmZ d dl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 d dlmZmZ d dlmZmZ d	gZ ej                     ej        d
e           ej        dde dd ej        d                     ej        dddded           ej        dded          ej        dej        fd                                                                        Zdee         defdZeZ ej!        e"d	<   dS )    N)IterableOptional)__version__)
CLIContext)CLIRootConfigparse_cli_config) SIGNING_PLUGIN_ENTRY_POINT_GROUPSIGNING_PLUGIN_REGISTRY)DEFAULT_CONFIG_FILElogging_setup)	LogConfigparse_logging_configcli_rootpyHanko)	prog_nameversionz--configz.YAML file to load configuration from[default: ]Fr)helprequiredtypez	--verbosezRun in verbose modeT)r   r   defaultr   is_flagz--no-pluginsz"Disable non-builtin plugin loading)r   r   r   ctxc           	      b   d }|	 t          t          d          5 }|                                }d d d            n# 1 swxY w Y   t          }n# t          $ r Y nt          $ r1}t          j        dt           dt          |                     d }~ww xY w	 |                                }n6# t          $ r)}t          j        dt          |                     d }~ww xY w|                     t                     | j
        }d }|#t          |          }|j        |_        |j        }	nt          i           }	ddlm}
 t#          ||           } |
|           |r,|	d          }t%          t&          j        |j                  |	d <   nM|	d          j        }t%          t&          j        |          |	d	<   d
|	vrt%          t&          j        |          |	d
<   t/          |	|           |rt'          j        d           |t'          j        d| d           d S t'          j        d           d S )Nr   zFailed to read z: zFailed to read configuration:    )register)plugins_enabled)leveloutputzpyhanko_certvalidator.fetcherszfontTools.subsetzRunning with --verbosez$Finished reading configuration from .z$There was no configuration to parse.)openr   readFileNotFoundErrorIOErrorclickClickExceptionstrensure_objectr   objr   config
log_configr   commands.signingr   _load_pluginsr   loggingDEBUGr    WARNINGr   debug)r   r+   verbose
no_pluginsconfig_textfectx_objcfgr,   r   plugins_to_registerroot_logger_config
log_outputs                 M/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/pyhanko/cli/_root.py_rootr>      s   6 K~		)3// '1ffhh' ' ' ' ' ' ' ' ' ' ' ' ' ' '(FF  	 	 	D 	 	 	&A"5AAQAA  	
	 ++--KK 	 	 	&9Q99  	
 j!!!'G#'C{++^

 *"--
******'^LLLH !!! '-$-(:(A
 
 

4
  %,
7@/*8
 8
 8

34 Z// .7oj. . .J)* *g&&& 0.///FVFFFGGGGG<=====sU   A <A A  A A 
A 
B	B$,BBB. .
C!8$CC!root_configr   c                 t   dd l }|j        dk     r6ddlm}m} ddlm}m}  |             |             |             |            gS ddlm	 g d}g }|rj| |d | j
        D             z  }|j        dk     r.                                                    t          g           }n                    t          	          }fd
|D             }	t          t                    }
t!          d t          D                       }t#          j        |	|          D ]}|                                }t)          |t*                    sBt-          j        t-          j        d|j         dt+          |           dd                     m||vr2|                    |           |
                     |                       |
S )Nr   )      )
BEIDPluginPKCS11Plugin)PemderPluginPKCS12Plugin)metadata)z4pyhanko.cli.commands.signing.pkcs11_cli:PKCS11Pluginz2pyhanko.cli.commands.signing.pkcs11_cli:BEIDPluginz0pyhanko.cli.commands.signing.simple:PKCS12Pluginz0pyhanko.cli.commands.signing.simple:PemderPluginc                 ,    g | ]}t          |          S  )r(   ).0mods     r=   
<listcomp>z!_load_plugins.<locals>.<listcomp>   s    IIISCIII    )rA   
   )groupc                 J    g | ]}                     d |t                     S ) )namevaluerO   )
EntryPointr	   )rJ   vrG   s     r=   rL   z!_load_plugins.<locals>.<listcomp>   sI     ; ; ;  	2 	 	
 	
; ; ;rM   c              3   4   K   | ]}t          |          V  d S )N)r   )rJ   xs     r=   	<genexpr>z _load_plugins.<locals>.<genexpr>   s(      881tAww888888rM   zTPlugins must be defined as references to classes with a nullary init function, but 'z' is a z. Disregarding...T)bold)sysversion_info'pyhanko.cli.commands.signing.pkcs11_clirC   rD   #pyhanko.cli.commands.signing.simplerE   rF   	importlibrG   plugin_endpointsentry_pointsgetr	   listr
   set	itertoolschainload
isinstancer   r&   echostylerS   addappend)r?   r   rZ   rC   rD   rE   rF   to_loadeps_from_metadatato_load_as_endpointsresulting_pluginsseenep
plugin_clsrG   s                 @r=   r.   r.   q   su   JJJ
&  	
 	
 	
 	
 	
 	
 	
 	
	
 	
 	
 	
 	
 	
 	
 	
 

MM""""""  G 8: "IIK,HIIIIG g%% ( 5 5 7 7 ; ;0"! ! !) 5 56 !6 ! !
; ; ; ; ; ; ; 45588 788888Do24EFF 3 3WWYY
*d++ 		J=358= =j))= = = 	     T!!HHZ   $$ZZ\\222rM   )#rd   r/   typingr   r   r&   pyhankor   pyhanko.cli._ctxr   pyhanko.cli.configr   r   pyhanko.cli.plugin_apir	   r
   pyhanko.cli.runtimer   r   pyhanko.config.loggingr   r   __all__rO   version_optionoptionFileboolpass_contextContextr>   r.   r   Group__annotations__rI   rM   r=   <module>r      s7         % % % % % % % %        ' ' ' ' ' ' > > > > > > > >        C B B B B B B B B B B B B B B B, 	;???	,(	, 	, 	, 	C   		   	-		   @>u} @> @> @>     @? 4@>FCx6 C C C C CL %+     rM   