Your IP : 3.128.201.71


Current Path : /usr/lib/python3.6/site-packages/dnf/conf/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dnf/conf/__pycache__/read.cpython-36.opt-1.pyc

3

�ft`��@s~ddlmZddlmZddlmZmZddlZddlZ	ddl
ZddlZddlZddl
Z
ddlZe
jd�ZGdd�de�ZdS)�)�absolute_import)�unicode_literals)�_�ucdN�dnfc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
RepoReadercCs||_||_dS)N)�conf�opts)�selfrr	�r�/usr/lib/python3.6/read.py�__init__$szRepoReader.__init__ccs�x|j|jj�D]
}|VqWg}x8|jjD],}x&tjtjj|d��D]}|j|�qFWq,W|j	dd�d�xT|D]L}yx|j|�D]
}|Vq�WWqrt
jjk
r�t
jtd�|�YqrXqrWdS)Nz*.repocSstjj|dd��S)N����)r�utilZ
split_path)�xrrr�<lambda>5sz%RepoReader.__iter__.<locals>.<lambda>)�keyz'Warning: failed loading '%s', skipping.)�
_get_reposrZconfig_file_path�reposdir�glob�os�path�join�append�sortr�
exceptions�ConfigError�logger�warningr)r
�rZrepo_configsrr�repofnrrr�__iter__(s


zRepoReader.__iter__c	Cs^tjjj||jj�}tjj|�}|dk	rl||krJtd�j	|||||�}ntd�j	||||�}tj
j|��tjj||j�}y|j
|||tjj�WnZtk
r�}z>||kr�td�j	|||�}ntd�j	||�}tj
j|��WYdd}~XnX|jd�tjjk�r8||k�r td�j	||�}ntd�j	|�}tj|�t|j�|_|jj|jj�||_|S)	z)Build a repository using the parsed data.Nz&Bad id for repo: {} ({}), byte = {} {}z!Bad id for repo: {}, byte = {} {}z.Repository '{}' ({}): Error parsing config: {}z)Repository '{}': Error parsing config: {}�namez@Repository '{}' ({}) is missing name in configuration, using id.z;Repository '{}' is missing name in configuration, using id.)�libdnfr�ConfigParserZ
substitute�
substitutionsr�repoZrepo_id_invalidr�formatrrZRepoZ	_populateZPRIO_REPOCONFIG�
ValueErrorZ
_get_priorityZPRIO_DEFAULTrrrr#Z_substitutions�updateZcfg)	r
�parserZid_r!Zsubstituted_idZinvalid�msgr'�errr�_build_repo?s8




zRepoReader._build_repoccs|jj}tjj�}|j|�y|j|�Wndtk
rd}ztjj	t
d�j||���WYdd}~Xn,tk
r�}zt
j|�WYdd}~XnXx�|j�D]x}|dkr�q�y|j|t|�|�}Wn:tjjtjj	fk
r�}zt
j|�w�WYdd}~XnX||_|j|j�|Vq�WdS)z4Parse and yield all repositories from a config file.zParsing file "{}" failed: {}N�main)rr&r$r%ZsetSubstitutions�read�RuntimeErrorrrrrr(�IOErrorrrZgetDatar.rZ	RepoErrorZrepofileZ_configure_from_optionsr	)r
r!Zsubstsr+r-ZsectionZthisreporrrrhs(

(
zRepoReader._get_reposN)�__name__�
__module__�__qualname__r
r"r.rrrrrr#s)r)Z
__future__rrZdnf.i18nrrZdnf.confrZlibdnf.confr$Zdnf.exceptionsZdnf.reporZloggingrZ	getLoggerr�objectrrrrr�<module>s


?>