
    fV                         	 d dl m Z  d dlZd dlZd dlmZmZ d dlmZ  ej                  e
      Z ej                  d      Z G d d      Zd	dZy# e$ r dZ Y Rw xY w)
    )datetimeN)PIPEPopen)dumpsz4.*?/usr/lib/python(\d(?:.\d+)?)/(site|dist)-packagesc                       e Zd Zd Zd Zy)memoizec                      || _         i | _        y N)funccache)selfr   s     (/usr/share/python3/debpython/__init__.py__init__zmemoize.__init__   s    	
    c                     t        ||f      }|| j                  vr | j                  |i || j                  |<   | j                  |   S r
   )r   r   r   )r   argskwargskeys       r   __call__zmemoize.__call__   sG    T6N#djj 'dii88DJJsOzz#r   N)__name__
__module____qualname__r   r    r   r   r   r      s    r   r   c           	         d||d}d}|du rn||j                  t        t               n|rt        |t              rd}t	        |d      }t
        r@|j                  dj                  t        j                         j                                      |j                  dj                  t        |                    |j                          |j                  ||       t        j                  d	|        t        | fi |5 }|j                         \  }}|xr |j!                          t#        |j$                  |xr t        |d
      |xr t        |d
            cddd       S # 1 sw Y   yxY w)a6  Execute external commad.

    :param cdw: currennt working directory
    :param env: environment
    :param log_output:
        * opened log file or path to this file, or
        * None if output should be included in the returned dict, or
        * False if output should be redirectored to stdout/stderr
    F)shellcwdenvN)stdoutstderrTaz
# command executed on {}z
$ {}
zinvoking: %rzutf-8)
returncoder   r   )updater   
isinstancestropenr   writeformatnow	isoformatreprflushlogdebugr   communicateclosedictr!   )	commandr   r   
log_outputr   r/   processr   r   s	            r   executer4      s=    3s3DEU		4-	j#&Ej#.J9@@AYAYA[\]**4=9::j9IIng&	w	$	 <7 ,,.$*""$w11!:c&'&:!:c&'&:<< < <s    AE%%E.)NNN)r   ImportErrorloggingre
subprocessr   r   pickler   	getLoggerr   r,   compilePUBLIC_DIR_REr   r4   r   r   r   <module>r=      sc   !  	 " g!

RS	 	 </  Hs   A AA