§
    ôcT  ã                   ó`   — d dl Z d dlZd dlZd dlmZ  e j        e¦  «        ZdZd„ Z	d„ Z
d„ ZdS )é    N)ÚexecuteéK   c           	      óü   — |                      ¦   «         D ]+\  }}|                     d|z  t          |¦  «        ¦  «        }Œ,t          j        d|¦  «        D ]%}t
                               | › d|› d|› d�¦  «         Œ&|S )zÀ
    Given a config filename, a hook description, a single hook command, and a dict of context
    names/values, interpolate the values by "{name}" into the command and return the result.
    z{%s}z{\w+}z: Variable 'z' is not supported in z hook)ÚitemsÚreplaceÚstrÚreÚfindallÚloggerÚwarning)Úconfig_filenameÚhook_descriptionÚcommandÚcontextÚnameÚvalueÚunsupported_variables          ú9/usr/lib/python3/dist-packages/borgmatic/hooks/command.pyÚinterpolate_contextr      sš   € ð
 —}’}‘”ð =ð =‰ˆˆeØ—/’/ &¨4¡-µ°U±´Ñ<Ô<ˆˆå "¤
¨8°WÑ =Ô =ð 
ð 
ÐÝ�ŠØÐoÐoÐ,@ÐoÐoÐXhÐoÐoÐoñ	
ô 	
ð 	
ð 	
ð €Nó    c                 ój  ‡‡‡— | s0t                                d                     ‰‰¦  «        ¦  «         dS |rdnd}‰‰d<   ˆˆˆfd„| D ¦   «         } t          | ¦  «        dk    r0t                                d                     ‰‰|¦  «        ¦  «         n=t                                d	                     ‰t          | ¦  «        ‰|¦  «        ¦  «         |rmt          t          |¦  «        d
¦  «        }t                                d                     ‰t          |¦  «        ¦  «        ¦  «         t          j	        |¦  «        }nd}	 | D ]8}	|s4t          j        |	g‰dk    rt          j        nt          j        d¬¦  «         Œ9	 |rt          j	        |¦  «         dS dS # |rt          j	        |¦  «         w w xY w)a¹  
    Given a list of hook commands to execute, a umask to execute with (or None), a config filename,
    a hook description, and whether this is a dry run, run the given commands. Or, don't run them
    if this is a dry run.

    The context contains optional values interpolated by name into the hook commands.

    Raise ValueError if the umask cannot be parsed.
    Raise subprocesses.CalledProcessError if an error occurs in a hook.
    z"{}: No commands to run for {} hookNz& (dry run; not actually running hooks)Ú Úconfiguration_filenamec                 ó4   •— g | ]}t          ‰‰|‰¦  «        ‘ŒS © )r   )Ú.0r   r   r   Údescriptions     €€€r   ú
<listcomp>z execute_hook.<locals>.<listcomp>/   s5   ø€ ð ð ð ØPWÕ˜O¨[¸'À7ÑKÔKðð ð r   é   z!{}: Running command for {} hook{}z%{}: Running {} commands for {} hook{}é   z{}: Set hook umask to {}zon-errorT)Úoutput_log_levelÚshell)r   ÚdebugÚformatÚlenÚinfoÚintr   ÚoctÚosÚumaskr   Úexecute_commandÚloggingÚERRORÚWARNING)
Úcommandsr*   r   r   Údry_runr   Údry_run_labelÚparsed_umaskÚoriginal_umaskr   s
     `` `    r   Úexecute_hookr4      s  øøø€ ð ð Ý�ŠÐ9×@Ò@ÀÐR]Ñ^Ô^Ñ_Ô_Ð_Øˆà@GÐOÐ<Ð<ÈR€Mà(7€GÐ$Ñ%ðð ð ð ð ð Ø[cðñ ô €Hõ ˆ8�}„}˜ÒÐÝ�ŠØ/×6Ò6°ÈÐUbÑcÔcñ	
ô 	
ð 	
ð 	
õ 	�ŠØ3×:Ò:Ø¥ X¡¤°¸]ñô ñ	
ô 	
ð 	
ð ð Ý�3˜u™:œ: qÑ)Ô)ˆÝ�ŠÐ/×6Ò6°ÍÈLÑHYÔHYÑZÔZÑ[Ô[Ð[Ýœ ,Ñ/Ô/ˆˆàˆð%Øð 	ð 	ˆGØð ÝÔ'Ø�Ià" jÒ0Ð0õ &-¤] ]å œØðñ ô ð øð	ð ð 	%ÝŒH�^Ñ$Ô$Ð$Ð$Ð$ð	%ð 	%øˆ>ð 	%ÝŒH�^Ñ$Ô$Ð$Ð$ð	%øøøs   Å;F ÆF2c                 ó°   — t          |dd¦  «        }|€dS |t          k    r5t                               d                     | t          ¦  «        ¦  «         dS dS )a   
    Given a configuration filename and an exception object, return whether the exception object
    represents a subprocess.CalledProcessError with a return code of SOFT_FAIL_EXIT_CODE. If so,
    that indicates that the error is a "soft failure", and should not result in an error.
    Ú
returncodeNFzT{}: Command hook exited with soft failure exit code ({}); skipping remaining actionsT)ÚgetattrÚSOFT_FAIL_EXIT_CODEr   r&   r$   )r   ÚerrorÚ	exit_codes      r   Úconsidered_soft_failurer;   T   sg   € õ ˜˜|¨TÑ2Ô2€IØÐØˆuàÕ'Ò'Ð'Ý�ŠØb×iÒiØÕ!4ñô ñ	
ô 	
ð 	
ð
 ˆtàˆ5r   )r,   r)   r	   Ú	borgmaticr   Ú	getLoggerÚ__name__r   r8   r   r4   r;   r   r   r   ú<module>r?      s„   ðØ €€€Ø 	€	€	€	Ø 	€	€	€	à Ð Ð Ð Ð Ð à	ˆÔ	˜8Ñ	$Ô	$€ð Ð ðð ð ð 4%ð 4%ð 4%ðnð ð ð ð r   