관리-도구
편집 파일: read.cpython-36.pyc
3 �ft`� � @ s~ d dl mZ d dl mZ d dlmZmZ d dlZd dlZ d dl Zd dlZd dlZd dl Z d dlZe jd�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 �/usr/lib/python3.6/read.py�__init__$ s zRepoReader.__init__c c s� x| j | jj�D ] }|V qW g }x8| jjD ],}x&tjtjj|d��D ]}|j|� qFW q,W |j dd� d� xT|D ]L}yx| j |�D ] }|V q�W W qr t jjk r� t jtd�|� Y qrX qrW d S )Nz*.repoc S s t jj| d d� �S )N� ���)r �utilZ split_path)�xr r r �<lambda>5 s 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 jjj|| jj�}tjj|�}|dk rl||krJtd�j |||| |�}ntd�j ||| |�}tj j|��tjj|| j�}y|j |||tjj� W nZ tk r� } z>||kr�td�j |||�}ntd�j ||�}tj j|��W Y dd}~X nX |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 �formatr r ZRepoZ _populateZPRIO_REPOCONFIG� ValueErrorZ _get_priorityZPRIO_DEFAULTr r r r# Z_substitutions�updateZcfg) r �parserZid_r! Zsubstituted_idZinvalid�msgr'