o bU@szddlmZWn eydZYnwddlZddlZddlmZmZddlmZe e Z e dZ GdddZd dd ZdS) )datetimeN)PIPEPopen)dumpsz4.*?/usr/lib/python(\d(?:.\d+)?)/(site|dist)-packagesc@seZdZddZddZdS)memoizecCs||_i|_dSN)funccache)selfrr (/usr/share/python3/debpython/__init__.py__init__s zmemoize.__init__cOs6t||f}||jvr|j|i||j|<|j|Sr)rr r)r argskwargskeyr r r __call__s   zmemoize.__call__N)__name__ __module__ __qualname__r rr r r r rs rc Cs d||d}d}|dur n;|dur|jttdn/|rHt|tr'd}t|d}tr5|dt |d|| |j||dt d |t |fi|&}|\}}|ob|t|j|olt|d |ort|d d WdS1swYdS) a<Execute external shell 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 T)shellcwdenvFN)stdoutstderraz # command executed on {}z $ {} z invoking: %szutf-8) returncoderr)updater isinstancestropenrwriteformatnow isoformatflushlogdebugr communicateclosedictr) commandrr log_outputrr(processrrr r r executes2        $r-)NNN)r ImportErrorloggingre subprocessrrpickler getLoggerrr%compile PUBLIC_DIR_RErr-r r r r s