ok

Mini Shell

Direktori : /lib/python3.6/site-packages/dnf/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/dnf/__pycache__/repodict.cpython-36.pyc

3

��f&�@s`ddlmZddlmZddlmZddlZddlZ	ddl
Z
ddlZejj
Z
Gdd�de�ZdS)�)�unicode_literals)�ConfigError)�_Ncs�eZdZdd�Zdd�Zdd�Zdd�Zffd	d
�Zdd�Zd
d�Z	dd�Z
dd�Z�fdd�Zdd�Z
dd�Zdd�Z�ZS)�RepoDictcCsj|j}||krd}t||��y|jj�Wn0tk
r\}ztdj|���WYdd}~XnX|||<dS)Nz;Repository %s is listed more than once in the configurationz{0})�idrZ_repoZverify�RuntimeError�format)�self�repoZid_�msg�e�r
�/usr/lib/python3.6/repodict.py�add#s zRepoDict.addcCstjj|j��S)N)�dnf�util�
MultiCallList�values)r	r
r
r�all/szRepoDict.allcCstjj|j��S)N)rr�empty�iter_enabled)r	r
r
r�_any_enabled3szRepoDict._any_enabledcCsPxJ|j�D]>}x8|j||j��D]$}|js tjtd�|j�|j�q Wq
WdS)Nzenabling %s repository)r�get_matchingr�enabled�logger�infor�enable)r	Zsub_name_fnr
�foundr
r
r�_enable_sub_repos6s
zRepoDict._enable_sub_reposc
s��fdd�}tjj|��}x:|D]2}d|kr>djtjj|��}|j||�g7_q Wx$|j�D]\}}	t	||||	��q`W|j
|�tjt
d�|dj|��|S)a�
        Creates new repo object and add it into RepoDict. Variables in provided values will be
        automatically substituted using conf.substitutions (like $releasever, ...)

        @param repoid: Repo ID - string
        @param conf: dnf Base().conf object
        @param baseurl: List of strings
        @param kwargs: keys and values that will be used to setattr on dnf.repo.Repo() object
        @return: dnf.repo.Repo() object
        cspt|t�rtjjj|�j�St|t�s0t|t�rlg}x.|D]&}t|t�r:|j	tjjj|�j��q:W|rl|S|S)N)
�
isinstance�str�libdnf�confZConfigParser�
substituteZ
substitutions�list�tuple�append)rZsubstituted�value)r"r
rr#Is


z)RepoDict.add_new_repo.<locals>.substitutez://z	file://{}zAdded %s repo from %sz, )rr
ZRepor�os�path�abspath�baseurl�items�setattrrrrr�join)
r	Zrepoidr"r+�kwargsr#r
r)�keyr'r
)r"r�add_new_repo=s


zRepoDict.add_new_repocCsdd�}|j|�dS)z@enable debug repos corresponding to already enabled binary reposcSs&|jd�rdj|dd��Sdj|�S)Nz-rpmsz
{}-debug-rpms�z{}-debuginfo���)�endswithr)�namer
r
r�
debug_nameesz/RepoDict.enable_debug_repos.<locals>.debug_nameN)r)r	r6r
r
r�enable_debug_reposaszRepoDict.enable_debug_reposcCsdd�}|j|�dS)zAenable source repos corresponding to already enabled binary reposcSs&|jd�rdj|dd��Sdj|�S)Nz-rpmsz{}-source-rpmsr2z	{}-sourcer3)r4r)r5r
r
r�source_nameosz1RepoDict.enable_source_repos.<locals>.source_nameN)r)r	r8r
r
r�enable_source_reposkszRepoDict.enable_source_reposcsZtjj��r,��fdd��D�}tjj|�S�j�d�}|dkrLtjjg�Stjj|g�S)Ncs g|]}tj|��r�|�qSr
)�fnmatch)�.0�k)r0r	r
r�
<listcomp>xsz)RepoDict.get_matching.<locals>.<listcomp>)rrZis_glob_patternr�get)r	r0�lr
r
)r0r	rruszRepoDict.get_matchingcCsdd�|j�D�S)Ncss|]}|jr|VqdS)N)r)r;�rr
r
r�	<genexpr>�sz(RepoDict.iter_enabled.<locals>.<genexpr>)r)r	r
r
rrszRepoDict.iter_enabledcs$dd�ttt|�j�dd�d�D�S)zreturn repos sorted by prioritycss|]
}|VqdS)Nr
)r;�itemr
r
rrA�sz!RepoDict.items.<locals>.<genexpr>cSs|dj|djfS)N�)ZpriorityZcost)�xr
r
r�<lambda>�sz RepoDict.items.<locals>.<lambda>)r0)�sorted�superrr,)r	)�	__class__r
rr,�szRepoDict.itemscCs|j�S)N)�keys)r	r
r
r�__iter__�szRepoDict.__iter__cCsdd�|j�D�S)Ncss|]\}}|VqdS)Nr
)r;r<�vr
r
rrA�sz RepoDict.keys.<locals>.<genexpr>)r,)r	r
r
rrI�sz
RepoDict.keyscCsdd�|j�D�S)Ncss|]\}}|VqdS)Nr
)r;r<rKr
r
rrA�sz"RepoDict.values.<locals>.<genexpr>)r,)r	r
r
rr�szRepoDict.values)�__name__�
__module__�__qualname__rrrrr1r7r9rrr,rJrIr�
__classcell__r
r
)rHrr!s$


r)Z
__future__rZdnf.exceptionsrZdnf.i18nrZdnf.utilrZlibdnf.confr!r:r(rr�dictrr
r
r
r�<module>s

Zerion Mini Shell 1.0