3
.(]T                 @   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   sf   || _ tj | _tjj| jd| _t| jd}|j	d| j   W d Q R X | jtj
d< tj| j d S )Nzapt.confwz
DIR "%s";
Z
APT_CONFIG)rootdirtempfileZmkdtemptmpdirospathjoinZaptconfopenwriteenvironatexitregister_cleanup_tmpdir)selfr   fr   r   r   __init__/   s    
zAptAuth.__init__c             C   s   t j| j d S )N)shutilZrmtreer   )r   r   r   r   r   8   s    zAptAuth._cleanup_tmpdirc       	      C   s   dddddddg}g }t j|ttdd	j}d
}xx|D ]p}|jd}|d dkrV|d }|d dkr|d }tjjt|d j	 }|sq4|j
d||t|f  d
}q4W |j  |S )Nz/usr/bin/apt-keyz--quietZadvz--with-colonsz--batchz--fixed-list-modez--list-keysT)stdoutstderrZuniversal_newlines :r   pubuid	         z%s %s
%s)r   r    )
subprocessPopenr   r   splitdatetimeZdateZfromtimestampintZ	isoformatappend_close)	r   cmdrespnamelineZfieldskeyZexpiryr   r   r   list;   s"    

zAptAuth.listc             C   s(   dddd|g}t j|td}|j dkS )Nz/usr/bin/apt-keyz--quietz
--fakerootadd)r   r   )r$   r%   r   wait)r   filenamer,   r.   r   r   r   r3   N   s    zAptAuth.addc             C   s&   ddddg}t j|td}|j dkS )Nz/usr/bin/apt-keyz--quietz
--fakerootupdate)r   r   )r$   r%   r   r4   )r   r,   r.   r   r   r   r6   S   s    zAptAuth.updatec             C   s(   dddd|g}t j|td}|j dkS )Nz/usr/bin/apt-keyz--quietz
--fakerootrm)r   r   )r$   r%   r   r4   )r   r1   r,   r.   r   r   r   r7   X   s    z
AptAuth.rmN)r	   )	__name__
__module____qualname__r   r   r2   r3   r6   r7   r   r   r   r   r   .   s   
	r   )Z
__future__r   r   r'   gettextr   r   r$   r   r   r*   r   ZN_r   r   r   r   r   <module>   s"   