HEX
Server: LiteSpeed
System: Linux w5304130.sdnsbox.com 4.18.0-425.3.1.lve.el8.x86_64 #1 SMP Tue Nov 22 22:59:23 EST 2022 x86_64
User: makefitmeserver (1001)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/dnf/__pycache__/plugin.cpython-36.pyc
3

�ft`�"�@s�ddlmZddlmZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZejd�ZdZGdd	�d	e�ZGd
d�de�Zdd
�Zdd�Zdd�Zdd�ZdS)�)�absolute_import)�print_function)�unicode_literalsN)�_�dnfzdnf.plugin.dynamicc@s\eZdZdZdZdZedd��Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�ZdS)�Pluginz5The base class custom plugins must derive from. #:apiz	<invalid>Ncs�tjj�}|jr|jn|j��fdd�|jD�}xb|D]Z}tjj|�r6y|j	|�Wq6t
k
r�}ztjj
td�t|���WYdd}~Xq6Xq6W|S)Ncsg|]}d|�f�qS)z
%s/%s.conf�)�.0�path)�namer�/usr/lib/python3.6/plugin.py�
<listcomp>9sz&Plugin.read_config.<locals>.<listcomp>zParsing file failed: %s)�libdnf�confZConfigParser�config_namerZpluginconfpath�osr
�isfile�read�	Exceptionr�
exceptionsZConfigErrorr�str)�clsr�parser�files�file�er)rr�read_config4s

.zPlugin.read_configcCs||_||_dS)N)�base�cli)�selfrrrrr�__init__BszPlugin.__init__cCsdS)Nr)rrrr�
pre_configGszPlugin.pre_configcCsdS)Nr)rrrr�configKsz
Plugin.configcCsdS)Nr)rrrr�resolvedOszPlugin.resolvedcCsdS)Nr)rrrr�sackSszPlugin.sackcCsdS)Nr)rrrr�pre_transactionWszPlugin.pre_transactioncCsdS)Nr)rrrr�transaction[szPlugin.transaction)�__name__�
__module__�__qualname__�__doc__rr�classmethodrr r!r"r#r$r%r&rrrrr.src@sveZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd
S)�PluginscCsg|_g|_dS)N)�
plugin_cls�plugins)rrrrr aszPlugins.__init__cCs~xx|jD]n}yt||��Wqtjjk
r6�Yqtk
rttj�\}}}tj	|||�}t
jdj|��YqXqWdS)N�)
r.�getattrrr�Errorr�sys�exc_info�	traceback�format_exception�loggerZcritical�join)r�method�plugin�exc_type�	exc_value�
exc_tracebackZexcept_listrrr�_callereszPlugins._callercsxxr|jdd�D]`}|j�t�fdd�|D��r2q|j|�}|jd�o^|jdd�o^|jdd�}|r|jj|�qWdS)zwChecks whether plugins are enabled or disabled in configuration files
           and removes disabled plugins from listNc3s|]}tj�|�VqdS)N)�fnmatch)r	�pattern)rrr�	<genexpr>usz)Plugins._check_enabled.<locals>.<genexpr>�mainZenabled)r-r�anyrZhas_sectionZ
has_optionZ
getboolean�remove)rr�enable_pluginsZplug_clsrZdisabledr)rr�_check_enabledps

zPlugins._check_enabledcCs�ttjkrtd��tjjt�tjt<}g|_t|j	||�}t
||�t�dd�|_|j
||�t|j�dkr�tdd�|jD��}tjtd�dj|��dS)z)Dynamically load relevant plugin modules.zload_plugins() called twiceNrcss|]}|jVqdS)N)r)r	r9rrrr@�sz Plugins._load.<locals>.<genexpr>zLoaded plugins: %sz, )�DYNAMIC_PACKAGEr2�modules�RuntimeErrorrZpycomp�
ModuleType�__path__�_get_plugins_filesZ
pluginpath�_import_modules�_plugin_classesr-rE�len�sortedr6�debugrr7)rrZskipsrD�packager�namesrrr�_loads

z
Plugins._loadcCs|jd�dS)Nr!)r=)rrrr�_run_pre_config�szPlugins._run_pre_configcCs|jd�dS)Nr")r=)rrrr�_run_config�szPlugins._run_configNcCs*x$|jD]}|||�}|jj|�qWdS)N)r-r.�append)rrrZp_clsr9rrr�	_run_init�s
zPlugins._run_initcCs|jd�dS)Nr$)r=)rrrr�run_sack�szPlugins.run_sackcCs|jd�dS)Nr#)r=)rrrr�run_resolved�szPlugins.run_resolvedcCs|jd�dS)Nr%)r=)rrrr�run_pre_transaction�szPlugins.run_pre_transactioncCs|jd�dS)Nr&)r=)rrrr�run_transaction�szPlugins.run_transactioncCstjt=dS)N)r2rGrF)rrrr�_unload�szPlugins._unloadcCs�|js
dSt�}x|jD]}||tj|j�<qWt|j��}t�}x |jD]}|j|j	|j
��qJW|sldSx|jD]}|j|j
�qtWx|D]}|jj
||�q�WdS)zH
        Unload plugins that were removed in the `transaction`.
        N)Z
remove_set�dictr.�inspectZgetfile�	__class__�set�keys�update�intersectionrZinstall_set�difference_updaterC)rr&r.r9Zplugin_filesZerased_plugin_filesZpkgZplugin_filerrr�unload_removed_plugins�s
zPlugins.unload_removed_plugins)N)r'r(r)r r=rErSrTrUrWrXrYrZr[r\rerrrrr,`s
r,cCstj�S)N)r�__subclasses__rrrrrM�srMcCs�x�|D]�}tjj|�\}}|jj|�tjj|�\}}d|j|f}ytj|�}Wqt	k
r�}z,t
jtd�||�t
j
tjjddd�WYdd}~XqXqWdS)Nz%s.%szFailed loading plugin "%s": %sr/T)r3)rr
�splitrJrV�splitextr'�	importlib�
import_modulerr6�errorr�logr�loggingZSUBDEBUG)rQZpy_files�fnr
�moduleZextrrrrrrL�s
rLcCsPg}t|�}t|�}t�}t�}x�|D]�}x�tjd|�D]�}tjjtjj|��\}}	d}
d}xR|D]J}tj||�rd|j|�d}
x&|D]}
tj||
�r�d}
|j|
�q�Wd}qdW|s�x"|D]}
tj||
�r�|j|
�q�W|
r:|j|�q:Wq&W|j	|�}|�rt
jtd�j
djt|����|j	|�}|�rLt
jtd�j
djt|����|S)Nz%s/*.pyTFz=No matches found for the following enable plugin patterns: {}z, z>No matches found for the following disable plugin patterns: {})r`�globrr
rh�basenamer>�addrV�
differencer6Zwarningr�formatr7rO)�pathsZdisable_pluginsrDr.Zpattern_enable_foundZpattern_disable_found�prnZplugin_nameZdummyZmatchedZenable_pattern_testedZpattern_skipZpattern_enableZenable_not_foundZdisable_not_foundrrrrK�sD






rKcs<�fdd�}tt�jd�tjf|�jdd��}|�_�S)z5A class decorator for automatic command registration.cs|r|j��dS)N)�register_command)rrr)�
command_classrrr �sz"register_command.<locals>.__init__rr)r r)�typerr'rr�aliasesZ_plugin)rxr Zplugin_classr)rxrrw�srw)Z
__future__rrrr>rprir^rm�operatorrr2r4rZdnf.loggingrZ
dnf.pycompZdnf.utilZdnf.i18nrZ	getLoggerr6rF�objectrr,rMrLrKrwrrrr�<module>s0
2f
%