Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/tracer/packageManagers/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/tracer/packageManagers/__pycache__/dpkg.cpython-36.opt-1.pyc

3

"eZ�@stddlmZddlmZej�dkrpddlmZddlmZddl	m
Z
ddlZddlZddl
Z
Gd	d
�d
e�ZdS)�)�absolute_import)�SystemZdebian�)�IPackageManager)�Package)�PackagesCollectionNc@sDeZdZdZdd�Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dS)�Dpkgz"
		Package manager class - DPKG
		cKs
||_dS)N)Zopts)�self�kwargs�r�/usr/lib/python3.6/dpkg.py�__init__'sz
Dpkg.__init__cCsdS)Nz/var/log/dpkg.logr)r	rrr�dpkg_log*sz
Dpkg.dpkg_logcCs�t�}t|jd�}xp|D]h}|jd�}|ddkr4qtjtj|dd|dd��}||kr|djd	�d}|jt||��qW|S)
zp
			Returns list of packages which were modified between unix_time and present
			Requires root permissions.
			�r� �Zupgraderrz%Y-%m-%d %H:%M:%S��:)	r�openr�split�timeZmktimeZstrptime�appendr)r	Z	unix_timeZnewer�log�lineZmodified�pkg_namerrr�packages_newer_than-s

zDpkg.packages_newer_thancCsrg}ttjd�}dd|g}tj|tj|d�}|j�d}x4|j�jd�dd	�D]}tj	j
|�rP|j|�qPW|S)
z)Returns list of files provided by package�wz
dpkg-queryz-L)�stdout�stderrr�
Nr���)r�os�devnull�
subprocess�Popen�PIPE�communicate�decoder�path�isfiler)r	r�filesZfnull�command�process�out�filerrr�
package_filesDs
zDpkg.package_filescCsjd}tjdd|jgtjd�}|j�d}|j�jd�}x(|D] }|jd�r<|jd�dj�}q<W||_	dS)	zFFrom database load informations about given package and set them to itNZdpkgz-s)rrrzDescription:r)
r#r$�namer%r&r'r�
startswith�strip�description)r	�packager3r,r-rrrr�load_package_infoPs

zDpkg.load_package_infocCsLdd|jg}tj|tjd�}|j�d}|j�jd�d}t|jd�d�S)z8Returns name of package which provides given applicationZdlocatez-S)rrrr)r0r#r$r%r&r'rr)r	Zappr+r,rrrr�provided_by^s
zDpkg.provided_byN)�__name__�
__module__�__qualname__�__doc__r
�propertyrrr/r5r6rrrrr sr)Z
__future__rZtracer.resources.systemrZdistributionZipackageManagerrZtracer.resources.packagerZtracer.resources.collectionsrr#rr!rrrrr�<module>s

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists