• File: pluginlib.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/lib/python2.7/site-packages/clcommon/cpapi/pluginlib.pyc
  • Date Modified: 06/01/2017 4:14 PM
  • File size: 3.48 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

b=0Yc@sdZddlZddlmZddlZddlZddlmZmZmZddl	m
Z
dZeZej
edZdZdZejd	d
ddrejd	d
ddZnejjejjed
ZdZedZdS(s
Library to work with plug-ins
iN(tConfigParser(tCACHE_CPNAMEtUNKNOWN_CP_NAMEtUNKNOWN_CP_IMPORT(tPluginImportErrors/etc/sysconfig/cloudlinuxt
__cpname__tdetecttsectiontcpapitoptiont	plugindirs
apilink.pyc	Bsejjejje|}gejejj|dD](}ejjejj|d^q@}x|D]}|dkrqund}d||f}y|dUWne	d|fnXe
|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
Csd}d}tjjtjjt|}tj||retjj|retj||n
tj	|tj
|dtjj|d}t|djyt
|\}}Wn.tk
r}d	\}}dt|GHnX|dkr?tj|tj	|t|djt
|\}}n|dkrdtt}}d|GHn|rttd}|j||jttd}	|	j|d|	jndS(
Ntcachetpluginsis__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"	
!	#