o
    UÀ7e  ã                   @   sœ   d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	 ejZ
dd„ ZeZedƒ edƒ edƒ ed	ƒ ed
ƒ G dd„ dƒZdS )é    )Úprint_functionN)ÚPIPEc                 C   s   | S ©N© )Úer   r   ú</usr/lib/python3/dist-packages/softwareproperties/AptAuth.pyÚdummy$   s    r   z;Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>z:Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>zBUbuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>zAUbuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>zBUbuntu Extras Archive Automatic Signing Key <ftpmaster@ubuntu.com>c                   @   s>   e Zd Zddd„Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ ZdS )ÚAptAuthú/c                 C   sz   || _ t ¡ | _tj | jd¡| _t| jdƒ�}| 	d| j  ¡ W d   ƒ n1 s*w   Y  | jtj
d< t | j¡ d S )Nzapt.confÚwz
DIR "%s";
Ú
APT_CONFIG)ÚrootdirÚtempfileÚmkdtempÚtmpdirÚosÚpathÚjoinÚaptconfÚopenÚwriteÚenvironÚatexitÚregisterÚ_cleanup_tmpdir)Úselfr   Úfr   r   r   Ú__init__/   s   
ÿzAptAuth.__init__c                 C   s   t  | j¡ d S r   )ÚshutilÚrmtreer   )r   r   r   r   r   8   s   zAptAuth._cleanup_tmpdirc           	      C   s¢   g d¢}g }t j|ttdd�}d}|j ¡ D ]8}| d¡}|d dv r'|d }|d d	kr=|d
 }tj t	|d ƒ¡ 
¡ }|s@q| d||t|ƒf ¡ d}q|S )N)ú/usr/bin/apt-keyú--quietÚadvz--with-colonsz--batchz--fixed-list-modez--list-keysT)ÚstdoutÚstderrÚtextÚ ú:r   )ÚpubÚuidé	   r(   é   é   z%s %s
%s)Ú
subprocessÚrunr   r#   Ú
splitlinesÚsplitÚdatetimeÚdateÚfromtimestampÚintÚ	isoformatÚappendÚ_)	r   ÚcmdÚresÚprocessÚnameÚlineÚfieldsÚkeyÚexpiryr   r   r   Úlist;   s    
zAptAuth.listc                 C   ó"   dddd|g}t j|td�jdkS )Nr    r!   ú
--fakerootÚadd©r$   r   ©r-   r.   r   Ú
returncode)r   Úfilenamer8   r   r   r   rC   M   ó   zAptAuth.addc                 C   s   g d¢}t j|td�jdkS )N)r    r!   rB   ÚupdaterD   r   rE   )r   r8   r   r   r   rI   Q   s   zAptAuth.updatec                 C   rA   )Nr    r!   rB   ÚrmrD   r   rE   )r   r>   r8   r   r   r   rJ   U   rH   z
AptAuth.rmN)r
   )	Ú__name__Ú
__module__Ú__qualname__r   r   r@   rC   rI   rJ   r   r   r   r   r	   .   s    
	r	   )Ú
__future__r   r   r1   Úgettextr   r   r-   r   r   r7   r   ÚN_r	   r   r   r   r   Ú<module>   s$   