Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/dnf-plugins/
Upload File :
Current File : //lib/python2.7/site-packages/dnf-plugins/config_manager.pyc

�
	i/\c@@s�ddlmZddlmZddlmZmZmZddlZddlZddl	Zddl
Z
ddlZddlZej
jdejjfd��Y�Zd�Zejd�Zejd	�Zejd
�Zejd�Zd�ZdS(
i(tabsolute_import(tunicode_literals(t_tloggertP_NtConfigManagerCommandcB@sPeZdgZed�Zed��Zd�Zd�Zd�Z	d�Z
RS(uconfig-manageru1manage dnf configuration options and repositoriescC@s�|jddddddtd��|jdd	td
ddtd��|jd
d	gd
ddddtd��|jdd	td
ddtd��|jdd	td
ddtd��dS(Nucrepotnargsu*tmetavarurepothelpurepo to modifyu--savetdefaulttactionu
store_trueu/save the current options (useful with --setopt)u
--add-repouappenduURLu8add (and enable) the repo from the specified file or urlu--dumpu,print current configuration values to stdoutu--dump-variablesuprint variable values to stdout(tadd_argumentRtFalse(tparser((s>/usr/lib/python2.7/site-packages/dnf-plugins/config_manager.pyt
set_argparser%s



cC@sU|jj}t|_|jjsE|jjsE|jjsE|jjrQt|_	ndS(N(
tclitdemandstTruetavailable_repostoptstsavetset_enabledtset_disabledtadd_repot	root_user(tselfR((s>/usr/lib/python2.7/site-packages/dnf-plugins/config_manager.pyt	configure7s
	cC@sb|jjr;|jjr;tjtd��t|j_n|jjrT|j�n
|j�dS(uExecute the util action here.u.Error: Trying to enable already enabled repos.N(	RRtcrepoRterrorRRRtmodify_repo(R((s>/usr/lib/python2.7/site-packages/dnf-plugins/config_manager.pytrunAs
c	C@s5|jj}i}t|jd�r?|jjr?|jj}n|jjr�x5|jjjj�D]\}}d||fGHqaWn|jjs�d|jjkr@|jj	r�|r�|jjj
tjj
d|j|�n|jjr@|jjjd�GHx*|j�D]\}}|j||�q	W|jjj�GHq@n|jjsX|jjrgt|j_	n|jjr�g}x7|jjD]"}|j|jjj|��q�WndS|s�tjjtd�dj|jj���nxGt|�D]9}t|�}|jjrd|d<n|jjr8d	|d<nt|jd
�r||j|jjkr||j |jj|j�n|jj	r�|r�|jjj
|j!|j|j|�n|jjr�|jjjd|j�GHx?|j�D]1\}}|j"|�}|r�|j#|�q�q�W|j�GHq�q�WdS(u< process --set-enabled, --set-disabled and --setopt options umain_setoptsu%s = %sumainNuNo matching repo to modify: %s.u, iuenablediurepo_setoptsurepo: ($tbasetconfthasattrRtmain_setoptstdump_variablest
substitutionstitemsRRtwrite_raw_configfiletdnftconstt
CONF_FILENAMEtdumptoutputt
fmtSectiont
_set_valueRRRtextendtrepostget_matchingt
exceptionstErrorRtjointsortedtdicttidtrepo_setoptstupdatetrepofilet_get_optiont_set(	Rtsbctmodifytnametvaltmatchedtrepotrepo_modifytopt((s>/usr/lib/python2.7/site-packages/dnf-plugins/config_manager.pyRMsV"(#

(c
C@s�|jjj}d}xj|jjD]\}tjjj|�jdkr_dt	j
j|�}ntj
td�|�|jd�r't	j
j|�}t	j
j||�}yI|jj|dd�}tj|j|�t	j|d�|j�Wq~tk
r#}|d	7}tj|�q"q~Xq"t|�}d
|}t	j
j|d|�}d|||f}	t||	�s"q"q"q"W|r�tjjtd
d|���ndS(u process --add-repo option iuufile://uAdding repo from: %su.repotmodeuw+i�iu%created by dnf config-manager from %su%s.repou"[%s]
name=%s
baseurl=%s
enabled=1
uConfiguration of repo faileduConfiguration of repos failedN(RR tget_reposdirRRR'tpycompturlparsetschemetostpathtabspathRtinfoRtendswithtbasenameR3turlopentshutiltcopy2R>tchmodtclosetIOErrorRtsanitize_url_to_fstsave_to_fileR1R2R(
Rt	myrepodirterrors_countturltdestnametftetrepoidtreponametcontent((s>/usr/lib/python2.7/site-packages/dnf-plugins/config_manager.pyR�s8




(t__name__t
__module__taliasesRtsummarytstaticmethodRRRRR(((s>/usr/lib/python2.7/site-packages/dnf-plugins/config_manager.pyRs		
		4cC@syy?t|d��*}tjj||�tj|d�WdQXWn3ttfk
rt}tj	t
d�||�tSXtS(Nuw+i�u&Could not save repo to repofile %s: %s(
topenR'RFt
write_to_fileRIRRRTtOSErrorRRRRR(tfilenameR_tfdR\((s>/usr/lib/python2.7/site-packages/dnf-plugins/config_manager.pyRV�s
u^\w+:/*(\w+:|www\.)?u[?/:&#|~\*\[\]\(\)\'\\]+u^[,.]*u[,.]*$cC@s�y�tj|�r�tjjr9|jd�jd�}q�t|t�rc|jd�jd�}n|jd�}t|t	�r�|jd�}q�nWnt
ttt
fk
r�nXtjd|�}tjd|�}tjd|�}tjd|�}t|�dkr||d jd�}dt|d�}tjjjdg�}|j||�|| d|j�}nd	}tj|d|�S(
u�Return a filename suitable for the filesystem and for repo id

    Strips dangerous and common characters to create a filename we
    can use to store the cache in.
    uidnauutf-8uu_i�i�i����usha256uE[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:-](t	RE_SCHEMEtmatchR'RFtPY3tencodetdecodet
isinstancetstrtunicodetUnicodeDecodeErrortUnicodeEncodeErrortUnicodeErrort	TypeErrortsubtRE_SLASHtRE_BEGINtRE_FINALtlentsplittyumtmisct	ChecksumsR8t	hexdigesttre(RYtpartst	lastindextcsumt
allowed_regex((s>/usr/lib/python2.7/site-packages/dnf-plugins/config_manager.pyRU�s.(t
__future__RRtdnfpluginscoreRRRR'tdnf.clit
dnf.pycompRIR�RPtplugintregister_commandRtCommandRRVtcompileRjRwRxRyRU(((s>/usr/lib/python2.7/site-packages/dnf-plugins/config_manager.pyt<module>s �	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]