ok

Mini Shell

Direktori : /proc/self/root/usr/lib/python2.7/site-packages/clcommon/cpapi/
Upload File :
Current File : //proc/self/root/usr/lib/python2.7/site-packages/clcommon/cpapi/pluginlib.pyc

�
b=0Yc@sdZddlZddlmZddlZddlZddlmZmZmZddl	m
Z
dZe�Zej
e�dZdZdZejd	d
dd�r�ejd	d
dd�Znejjejje�d
�Zd�Zed�ZdS(s
Library to work with plug-ins
i����N(tConfigParser(tCACHE_CPNAMEtUNKNOWN_CP_NAMEtUNKNOWN_CP_IMPORT(tPluginImportErrors/etc/sysconfig/cloudlinuxt
__cpname__tdetecttsectiontcpapitoptiont	plugindirs
apilink.pyc	Bsejjejje�|�}gejejj|d��D](}ejjejj|��d^q@}x�|D]�}|dkr�qund}d||f}y|dUWne	d|f��nXe
|ed�}|rue
|ed�}|r|�r||fSququWdS(s�
    Scan directory for the presence of plugins.
    Plugin is considered a file with the extension "py", and with a non-empty variable "__cpname__" inside
    (the name of the control panel).  Also in the file must be a function "detect" which returns True in the case of
    the presence of the control panel.

    >>> detectplugin('plugins')
    ('from .plugins import cpanel as api', 'cPanel')

    :param plugin_pack: package name or the name of the plug-ins directory
                       ('cache' - cache plugins users; 'plugins' - officially supported plug-ins)
    :rtype: tuple
    :return: a pair of values​​: (line to import the package, the name of the control panel)
    s*.pyit__init__sfrom %s import %s as apiNsCan not import %s plugin(NN(
tostpathtjointdirnamet__file__tglobtsplitexttbasenametNoneRtgetattrtCONTROLPANELNAME_VARtDETECTFUNCNAME_VAR(	tplugin_packt
plugin_dirtpy_full_pathtmodulestmod_nametapit
import_stringtcontrolpanelnametdetect_func((s</usr/lib/python2.7/site-packages/clcommon/cpapi/pluginlib.pytdetectplugin s"!M
c
Cs�d}d}tjjtjjt�|�}tj|�|retjj|�retj||�n
tj	|�tj
|d�tjj|d�}t|d�j�yt
|�\}}Wn.tk
r�}d	\}}dt|�GHnX|dkr?tj|�tj	|�t|d�j�t
|�\}}n|dkrdtt}}d|GHn|r�ttd�}|j|�|j�ttd�}	|	j|d�|	j�ndS(
Ntcachetpluginsi�s__init__.pytwsWARNING:sHWARNING: can not detect control panel; the control panel is set to "%s" s
(NN(RR
RRRtshutiltrmtreetisdirtcopytreetmkdirtchmodtopentcloseR!RRtstrRRRtwritet
API_LINK_PATH(
tpludins_dirt	CACHE_DIRtPLUGINS_PATHt	cache_dirt	init_pathRtcpnametetcpname_cachetapi_link_stream((s</usr/lib/python2.7/site-packages/clcommon/cpapi/pluginlib.pyt
rebuild_cacheCs<!






(t__doc__RRRR%tconstRRRtcpapiexceptionsRtCLSYSCONFIGtclsysconfigtreadRRRtPLUGINS_DIRt
has_optiontgetR
RRRR/R!R9(((s</usr/lib/python2.7/site-packages/clcommon/cpapi/pluginlib.pyt<module>s"	
!	#

Zerion Mini Shell 1.0