Spade
Mini Shell
| Directory:~$ /lib/python2.7/site-packages/clcommon/cpapi/ |
| [Home] [System Details] [Kill Me] |
�
b=0Yc@sdZddlZddlmZddlZddlZddlmZmZmZddl m
Z
dZe�Zej
e�dZdZdZejd d
dd�r�ejd d
dd�Znejjejje�d
�Zd�Zed�ZdS(s
Library to work with plug-ins
i����N(tConfigParser(tCACHE_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
|ed�}|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_dirtpy_full_pathtmodulestmod_nametapit
import_stringtcontrolpanelnametdetect_func((s</usr/lib/python2.7/site-packages/clcommon/cpapi/pluginlib.pytdetectplugin
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(RR
RRRtshutiltrmtreetisdirtcopytreetmkdirtchmodtopentcloseR!RRtstrRRRtwritet
API_LINK_PATH(
tpludins_dirt CACHE_DIRtPLUGINS_PATHt cache_dirt init_pathRtcpnametetcpname_cachetapi_link_stream((s</usr/lib/python2.7/site-packages/clcommon/cpapi/pluginlib.pyt
rebuild_cacheCs<!
(t__doc__RRRR%tconstRRRtcpapiexceptionsRtCLSYSCONFIGtclsysconfigtreadRRRtPLUGINS_DIRt
has_optiontgetR
RRRR/R!R9(((s</usr/lib/python2.7/site-packages/clcommon/cpapi/pluginlib.pyt<module>s"
! #