Current File : //lib/python3.9/site-packages/dnf/conf/__pycache__/read.cpython-39.pyc |
a
�!c� � @ s~ d dl mZ d dl mZ d dlmZmZ d dlZd dlZ d dl
Zd dlZd dlZd dl
Z
d dlZe
�d�ZG dd� de�ZdS )� )�absolute_import)�unicode_literals)�_�ucdN�dnfc @ s, e Zd Zdd� Zdd� Zdd� Zdd� Zd S )
�
RepoReaderc C s || _ || _d S )N)�conf�opts)�selfr r � r �1/usr/lib/python3.9/site-packages/dnf/conf/read.py�__init__$ s zRepoReader.__init__c c s� | � | jj�D ]
}|V qg }| jjD ](}t�tj�|d��D ]}|�|� q>q&|j dd� d� |D ]F}z| � |�D ]
}|V qtW qd t
jjy� t
�td�|� Y qd0 qdd S )Nz*.repoc S s t j�| d d� �S )N���)r �utilZ
split_path)�xr r r �<lambda>5 � z%RepoReader.__iter__.<locals>.<lambda>)�keyz'Warning: failed loading '%s', skipping.)�
_get_reposr Zconfig_file_path�reposdir�glob�os�path�join�append�sortr �
exceptions�ConfigError�logger�warningr )r
�rZrepo_configsr r �repofnr r r �__iter__( s
�zRepoReader.__iter__c
C s` t jj�|| jj�}tj�|�}|durl||krJtd�� |||| |�}ntd�� ||| |�}tj
�|��tj�|| j�}z|�
|||tjj� W n\ ty� } zD||kr�td�� |||�}ntd�� ||�}tj
�|��W Y d}~n
d}~0 0 |�d�tjjk�r:||k�r"td�� ||�}ntd�� |�}t�|� t|j�|_|j�| 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 �formatr r ZRepoZ _populateZPRIO_REPOCONFIG�
ValueErrorZ
_get_priorityZPRIO_DEFAULTr r r r# Z_substitutions�updateZcfg) r
�parserZid_r! Zsubstituted_idZinvalid�msgr'