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 Ú5 ó z%RepoReader.__iter__..)Ú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¡tjjkr:||kr"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' Úer r r Ú_build_repo? s> þ
ÿ"
ÿ
zRepoReader._build_repoc c s( | j j}tj ¡ }| |¡ z| |¡ W nh tyf } z$tj t
dƒ ||¡¡‚W Y d}~n6d}~0 ty’ } zt
|¡ W Y d}~n
d}~0 0 | ¡ D ]†}|dkrªqœz| |t|ƒ|¡}W nH tjjtjj fy } z"t
|¡ W Y d}~qœW Y d}~nd}~0 0 ||_| | j¡ |V qœdS )z4Parse and yield all repositories from a config file.zParsing file "{}" failed: {}NÚmain)r r&