Your IP : 3.144.9.183


Current Path : /usr/lib/python3.6/site-packages/dnf/conf/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dnf/conf/__pycache__/substitutions.cpython-36.pyc

3

��fj
�@sLddlZddlZddlZddlmZejd�Zejd�ZGdd�de	�Z
dS)�N)�_z^DNF_VAR_[A-Za-z0-9_]+$Zdnfcs.eZdZ�fdd�Zdd�Zd
dd�Z�ZS)�
Substitutionscstt|�j�|j�dS)N)�superr�__init__�_update_from_env)�self)�	__class__��#/usr/lib/python3.6/substitutions.pyr"szSubstitutions.__init__cCs\dd�tdd�D�}xBtjj�D]4\}}tj|�rD|||dd�<q ||kr |||<q WdS)NcSsg|]}d|�qS)zDNF%dr	)�.0Znumr	r	r
�
<listcomp>'sz2Substitutions._update_from_env.<locals>.<listcomp>r�
�)�range�os�environ�items�ENVIRONMENT_VARS_RE�match)rZnumericvars�key�valr	r	r
r&s
zSubstitutions._update_from_env�/etc/yum/vars/�/etc/dnf/vars/cCs�x|D�]�}g}y"tjj||jd��}tj|�}Wntk
rJwYnXx�|D]�}tjj||�}d}tjj|�r�y<t|��}	|	j�}WdQRX|r�|ddkr�|dd�}Wn@tt	t
fk
r�}
ztjt
d�j||
��wRWYdd}
~
XnX|dk	rR|||<qRWqWdS)N�/��
z2Error when parsing a variable from file '{0}': {1}���r)r�path�join�lstrip�listdir�OSError�isfile�open�readline�IOError�UnicodeDecodeError�loggerZwarningr�format)rZinstallrootZvarsdirZ	vars_pathZfsvarsZ
dir_fsvarsZfsvar�filepathr�fp�er	r	r
�update_from_etc.s*

zSubstitutions.update_from_etc�rr)r-)�__name__�
__module__�__qualname__rrr,�
__classcell__r	r	)rr
rsr)Zloggingr�reZdnf.i18nr�compilerZ	getLoggerr'�dictrr	r	r	r
�<module>s



?>