a 2h&@s`ddlmZddlmZddlmZddlZddlZ ddl Z ddl Z ej j Z GdddeZdS))unicode_literals) ConfigError)_Ncs~eZdZddZddZddZddZdd d Zd d ZddZ ddZ ddZ fddZ ddZ ddZddZZS)RepoDictc Csl|j}||vrd}t||z|jWn2ty^}ztd|WYd}~n d}~00|||<dS)Nz;Repository %s is listed more than once in the configurationz{0})idrZ_repoZverify RuntimeErrorformat)selfrepoZid_msger 0/usr/lib/python3.9/site-packages/dnf/repodict.pyadd#s $z RepoDict.addcCstj|SN)dnfutil MultiCallListvaluesr r r rall/sz RepoDict.allcCstj| Sr)rrempty iter_enabledrr r r _any_enabled3szRepoDict._any_enabledcCsH|D]:}|||jD]$}|jsttd|j|qqdS)Nzenabling %s repository)r get_matchingrenabledloggerinforenable)r Z sub_name_fnr foundr r r_enable_sub_repos6s  zRepoDict._enable_sub_reposr c  sfdd}tj|}|D]2}d|vr.substitutez://z file://{}zAdded %s repo from %sz, )rr ZReporospathabspathbaseurlitemssetattrrrrrjoin) r Zrepoidr$r.kwargsr%r r,keyr)r r*r add_new_repo=s  zRepoDict.add_new_repocCsdd}||dS)z@enable debug repos corresponding to already enabled binary reposcSs&|drd|ddSd|S)N-rpmsz {}-debug-rpmsz {}-debuginfoendswithrnamer r r debug_nameesz/RepoDict.enable_debug_repos..debug_nameNr )r r;r r renable_debug_reposaszRepoDict.enable_debug_reposcCsdd}||dS)zAenable source repos corresponding to already enabled binary reposcSs&|drd|ddSd|S)Nr5z{}-source-rpmsr6z {}-sourcer7r9r r r source_nameosz1RepoDict.enable_source_repos..source_nameNr<)r r>r r renable_source_reposkszRepoDict.enable_source_reposcsZtjr,fddD}tj|Sd}|durLtjgStj|gS)Ncs g|]}t|r|qSr )fnmatch).0kr3r r r xz)RepoDict.get_matching..)rrZis_glob_patternrget)r r3lr r rCrrus    zRepoDict.get_matchingcCsdd|DS)Ncss|]}|jr|VqdSr)r)rArr r r rEz(RepoDict.iter_enabled..)rrr r rrszRepoDict.iter_enabledcs$ddttt|dddDS)zreturn repos sorted by prioritycss|] }|VqdSrr )rAitemr r rrIrEz!RepoDict.items..cSs|dj|djfS)N)priorityZcost)xr r rrEz RepoDict.items..)r3)sortedsuperrr/r __class__r rr/szRepoDict.itemscCs|Sr)keysrr r r__iter__szRepoDict.__iter__cCsdd|DS)Ncss|]\}}|VqdSrr rArBvr r rrIrEz RepoDict.keys..r/rr r rrSsz RepoDict.keyscCsdd|DS)Ncss|]\}}|VqdSrr rUr r rrIrEz"RepoDict.values..rWrr r rrszRepoDict.values)r )__name__ __module__ __qualname__rrrr r4r=r?rrr/rTrSr __classcell__r r rQrr!s  $    r)Z __future__rZdnf.exceptionsrZdnf.i18nrZdnf.utilrZ libdnf.confr#r@r+rrdictrr r r rs